Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chrisb2/environment
Monitor temperature and humidity (DHT22) using MicroPython on an ESP8266 and send the results to ThingSpeak.
https://github.com/chrisb2/environment
dht22 esp8266 micropython thingspeak wunderground-api
Last synced: 29 days ago
JSON representation
Monitor temperature and humidity (DHT22) using MicroPython on an ESP8266 and send the results to ThingSpeak.
- Host: GitHub
- URL: https://github.com/chrisb2/environment
- Owner: chrisb2
- License: mit
- Created: 2017-10-22T03:11:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-09T08:15:47.000Z (about 7 years ago)
- Last Synced: 2024-11-07T21:47:38.576Z (3 months ago)
- Topics: dht22, esp8266, micropython, thingspeak, wunderground-api
- Language: Python
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Environment Monitor
Monitors temperature and humidity using [MicroPython](http://micropython.org/)
on an [ESP8266](https://en.wikipedia.org/wiki/ESP8266) and a [RHT03 (DHT22)](https://cdn.sparkfun.com/datasheets/Sensors/Weather/RHT03.pdf)
sensor and sends the results to [ThingSpeak](https://thingspeak.com).## Circuit
The following circuit diagram shows how I connected the sensor to a NodeMcu ESP8266 development board:
![Circuit diagram](https://github.com/chrisb2/environment/raw/master/environment-circuit.png "Circuit Diagram")
## Usage
Configure a ThingSpeak channel something like:
![ThingSpeak channel](https://github.com/chrisb2/environment/raw/master/thingspeak-channel-settings.png "ThingSpeak Channel Settings")
Download the [urequests](https://raw.githubusercontent.com/micropython/micropython-lib/master/urequests/urequests.py) HTTP library and create a file called _secrets.py_:
```python
"""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.
```python
# Connect to WiFi router
import network
import secretswlan = 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.