- ESP8266 microcontroller board is used to
- take temperature and humidity measurements using a DHT22 sensor, using DHT library,
- send measurements as MQTT topics (EspTopicTemp and EspTopicHumi) to a MQTT broker,
- display measurements on an OLED display, using SSD1306Wire library,
- display wifi ok, MQTT ok and sensor ok indicators.
Using version 1.6.12.
- Add the following 3rd party board manager under "File -> Preferences -> Additional Boards Manager URLs": http://arduino.esp8266.com/stable/package_esp8266com_index.json
- Open the "Tools -> Board -> Board Manager" and click install for the ESP8266"
- Select your ESP8266 in "Tools -> Board"
- Board: NodeMCU 0.9 (ESPP-12 Module)
- CPU Frequency: 80 MHz
- Flash Size: 4M (3M SPIFFS)
- Upload Speed: 115200
- Programmer: Arduino as ISP
Update connection.h with SSID and password of your wifi access point.
Update connection.h with MQTT broker hostname of IP address.
MQTT topics are sent to via an MQTT broker to MQTT clients that subscribe to the topic. For the broker I used an Onion and installed mosquitto. i The MQTT client, MQTT Dash, an Android app, is used to display the measurements in real time on a smart phone. Set up your app with the hostname of the broker. Once connected to the broker, create a value object using the topic name (I used EspTopicTemp for the temperature topic).