-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sonoff SI7021 sensor on TH10 #735
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). SHT1X: Sensor did not ACK command 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. |
AM2301 works great.
…On Mon, Oct 9, 2017, 23:08 Chris ***@***.***> 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
<#735 (comment)>,
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. 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 |
@bobo-t Thank you! sensor works now |
@zalessky could you provide a more detailed guide on how you achieved that? |
|
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 ***@***.***> 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
<#735 (comment)>,
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 |
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 :-) |
5.10.0a * Add (experimental) support for sensor SHT3x * Add support for sensor MH-Z19(B) using serial interface to be enabled with define USE_MHZ19 in user_config.h (#561, #1248) * Add (experimental) support for sensor MH-Z19(B) using SoftwareSerial to be enabled with define USE_MHZ19 in user_config.h (#561, #1248) * Add support for iTead SI7021 temperature and humidity sensor by consolidating DHT22 into AM2301 and using former DHT22 as SI7021 (#735) * Fix BME280 calculation (#1051) * Add support for BME680 using adafruit libraries (#1212) * Change ADS1115 default voltage range from +/-2V to +/-6V (#1289) * Add multipress support and more user configurable options to Sonoff Dual R2 (#1291) * Fix Sonoff Bridge missed learned key if learned data contains 0x55 (End of Transmission) flag (#1095, #1294) * Add support for TSL2561 using adafruit library (#661, #1311) * Add alternative support for SHT3x (#1314)
So how should the module configuration look like? |
5.10.0a * Add (experimental) support for sensor SHT3x * Add support for sensor MH-Z19(B) using serial interface to be enabled with define USE_MHZ19_HARD_SERIAL in user_config.h (#561, #1248) * Add (experimental) support for sensor MH-Z19(B) using SoftwareSerial to be enabled with define USE_MHZ19_SOFT_SERIAL_OBSOLETE in user_config.h (#561, #1248) * Add (experimental) support for sensor MH-Z19(B) using stripped SoftwareSerial to be enabled with define USE_MHZ19_SOFT_SERIAL in user_config.h (#561, #1248) * Add support for iTead SI7021 temperature and humidity sensor by consolidating DHT22 into AM2301 and using former DHT22 as SI7021 (#735) * Fix BME280 calculation (#1051) * Add support for BME680 using adafruit libraries (#1212) * Change ADS1115 default voltage range from +/-2V to +/-6V (#1289) * Add multipress support and more user configurable options to Sonoff Dual R2 (#1291) * Fix Sonoff Bridge missed learned key if learned data contains 0x55 (End of Transmission) flag (#1095, #1294) * Add support for TSL2561 using adafruit library (#661, #1311) * Add alternative support for SHT3x (#1314)
5.11.0 20180107 * Minor webpage HTML optimizations (#1358) * Updated German translation (#1438) * Change Sonoff Pow Energy MQTT data message and consolidate Status 8 into Status 10 * Change ADS1115 default voltage range from +/-2V to +/-6V (#1289) * Change text to Active for 3 minutes (#1364) * Change Wemo SetBinaryState to distinguish from GetBinaryState (#1357) * Change output of HTTP command to valid JSON and Array only (#1363) * Removed all MQTT, JSON and Command language defines from locale files and set fixed to English (#1473) * Renamed commands Color2,3,4 to Color3,4,5 * Fix BME280 calculation (#1051) * Fix Sonoff Bridge missed learned key if learned data contains 0x55 (End of Transmission) flag (#1095, #1294) * Fix PWM initialization in Dimmer/Color mode (#1321) * Fix Wemo Emulation (#1357) * Fix display of build date and time in non-english locale (#1465) * Fix Wemo and Hue emulation by adding M-Search response delay (#1486) * Add libraries Adafruit_BME680-1.0.5, Adafruit_Sensor-1.0.2.02, TasmotaSerial-1.0.0 and TSL2561-Arduino-Library * Add command Color2 to set color while keeping same dimmer value * Add device function pointers * Add support for SenseAir S8 CO2 sensor * Add color led signal to Carbon Dioxide (CO2) sensors using defines CO2_LOW and CO2_HIGH in user_config.h * Add support for Domoticz Air Quality sensor to be used by MH-Z19(B) and SenseAir sensors * Add support for PZEM004T energy sensor * Add support for iTead SI7021 temperature and humidity sensor by consolidating DHT22 into AM2301 and using former DHT22 as SI7021 (#735) * Add support for BME680 using adafruit libraries (#1212) * Add support for MH-Z19(B) CO2 sensor (#561, #1248) * Add multipress support and more user configurable GPIO to Sonoff Dual R2 (#1291) * Add support for TSL2561 using adafruit library (#661, #1311) * Add support for SHT3x (#1314) * Add support for Arilux LC06 (#1414) * Add Italian language file (#1449) * Add 2nd Gen Alexa support to Wemo emulation discovery (#1357, #1450) * Add define for additional number of WS2812 schemes (#1463)
Just upgraded to 5.11.0 and my si7021 works great! Thanks, probably can make this closed now |
5.11.0 20180107 * Minor webpage HTML optimizations (arendst#1358) * Updated German translation (arendst#1438) * Change Sonoff Pow Energy MQTT data message and consolidate Status 8 into Status 10 * Change ADS1115 default voltage range from +/-2V to +/-6V (arendst#1289) * Change text to Active for 3 minutes (arendst#1364) * Change Wemo SetBinaryState to distinguish from GetBinaryState (arendst#1357) * Change output of HTTP command to valid JSON and Array only (arendst#1363) * Removed all MQTT, JSON and Command language defines from locale files and set fixed to English (arendst#1473) * Renamed commands Color2,3,4 to Color3,4,5 * Fix BME280 calculation (arendst#1051) * Fix Sonoff Bridge missed learned key if learned data contains 0x55 (End of Transmission) flag (arendst#1095, arendst#1294) * Fix PWM initialization in Dimmer/Color mode (arendst#1321) * Fix Wemo Emulation (arendst#1357) * Fix display of build date and time in non-english locale (arendst#1465) * Fix Wemo and Hue emulation by adding M-Search response delay (arendst#1486) * Add libraries Adafruit_BME680-1.0.5, Adafruit_Sensor-1.0.2.02, TasmotaSerial-1.0.0 and TSL2561-Arduino-Library * Add command Color2 to set color while keeping same dimmer value * Add device function pointers * Add support for SenseAir S8 CO2 sensor * Add color led signal to Carbon Dioxide (CO2) sensors using defines CO2_LOW and CO2_HIGH in user_config.h * Add support for Domoticz Air Quality sensor to be used by MH-Z19(B) and SenseAir sensors * Add support for PZEM004T energy sensor * Add support for iTead SI7021 temperature and humidity sensor by consolidating DHT22 into AM2301 and using former DHT22 as SI7021 (arendst#735) * Add support for BME680 using adafruit libraries (arendst#1212) * Add support for MH-Z19(B) CO2 sensor (arendst#561, arendst#1248) * Add multipress support and more user configurable GPIO to Sonoff Dual R2 (arendst#1291) * Add support for TSL2561 using adafruit library (arendst#661, arendst#1311) * Add support for SHT3x (arendst#1314) * Add support for Arilux LC06 (arendst#1414) * Add Italian language file (arendst#1449) * Add 2nd Gen Alexa support to Wemo emulation discovery (arendst#1357, arendst#1450) * Add define for additional number of WS2812 schemes (arendst#1463)
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 However a second identical device and sensor gives me |
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. |
* Add (experimental) support for iTead SI7021 temperature and humidity sensor (arendst#735) * Change ADS1115 default voltage range from +/-2V to +/-6V (arendst#1289)
5.10.0a * Add (experimental) support for sensor SHT3x * Add support for sensor MH-Z19(B) using serial interface to be enabled with define USE_MHZ19 in user_config.h (arendst#561, arendst#1248) * Add (experimental) support for sensor MH-Z19(B) using SoftwareSerial to be enabled with define USE_MHZ19 in user_config.h (arendst#561, arendst#1248) * Add support for iTead SI7021 temperature and humidity sensor by consolidating DHT22 into AM2301 and using former DHT22 as SI7021 (arendst#735) * Fix BME280 calculation (arendst#1051) * Add support for BME680 using adafruit libraries (arendst#1212) * Change ADS1115 default voltage range from +/-2V to +/-6V (arendst#1289) * Add multipress support and more user configurable options to Sonoff Dual R2 (arendst#1291) * Fix Sonoff Bridge missed learned key if learned data contains 0x55 (End of Transmission) flag (arendst#1095, arendst#1294) * Add support for TSL2561 using adafruit library (arendst#661, arendst#1311) * Add alternative support for SHT3x (arendst#1314)
5.10.0a * Add (experimental) support for sensor SHT3x * Add support for sensor MH-Z19(B) using serial interface to be enabled with define USE_MHZ19_HARD_SERIAL in user_config.h (arendst#561, arendst#1248) * Add (experimental) support for sensor MH-Z19(B) using SoftwareSerial to be enabled with define USE_MHZ19_SOFT_SERIAL_OBSOLETE in user_config.h (arendst#561, arendst#1248) * Add (experimental) support for sensor MH-Z19(B) using stripped SoftwareSerial to be enabled with define USE_MHZ19_SOFT_SERIAL in user_config.h (arendst#561, arendst#1248) * Add support for iTead SI7021 temperature and humidity sensor by consolidating DHT22 into AM2301 and using former DHT22 as SI7021 (arendst#735) * Fix BME280 calculation (arendst#1051) * Add support for BME680 using adafruit libraries (arendst#1212) * Change ADS1115 default voltage range from +/-2V to +/-6V (arendst#1289) * Add multipress support and more user configurable options to Sonoff Dual R2 (arendst#1291) * Fix Sonoff Bridge missed learned key if learned data contains 0x55 (End of Transmission) flag (arendst#1095, arendst#1294) * Add support for TSL2561 using adafruit library (arendst#661, arendst#1311) * Add alternative support for SHT3x (arendst#1314)
1. Only DHT22 protocol has been changed according to the issue arendst#5619. 2. noInterrupts() command moved to the begining of the reading protocol. 3. One switch created to embrace protocols for all sensors in one place for better code readability (protocols revision gathered below and placed in code comments). 4. Tested on AM2302. Usually issue arendst#5619 occured after several hours and needed power cycle reboot. Currently works without a problem for over 2 days. DHT21, DHT22, AM2301, AM2302 Specs: https://cdn-shop.adafruit.com/datasheets/Digital+humidity+and+temperature+sensor+AM2302.pdf Protocol: 1. MCU PULLS LOW data bus for 1 to 10ms to activate sensor 2. MCU PULLS UP data bus for 20-40us to ask sensor for response 3. SENSOR PULLS LOW data bus for 80us as a response 4. SENSOR PULLS UP data bus for 80us for data sending preparation 5. SENSOR starts sending data (LOW 50us then HIGH 26-28us for "0" or 70us for "1") DHT11 Specs: https://www.mouser.com/datasheet/2/758/DHT11-Technical-Data-Sheet-Translated-Version-1143054.pdf Protocol: 1. MCU PULLS LOW data bus for at least 18ms to activate sensor 2. MCU PULLS UP data bus for 20-40us to ask sensor for response 3. SENSOR PULLS LOW data bus for 80us as a response 4. SENSOR PULLS UP data bus for 80us for data sending preparation 5. SENSOR starts sending data (LOW 50us then HIGH 26-28us for "0" or 70 us for "1") SI7021 Specs: https://www.silabs.com/documents/public/data-sheets/Si7021-A20.pdf Protocol: Reverse-engineered on arendst#735 (comment): 1. MCU PULLS LOW data bus for at 500us to activate sensor 2. MCU PULLS UP data bus for ~40us to ask sensor for response 3. SENSOR starts sending data (LOW 40us then HIGH ~25us for "0" or ~75us for "1") 4. SENSOR sends "1" start bit as a response 5. SENSOR sends 16 bits (2 bytes) of a humidity with one decimal (i.e. 35.6% is sent as 356) 6. SENSOR sends 16 bits (2 bytes) of a temperature with one decimal (i.e. 23.4C is sent as 234) 7. SENSOR sends 8 bits (1 byte) checksum of 4 data bytes
Is it possible to use more than one of sonoff's (itead) sensors with their one wire bus (not I2C) on one GPIO? I've seen others doing that via I2C, but on one-wire there seems to be no bus-scan and only one sensor possible to choose, correct? |
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 #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?
The text was updated successfully, but these errors were encountered: