Yet Another Web-Enabled Weather Sensor Publishing To MQTT
This is ESP-8266 code that reads temp and humidity readings every minute from a DHT11, updates a small SSD-1306-based display, and publishes readings to MQTT topics. The hardware should cost <$15 and wiring it up should take <15 minutes.
Demo Video
All this should cost <$15
- ESP8266 microcontroller, like a Wemos D1 Mini
- DHT11 temp/humidity sensor, like the Wemos shield
- SSD1036 OLED display, like a Wemos OLED Shield
- Wifi connection
- platformio
- The following libs:
Adafruit DHT Unified_ID18
DHT sensor library_ID19
Adafruit Unified Sensor_ID31
Adafruit GFX Library_ID13
Adafruit SSD1306_135
PubSubClient_ID89
These libraries are loaded automatically by platformio upon lib_deps
dependencies. No need for manual install.
If you use atom.io yoou should open this project with the platformio IDE to get these libraries into the list of installed libraries.
- Create an account on devicehub.net
- Create a project, device, and 2 analog 'sensors' (
temp
andhumidity
) - Jot down your API key, project ID, device UUID, and sensor names
- Change
config.h
to match your Wifi and MQTT settings