This is a project for lightweight temperature tracking. It includes code for micropython (https://micropython.org/) which reads temperature and humidity from a DHT11 sensor every 10min and transmits it to the server which renders the measurements in two plotly plots. The microcontroller code is tailored towards ESP-8266 where the device goes into deep sleep between measurements.
TODO
- Create a virtual python environment, e.g.
mkvirtualenv --python=/usr/bin/python3 esp
- Download ESP-8266 micropython firmware from https://micropython.org/download/esp8266/
- Install
esptool
pip install esptool
- Flash microtpython onto ESP-8266 (you will most probably have to run it as sudo)
In my case,
esptool.py --port <esp port> --baud 460800 write_flash --flash_size=detect 0 <micropython firmware>
<esp port>
is/dev/ttyUSB0
- Install
adafruit-ampy
(https://pythonforundergradengineers.com/upload-py-files-to-esp8266-running-micropython.html)pip install adafruit-ampy
- Adapt
esp/config_base.json
and save it asesp/config.json
- Set your wifi credentials (I use a guest access on my router for my sensors)
- Define a location name which will be displayed on the temperature graph
- Define your server route -- see description below
- Upload files to ESP-8266 (again, you will most probably have to run it as sudo)
ampy --port <esp port> --baud 115200 put boot.py ampy --port <esp port> --baud 115200 put main.py ampy --port <esp port> --baud 115200 put config.json
TODO