Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    Unique IDs in Bosch Sensors?

    Unique IDs in Bosch Sensors?

    New Poster


    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.


    3 REPLIES 3

    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

    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.