Bosch Sensortec Community

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

    Unique IDs in Bosch Sensors?

    Unique IDs in Bosch Sensors?

    rmax
    New Poster

    Hi,

    yesterday I talked to a guy from Bosch Sensortec on their booth at Embedded World and told him it would be nice if devices like the BME280 had unique IDs similar to the 1wire devices. He said that he thinks they have that, but it might only be documented in the BME680's datasheet. So I checked that, but only found the "Unique Chip ID" that's also present in the BME280 documentation. That ID is only unique per sensor model, but I was looking for IDs that are unique to each single device.

    So, either it was a misunderstanding and he was referring to that model ID, or there is a per device unique ID that's not documented in either of the manuals.

    I noticed that there are some apparently random bytes in undocumented or reserved areas of the BME280's register file, so I still wonder if some of them form a unique ID.

    As a workaround I currently construct a unique ID by hashing the calibration data, but of course I can't be sure if there are no two devices with the identical calibration data, so it would be nice to have an ID that is guaranteed to be unique.

    cu
    rmax

    3 REPLIES 3

    kgoveas
    Community Moderator
    Community Moderator

    Hi rmax,

    Yes, we do have a Unique ID for each individual sensor that is not documented in the datasheet. It is retrieved from 4 reserved registers. Below is a snippet for the BME680 based on our sensor API. You can try the same for the BME280 if you already have a few to verify with.

     

    #define BME680_REG_UNIQUE_ID     UINT8_C(0x83)
    
    uint8_t uid_regs[4];
    
    bme680_get_regs(BME680_REG_UNIQUE_ID, uid_regs, 4, dev);
    uint32_t unique_id = ((((uint32_t)uid_regs[3] + ((uint32_t)uid_regs[2] << 8)) & 0x7fff) << 16) +
                                         (((uint32_t)uid_regs[1]) << 😎 + (uint32_t)uid_regs[0];

    Thanks, kgoveas!

    The four bytes at offset 0x83..0x86 are indeed unique across the 11 pieces of BME280 I checked so far.

    But this raises a few more questions:

    • It looks a bit unusual that such a 4-byte sequence starts at an odd offset, so please confirm that this is intentional and not an off-by-one error.
    • On a similar note, is it intentional that the four bytes get ordered 2-3-1-0 (rather than 3-2-1-0) in the final unique_id value?
    • Out of curiosity: Do these bytes have any specific meaning, such as lot ID, wafer number and position on the wafer?
    • And finally, I wonder why Bosch doesn't officially document such a useful feature and what other interesting features there might be hidden beind the other registers that are not documented and have a value != 0. Smiley Wink

    kgoveas
    Community Moderator
    Community Moderator

    Hi rmax,

    To answer in brief,

    - The register address is correct

    - Yes, the ordering is intentional. This is the official trace code you will need to provide in case you have a batch of faulty sensors.

    - Smiley Wink this will remain confidential.

    - For stable and robust operation of the sensor, we do not provide information on registers that are not already documented in the datasheet.

     

    I hope this answers most of your questions.


    Regards,

    kgoveas

    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