Dear Rui, dear All,
HELP!
with my son, we have bought and read several books by Santos, in particular webserver & homeautomation. We have also followed several tutorials. We have managed so to build webserver reading/controlling several sensors/ appliances. Now we are in trouble.
We have bought a Sonoff TH16 with SI7021 hum/temp sensor. It is a I2C device that has been implmented by sonoff as onewire bus (not clear to me how). It would be very convenient for our projects but we have not found any library or tutorial how to read the sensor. We understand that GPIO is 14 but how can we read it? We use visulstudio and platformIO.
Can you help us? Please!!!
Regards, Claudio&Matteo
Hi Claudio.
Unfortunately, we’re not familiar with that sensor.
But, can you better explain what you want to do with the sensor?
If the sensor communicates via onewire bus, maybe a onewire library can be useful to read from the sensor. But I’m not familiar with that process.
Regards,
Sara
Hi Sara,
the SI7021 seems to be a more reliable hum/temp I2C sensor.. Adafruti has a library (not updated as I understand). The problem is that Sonoff has packed the sensor with a small MCU to turn into a onewire cnnection (sorry I am a newbie and my wording might be incorrect). I would like to use the sonoff TH16 with a custom webserver (I have already done it with a sonoff basic using your tutorials but only to control the relay), using the readings of the Sonoff sensor (it is convenient since you just plug it). My problem is how to read the GPIO14 since I can’t use the I2C library. Likely is not doable and I have to use another sensor and find a way to wire it to the sonoff TH16.
many tks!
Claudio & Matteo
Hi again.
Now, I perfectly understand what you want to do.
I’ve searched for a while and found that there is little information about that conversion from I2C to some kind of onewire bus.
I’ve read in the Arduino forum, that it may be compatible with the DHT library.
So, I suggest that you try a sample code from the DHT library. Don’t forget to change the GPIO it is connected to in the code.
Then, let me know if it works. If this doesn’t work, I don’t have any other suggestions. I couldn’t find what kind of MCU they use to convert from I2C to one bus.
Regards,
Sara