Do you know what part you’re using? My little breakout boards have four or five part numbers listed on the back with a “check box”, which is never actually checked. I had assumed they were compatible because of the shared 0x80 address and command sets. It turns out they’re similar but not totally compatible.
So, how to tell them apart?
SI7021
![image](https://forum.buspirate.com/uploads/default/original/1X/bfdff1716cd46dc5cc9740dcc8d78c7b1d388bd0.png)
![image](https://forum.buspirate.com/uploads/default/original/1X/77033ab48d8c0327aa703538bbd2d321cf64c358.png)
This is the SI7021 working properly with the built in macro.
![image](https://forum.buspirate.com/uploads/default/original/1X/632a4823f20423223ab156e96b9bce7643e0b2c1.png)
![image](https://forum.buspirate.com/uploads/default/original/1X/958af587029d501e7ce4ba17ffff66cbb1d5ec8b.png)
The key here is the first byte of the second half of the serial number. 0x15 indicates the part is SI7012.
SHT21/HTU21
![image](https://forum.buspirate.com/uploads/default/original/1X/406ee730a458d04b9e62d73cb66f033468d76a92.png)
SHT21 and HTU21 are identical. They have mostly the same commands as SI7021, but they lack the 0xe0 read temperature after humidity command and firmware revision. The only way to tell them apart that I found is the engraved part number on the package.
You have to dig into a different datasheet, but they also support the 0xfa 0x0f, and 0xfc 0xc9 serial number command. No mention of a manufacturer ID, but both the chips I have use 0x3c as first byte in first part of ID, and 0x01 as first byte of second part of ID.
And here I notice the tutorial is wrong about reading the serial. The first command has 8 bytes with CRCs and the second had 6 bytes with CRC.
![image](https://forum.buspirate.com/uploads/default/original/1X/107cb74c1042ebecc534ed30285cb64e6bdc3922.png)
Instead of using the 0xE0 command to read temperature, use 0xf3. This is also supported by the SI7021. I had to increase the delay to 100ms despite what the datasheet says, and I added a recommended 20uS delay before the first stop condition.
The formula for calculating humidity and temperature are the same as SI7021.
HDC1080
This is the HDC1080. It is actually made by TI, which shocked me to be honest.
![image](https://forum.buspirate.com/uploads/default/original/1X/f2c071b255bbc942e4a988e539db7c263148c853.png)
The commands are significantly different. This is the temperature register.
![image](https://forum.buspirate.com/uploads/default/original/1X/378a6b6ba630fd856cf51f7b025a52478e56c95d.png)
Command 0xff gets a 2 byte ID which is 0x10 0x50 for this part.
In light of this, I’m going to update the tutorial and macro to use the common commands of the SI7021 and SHT21D. I’ll remove reference to the HD1080.