This project combined a handful of smaller project ideas:
- Make a device that monitors and reports the inside temperature at home.
- Learn how to use an ESP8266 chip.
- Put to use (and potentially showcase) a Hackaday 10-year anniversary special-edition Pro-Trinket module that has sat un-used for about 6 years.
- Try out the arduino platform (IDE and bootloader) instead of directly programming a microcontroller.
- Use C++ for a microcontroller project instead of C.
The final system is comprised of the following main components:
- ESP8266 (ESP-01 module) - Acts as a web-server to provide temperature and humidity readings over http/WiFi.
- HDC1080 module - Temperature/Humidity sensor that communicates over I2C.
- SSD1306 OLED module - also communicates over I2C - used as a local display for temperature/humidity readings.
- Pro Trinket 5V (Hackaday 10-Year Anniversary Special-Edition) - Controls the SSD1306 and the HDC1080. Sends temperature/humidity readings over serial to the ESP8266 module.
There are a few additional minor components for level-shifting serial comms and regulating 5V from USB down to 3.3V for the ESP8266 and HDC1080.
I understand it would be possible to create a similar device without a Pro Trinket, utilising more of the ESP8266 capability, but I wanted an excuse to use one of these Hackaday special edition modules.
The ESP8266 serves a pretty HTML page at the index (http://temp0/) which shows the current temperature and humidity readings.
Certain sub-directories of the web-server will provide plain-text values of the temperature or humidity. This is useful for home-automation implementations.
The ESP8266 hostname is set to "temp0", making the useful http addresses as follows:
- For html "pretty" temperature and humidity readings:
- For plain-text temperature value (°C):
- For plain-text humidity value (%):
From a command line, a simple use of "curl" will provide plain-text temperature and humidity values for simple integration into other systems.
$ curl http://temp0/temperature
15.68
$ curl http://temp0/humidity
70.69
Boot animation:
Display modes: