Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    BME680 data not changing

    BME680 data not changing

    physolo
    New Poster

    Hi,

     

    I am working a project with BME680 and MKL27 microcontroller. I am trying to get VOC and CO2 values.

    But the values are not changed also after long time, and also IAQ.

    I am not sure, but I guess the problem from timestamp. I found some examples of the function. But they are not declared in my program.

    Can you help me about that or give me some other examples in c?

    Under the text, I added my log of outputs and timestamp function.

    The result : 
    2021-01-06 11:13:06,[Timestamp(88840)],[IAQ (0)]: 25.000000,[T degC]: 28.299999,[H %rH]: 20.97,[P hPa]: 1008.84,[G Ohms]: 13053,[S]: 0,[static IAQ]: 25.00,[eCO2 ppm]: 500.000000000000000,[bVOCe ppm]: 0.4999999403953552246093750
    2021-01-06 11:13:10,[Timestamp(88840)],[IAQ (0)]: 25.000000,[T degC]: 28.307171,[H %rH]: 21.15,[P hPa]: 1008.90,[G Ohms]: 7311,[S]: 0,[static IAQ]: 25.00,[eCO2 ppm]: 500.000000000000000,[bVOCe ppm]: 0.4999999403953552246093750
    2021-01-06 11:15:04,[Timestamp(88840)],[IAQ (0)]: 25.000000,[T degC]: 28.411655,[H %rH]: 20.38,[P hPa]: 1008.78,[G Ohms]: 7079,[S]: 0,[static IAQ]: 25.00,[eCO2 ppm]: 500.000000000000000,[bVOCe ppm]: 0.4999999403953552246093750
    2021-01-06 11:15:05,[Timestamp(88840)],[IAQ (0)]: 25.000000,[T degC]: 29.838865,[H %rH]: 19.25,[P hPa]: 1008.86,[G Ohms]: 8275,[S]: 0,[static IAQ]: 25.00,[eCO2 ppm]: 500.000000000000000,[bVOCe ppm]: 0.4999999403953552246093750
    2021-01-06 11:15:07,[Timestamp(88840)],[IAQ (0)]: 25.000000,[T degC]: 28.525309,[H %rH]: 20.44,[P hPa]: 1008.78,[G Ohms]: 9109,[S]: 0,[static IAQ]: 25.00,[eCO2 ppm]: 500.000000000000000,[bVOCe ppm]: 0.4999999403953552246093750
    2021-01-06 11:15:10,[Timestamp(88840)],[IAQ (0)]: 25.000000,[T degC]: 28.405308,[H %rH]: 20.41,[P hPa]: 1008.78,[G Ohms]: 10129,[S]: 0,[static IAQ]: 25.00,[eCO2 ppm]: 500.000000000000000,[bVOCe ppm]: 0.4999999403953552246093750

     

    get_timestamp_us function : 

    int64_t get_timestamp_us()
    {
    struct timeval tv;
    uint64_t ret;
    if(gettimeofday(&tv, NULL) < 0)
    {
    printf("gettimeofday() error\r\n");
    return -1;
    }
    uint64_t millis = (tv.tv_sec) * 1000000 + (tv.tv_usec);//uint64_t millis = (tv.tv_sec) * 1000 + (tv.tv_usec)/1000;
    return millis;
    }

    tv_sec value is for example, 1609930499 and tv_usec 0 or under 0. I see just 0x0.

    I got the value of millis 662800064. I am not sure, whether it is right.

    5 REPLIES 5

    Minhwan
    Community Moderator
    Community Moderator

    Hello Physolo, 

     

    As you guess, your problem could be the get_timestamp_us function. 

    The function shall be your system timestamp based on micro second unit. 🙂 

    So, if the program call the function twice, it can measure some system time between it. 

    Thanks, 

    Hello Minhwan,

    thank you for your answer.

    I have more question. 

    Does the function, get_timestamp_us, mean time in epoch, realtime or time from starting the program, I mean 0us? 

    Should the value of this change while running?

     

    Thanks

    Minhwan
    Community Moderator
    Community Moderator

    Hello Physolo, 

     

    As timestamp, the value should be changing during runtime. 

    Thanks, 

    Hello Minhwan,

     

    I corrected that function like as start time in us - run time in us. The value of IAQ accuracy was 1 after 5 minutes and rise to 2 after 10 minutes. I saw the value 3 after 13 minutes.

     

    Does it mean that it works?

     

    And I have one more question. If the return value of the function, timestamp_us, is over 1000000, Should it initialise as 0? I mean, Whether I just check microseconds. 

     

    Thanks a lot for your help

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist