ESP8266 and DS18B20 - wireless ThingSpeak sensor
Here is another small project of mine: battery operated ESP8266 ESP-01 WiFi thermometer using DS18B20 and ThingSpeak API to collect data.
Before we proceed, you should:
- Know how to program ESP8266 with Arduino IDE
- Know how to run ESP8266 on battery power for months
- Have an account on ThinkSpeak, create a channel and obtain write API key
Required hardware list:
- ESP8266 ESP-01
- DS18B20 digital thermometer
- 2 AA batteries and a holder. I'm using 3D printed from this design
- 4.7kOhm resistor
- some wires and universal PCB. I'm using 50x70mm
Electrical diagram is pretty simple and it takes only few minutes to solder everything into place. Please remember about deep sleep hack. It is required!
Code is also pretty straight forward: connect to WiFi, read temerature from DS18B20, sent temperature to ThingSpeak, go to sleep for 15 minutes, reboot and start again.
The only "mysterious" line of code is ESP.eraseConfig();
. By default it is commented out and if everything is working, leave it like this. I have one ESP module that fails to change WiFi network if this line is not in place. I do not fully understand why it solves the problem, but it solves it. Maybe somebody more experience could throw some light on it?
Results can be seen here.
At this moment I have 2 wireless sensors connected to my heating system to monitor when it is working. More is on the way.
I'm Paweł Spychalski and I do things. Mainly software development, FPV drones and amateur cinematography. Here are my YouTube channels: