It has been a while since my last post, but I haven’t really done any new things, and everything has pretty much just worked as it should.
What broke, was my very first Sonoff, which is in the most read post (http://tritek.pw/2016/05/22/replacing-the-itead-sonoff-firmware/), and has been put through quite a few experiments and mishaps, one which involved 5v where it should only have 3v3… And that is probably what has shortened it’s lifetime dramatically.
To replace it, I ordered the Sonoff TH10, mostly because I like the spring loaded terminals, and it is easy to connect a temperature sensor. And that is what I ordered at the same time, which is a AM2301 based sensor.
Out of the box, the Sonoff TH10 worked straight out of the box without any problems, and it found the temperature sensor too and reported that to the phone app too, but as usual, this isn’t what I want. I want to have it controlled by my own server, and be able to control it from OpenHAB.
Inside the TH10 it was easy to find the pins to flash it with, because they labeled VCC and GND on the silkscreen, RX and TX isn’t labeled, but if one way isn’t working, swap them around.
The biggest problem I had flashing it, was the CH340G I was using, also had turned bad for some reason. It was flashing the ESP8266 inside the TH10, but when it tried to run the code, it had some random unexpected results. And after trying a lot of different settings, I finally decided to try another TTL adapter, and that changed everything. First upload of new code, and it came to life as it should.
To flash it, I used these settings in the Arduino IDE.
The AM2301 sensor
After getting ESP Easy flashed to the TH10, it was time to see if the temperature sensor would work too. And it did!
On the PCB it is attached to GPIO-14, and setting it’s type to DHT 22 made it start reporting temperature and humidity, which was pretty close to the other sensors around the workbench.
And that’s it. No small hacks, no code change, just upload it and start using it. Ignoring the broken CH340G, it has been very easy to get the TH10 to work with ESP Easy, and be controlled from my own server.