# Datalogger ESP8266 running Micropython collecting temperature humidity and light level. Pushing data to a Mosquito server. A python script to ingest the data into an influx database. Grafana to display the data. This is a work in progress and is not suitable for production ## Server Setup This assumes you are using Ubuntu-20.04 ### Install packages `wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -` `echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list` `wget -qO- https://repos.influxdata.com/influxdb.key | gpg --dearmor > /etc/apt/trusted.gpg.d/influxdb.gpg` `export DISTRIB_ID=$(lsb_release -si); export DISTRIB_CODENAME=$(lsb_release -sc)` `echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdb.gpg] https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" > /etc/apt/sources.list.d/influxdb.list` `sudo apt update` `sudo apt install python3-pipenv nginx mosquitto grafana influxdb python3-certbot-nginx` ### Setup Nginx ## Esp8266 Setup ### Install tools ```pip3 install esptool adafruit-ampy``` ### Download Esp8266 Firmware https://micropython.org/resources/firmware/esp8266-20210418-v1.15.bin ### Install firmware ```esptool.py --port erase_flash``` ```esptool.py --port --baud 1000000 write_flash --flash_size=4MB -fm dio 0 /esp8266-20210418-v1.15.bin``` ### Edit config file ```cp uP/config.json.sample config.json``` ### Copy libraries, config and code to esp8266 ```ampy -p put uP /```