Tasmota: Sonoff SI7021 sensor on TH10

Created on 14 Aug 2017  Â·  35Comments  Â·  Source: arendst/Tasmota

I have a TH10 with an official SI7021 sensor connected. It works fine through ewlink with original Sonoff FW 2.0.4. I dont get any sensor appearing when flashing Tasmota 5.5.2.

I can see that others got this to work (here https://github.com/arendst/Sonoff-Tasmota/issues/96 ), maybe with a Basic instead of a TH10, but I somehow cannot. I did set gpio4 to I2C SDA and gpio14 to I2C SCL as mentioned in the wiki https://github.com/arendst/Sonoff-Tasmota/wiki/Sensor-Configuration . A scan in the console shows nothing: {"I2Cscan":"No devices found"}

How does the single connected data wire (https://www.itead.cc/wiki/Sonoff_Sensor_Si7021) work with the two gpio ports anyway? Does anyone have this working on a TH10?

stale

Most helpful comment

I also bought five ITEAD's Si7021 sensors and noticed that those don't work with Tasmota. So, I took my logic analyzer and reverse engineered it. I can send more details later, if needed, but it looks their "one wire" protocol is quite simple. First, the host need to send 0.5ms low pulse, then go high for ~40us, and then move to tri-state (INPUT) to let the sensor send data back. The sensor sends totally 1bit+5 bytes/41 bits (MSB order). At first, the sensor sends a "start bit" that is "1". Next two bytes/16 bits are humidity with one decimal (i.e. 35.6% is sent as 356), two bytes/16 bits after that are temperature in Celsius, again with one decimal (i.e. 23.4C is sent as 234), and finally the last byte/8 bits is a checksum. When sensor sends logical "1" it pulls the line HIGH to ~75us, when it sends logical "0", it pulls the line HIGH to ~25us. There is about 40us (LOW) between HIGH pulses. Checksum is basically a (8-bit) sum of 4 data bytes. I also wrote a simple test code and got right values from the sensor without ITEAD's firmware, so, I believe my revers engineering is correct. @arendst, are you interested to add the support to some following release if I provide needed details?

All 35 comments

ah, looking at the schematics of the sensor, there is an MCU present, so that may translate to some kind of 1-wire protocol.

same issue here, I have a TH16 / Si7021, works with fw 2.0.4, it's not detected with Tasmota 5.5.2b (configured as per wiki).
with web log level 3 I see in console after reboot:

SHT1X: Sensor did not ACK command
I2C: T/RH? found at address 0x40

i2cscan returns "No devices found"

Yeah, I guess its a 1-wire protocol, not i2c that we see at the Sonoff. So either its compatible with one of the other existing sensors or its something new. I could not get it to work in a first testing with DHT11, AM2301, DHT22, DS18x20, so I guess its time to get out the signal analyzer ;-).

did you go to the module definition and set the GPIOs correctly?

my settings: module 1 , gpio14 5, gpio6 6

Hmm, from the wiki I thought it would be gpio4 to I2C SDA and gpio14 to I2C SCL. But googling the cable connector pinout shows that only gpio14 is actually connected, so the protocol cannot be I2C as that would require two GPIOs.

Well there is the bare SI7021 which is an I2C device and there is the ITEAD provided SI7021 external sensor which is the same I2C device controlled by an internal microcontroller to make it a one wire device.

Tasmota currently only supports the bare I2C device as I have no info about the one wire ITEAD protocol.

I soldered a strap on TH16 PCB to make available GPIO4 to 4-wire jack and then i decoupled the SCA and SCL pins from MCU on ITEAD's Si7021 sensor and connected the wires to Si7021 chip (including the extra one), now it's working:

STATUS10 {"StatusSNS":{"Time":"2017-08-18T12:59:20", "SI7021":{"Temperature":28.8, "Humidity":37.1}, "TempUnit":"C"}}

anyway it's probably better to use 3-wire type of sensor .

I have the same issue with a non functioning Itead SI7021 sensor.
So just to be sure, If we buy an alternative single wire sensor as summarized at https://github.com/arendst/Sonoff-Tasmota/wiki/Sensor-Configuration , we should be good to go? If so , any particular type which is recommended?

AM2301 works great.

On Mon, Oct 9, 2017, 23:08 Chris notifications@github.com wrote:

I have the same issue with a non functioning Itead SI7021 sensor.
So just to be sure, If we buy an alternative single wire sensor as
summarized at
https://github.com/arendst/Sonoff-Tasmota/wiki/Sensor-Configuration , we
should be good to go? If so , any particular type which is recommended?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/arendst/Sonoff-Tasmota/issues/735#issuecomment-335287314,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAj5G8OzQblHnjdoEVFLeAe6s8y1ZA4lks5sqomegaJpZM4O2cNK
.

Thx @cuptoaster, I'll buy one!

I already bought two TH10 with two ITEAD's Si7021 (before reading this). Will Tasmota support them in the (near) future or do I better buy supported ones?

Does anyone know the protocol used on ITEAD 1-wire si7021 to be able to develop a plugin ?

FYI, I asked on their forum. This is ITEADs answer:

"Sonoff Si7021 just used for our TH device.
So we don't offer protool to customer."

On another note: I would think that reverse engineering the protocol would not be a big thing, I just never got around to connect my USB scope yet.

Same here: T/RH? found at 0x40, and no data. Only reading this AFTER i bought the sensors :-(

@cputoaster Would be great if you can get around the reverse engineering some day!

@bobo-t can show on the photo where and how soldered on the Si7021? And how to configure the firmware? I have the same sensor, but I can not get it to work

See below picture:
si7021
You need to disconnect the other chip (see the cut on the pcb).
Software configuration:
Module type Sonoff TH
GPIO1 None
GPIO3 None
GPIO4 06 I2C SDA
GPIO14 05 I2C SCL

@bobo-t Thank you! sensor works now

@zalessky could you provide a more detailed guide on how you achieved that?

@ruimarinho

  1. blow out a small chip with a blowtorch
  2. solder the data wires as in the picture above from @bobo-t
  3. solder the other end of them to the TN card for GIPO4 and GIPO14 - as in the picture:
    http://tinkerman.cat/wp-content/uploads/2016/10/20161004_220416_LABELSs.jpg
  4. You can leave the power wires for tests as is, but you can also solder them - at your discretion.
    At me the sensor has earned only on firmware ESP Easy
    setup as in the wiki: https://www.letscontrolit.com/wiki/index.php/SI7021/HTU21D

Thank you very much for your comment. On the wiki, it says Tasmota supports SI7021. Weren't you able to get it working as well?

No. I could not tune in

@ruimarinho I found my error in the settings and this sensor earned on Tastota firmware. all OK. The sensor is not detected immediately. need a little wait :)

I also bought five ITEAD's Si7021 sensors and noticed that those don't work with Tasmota. So, I took my logic analyzer and reverse engineered it. I can send more details later, if needed, but it looks their "one wire" protocol is quite simple. First, the host need to send 0.5ms low pulse, then go high for ~40us, and then move to tri-state (INPUT) to let the sensor send data back. The sensor sends totally 1bit+5 bytes/41 bits (MSB order). At first, the sensor sends a "start bit" that is "1". Next two bytes/16 bits are humidity with one decimal (i.e. 35.6% is sent as 356), two bytes/16 bits after that are temperature in Celsius, again with one decimal (i.e. 23.4C is sent as 234), and finally the last byte/8 bits is a checksum. When sensor sends logical "1" it pulls the line HIGH to ~75us, when it sends logical "0", it pulls the line HIGH to ~25us. There is about 40us (LOW) between HIGH pulses. Checksum is basically a (8-bit) sum of 4 data bytes. I also wrote a simple test code and got right values from the sensor without ITEAD's firmware, so, I believe my revers engineering is correct. @arendst, are you interested to add the support to some following release if I provide needed details?

Thanks a lot! Would be a great addition!

On Sat, Dec 2, 2017, 21:37 Kari Kuisma notifications@github.com wrote:

I also bought five ITEAD's Si7021 sensors and noticed that those don't
work with Tasmota. So, I took my logic analyzer and reverse engineered it.
I can send more details later, if needed, but it looks their "one wire"
protocol is quite simple. First, the host need to send 0.5ms low pulse,
then go high for ~40us, and then move to tri-state (INPUT) to let the
sensor send data back. The sensor sends totally 1bit+5 bytes/41 bits (MSB
order). At first, the sensor sends a "start bit" that is "1". Next two
bytes/16 bits are humidity with one decimal (i.e. 35.6% is sent as 356),
two bytes/16 bits after that are temperature in Celsius, again with one
decimal (i.e. 23.4C is sent as 234), and finally the last byte/8 bits is a
checksum. When sensor sends logical "1" it pulls the line HIGH to ~75us,
when it sends logical "0", it pulls the line HIGH to ~25us. There is about
40us (LOW) between HIGH pulses. Checksum is basically a (8-bit) sum of 4
data bytes. I also wrote a simple test code and got right values from the
sensor without ITEAD's firmware, so, I believe my revers engineering is
correct. @arendst https://github.com/arendst, are you interested to add
the support to some following release if I provide needed details?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/arendst/Sonoff-Tasmota/issues/735#issuecomment-348718383,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAj5GzpPwsDWXmwIeW8VP6T44-yIBqmtks5s8bTngaJpZM4O2cNK
.

@kkuisma well done. It would be great to have this protocol included. I bought 4 th16 & 4 si7021 prior to reading this thread.

@kkuisma looking at the easpeasy code for the dht devices the protocol looks very similar. Perhaps itead implemented the si7021 as a variant of the dht devices.

I can confirm that Itead's SI7021 sensor behaves like their AM2301. They have just created a facade to make it use the same protocol. @arendst , your code is different from mine but I think you will only have to change the "delay(20);" in line 88 of the dht file to "delayMicroseconds(500);"

BTW, thanks a lot @kkuisma

Thnx both @kkuisma and @xoseperez for your input. I will release an updated xsns_06_dht.ino with the suggested change from Xose.

To make this a kind of seamless I consolidated the current DHT22 sensor selection into the AM2301 sensor selection as the handler for these two sensor has always been the same. The old DHT22 sensor selection is now changed to the new iTead SI7021 sensor using the by Xose proposed timing delay.

Give it a try and let me know your experience

Excellent! Thx a lot @arendst, and @xoseperez. I just tried the latest version and with very quick and short test, it seems to work perfectly with ITEAD's Si7021 sensor :-)

So how should the module configuration look like?
I have "Module type (Sonoff Basic)" as "04 Sonoff TH" and "GPIO14 Sensor" as "03 SI7021"
But I don't get any measurement...
[Edit] Problem solved: the configuration is correct, it was a HW issue!

Just upgraded to 5.11.0 and my si7021 works great! Thanks, probably can make this closed now

Just tried with the itead si7021 module and brand new th16's (ver 2.1 dated 2017-6-8 on silkscreen) and dev branch of tasmota; am getting this:

DHT: Timeout waiting for start signal high pulse

when configured as GPIO14

Board is only powered over serial - if this matters at all, haven't tested off AC with in built rectifier. I bought a bunch of these to monitor our new house (it's an old damp house unfortunately) and the prospect of needing to mod all of them and my th16's for I2C doesn't really sound appealing.

Powered over AC and with a new Sonoff TH16 v2.1 2017-6-8 and a new Sonoff Sensor SI7021 v1.0 running Sonoff-Tasmota 5.13.1, and module configured as 04 Sonoff TH, GPIO14: 03 SI7021, this works fine.

However a second identical device and sensor gives me DHT: Timeout waiting for start signal high pulse. I believe this is because I plugged the sensor in with the board powered up. If you get this error you may have a damaged sensor.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JoergZ2 picture JoergZ2  Â·  3Comments

Joeyhza picture Joeyhza  Â·  3Comments

renne picture renne  Â·  3Comments

jensuffhaus picture jensuffhaus  Â·  3Comments

TylerDurden23 picture TylerDurden23  Â·  3Comments