datalogger/README.md

59 lines
1.6 KiB
Markdown
Raw Permalink Normal View History

# Datalogger
2021-02-16 09:34:03 +00:00
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.
2021-05-29 09:03:10 +00:00
This is a work in progress and is not suitable for production
2021-05-29 08:56:41 +00:00
## Server Setup
This assumes you are using Ubuntu-20.04
### Install packages
`sudo su -`
2021-05-29 08:56:41 +00:00
`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-pip nginx mosquitto grafana influxdb python3-certbot-nginx`
`pip3 install pipenv`
2021-05-29 08:56:41 +00:00
### Setup Nginx
## Esp8266 Setup
### Install tools
```pip3 install esptool adafruit-ampy```
2021-05-29 08:56:41 +00:00
### Download Esp8266 Firmware
https://micropython.org/resources/firmware/esp8266-20210418-v1.15.bin
### Install firmware
```esptool.py --port <port> erase_flash```
```esptool.py --port <port> --baud 1000000 write_flash --flash_size=4MB -fm dio 0 <download_folder>/esp8266-20210418-v1.15.bin```
### Edit config file
```cp uP/config.json.sample config.json```
### Copy libraries, config and code to esp8266
2021-05-29 08:56:41 +00:00
```ampy -p <port> put uP /```