ESP8266 WiFi Temperature and Humidity Monitor

So recently I needed a temperature and humidity monitor for the basement. I didn’t even look whether there was anything to buy because I knew I had all the parts to quickly build one. And so I did, it’s so embarrassingly simple that it took me less than an hour for everything including firmware.

Hardware

I used a ESP8266 D1 board, the circuit is super simple, a 15kΩ pullup resistor on the data line of the AM2302 and a LED and associated current limiting 470Ω resistor.

The LED light up if the ESP8266 is not connected to the WiFi or if the sensor is yielding an error state.

Temperature Sensor outside Temperature Sensor inside

Firmware

For interfacing with the DHT22/AM2302 I used the DHTesp library. By default the webserver on the ESP8266 shows a web page with the relevant data. Adding /json to the URL on the other hand returns all values as a convenient JSON structure. I’ve designed the JSON structure to support multiple sensors as well, such for the case that I build another one with multiple sensors.

Web Interface

Contents