Monitors temperature and humidity using MicroPython on an ESP8266 and a RHT03 (DHT22) sensor and sends the results to ThingSpeak.
The following circuit diagram shows how I connected the sensor to a NodeMcu ESP8266 development board:
Configure a ThingSpeak channel something like:
Download the urequests HTTP library and create a file called secrets.py:
"""Secret values required to connect to services."""
WIFI_SSID = 'XXXXXX'
WIFI_PASSPHRASE = 'XXXXXX'
THINGSPEAK_API_KEY = 'XXXXXX'
WUNDERGROUND_API_KEY = 'XXXXXX'
and copy with the rest of the python files to the ESP8266.
Run the following script from the REPL to load the wifi network.
# Connect to WiFi router
import network
import secrets
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(secrets.WIFI_SSID, secrets.WIFI_PASSPHRASE)
wlan.ifconfig()
Reboot the ESP8266 to automatically run the program.