Ever wondered how your indoor urban farm is doing in this cold snap but you now live too far away to conveniently stop by every day? No? Just me? Then perhaps you just want to keep an eye on your basement, your drying laundry or anywhere you’ve had a recurring leak.
An internet connected temperature and humidity meter that logs to an open platform (in this case thingspeak) letting you monitor, set alerts (via ifttt.com) and even (if you’ve got your heater or dehumidifier connected to a smart plug) take remedial action.
We use an ESP-01 wifi module as it’s simple yet powerful enough to get the job done. we add a connector, voltage regulator and smoothing capacitor to allow it to be powered from usb and a DHT-22 with pull-up resistor to take the measurements.
Note in the below diagrams it’s showing three pin voltage regulator, but in reality this project uses a 4 pin voltage regulator module, I just haven’t had time to create a fritzing part for that module yet. These modules also work too.
There is a GitHub repository with the code for this board. Note that the code supports other sensors, in fact ds18b20 temperature sensors can be swapped out for the DHT22 and will just work with no rewiring necessary.
First step is to create a new thingspeak channel for your device, if you don’t already have an account, they’re free so sign up and create a new channel. Once your channel is created, you’ll need to make a note of it’s write API key, this is available in your channel’s API Keys section.
Now you can power on your board, the first time it’s powered on it will need to be configured. The allow configuration, your board will launch it’s own access point (starting ESP), connect to this access point:
On some systems the next screen will launch automatically, if it doesn’t you might need to go to any web page (e.g. google.co.uk) and it should redirct you. The next screen is the main menu of the board, from here select Configure Wifi:
This will take you to a configuration page where you can enter you wifi SSID and Password along with your thingspeak channel’s write API key (see above) and the sensor model, in this case DHT22:
When you’re done, press save. This should cause the ESP board to close it’s access point (your wifi connection will drop) and connect using the wifi credentials you gave it. If everything works it should start logging to your thingspeak channel. If it doesn’t work, try looking for the ESP access point again and reconfiguring. Pressing the reconfigure button will cause the ESP to forget it’s network setting and relaunch the access point so you can reconfigure it. This is especially useful if you’ve made a typo with the API key (been there, done that).
This project taught me a lot about supplying an ESP8266 with stable power. The smoothing capacitor were a late addition (indeed the 0.1uF cap has yet to be implemented on any of my test boards) but without that stabilisation everything was shaky.