Just a simple temperature monitor.
- β‘ 128x64 OLED display over I2C to display environment data and IP address.
- π‘ DHT22 temperature sensor to get environment data.
- π Grafana + InfluxDB to log and graph data (π πππ).
- π³ Also, it uses docker π.
| Pi Pin | Device | Device Pin |
|---|---|---|
| 1 (3V3) | SSD1306 | VCC |
| 3 (GPIO 2 - SDA) | SSD1306 | SDA |
| 5 (GPIO 5 - SCL) | SSD1306 | SCL |
| 6 (GND) | SSD1306 | GND |
| 7 (GPIO 4 - GPCLK0) | DHT22 | OUT |
| 17 (3v3) | DHT22 | VCC |
| 9 (GND) | DHT22 | GND |
Setup locales, update default passwords, run updates and such. You know, the general setting up a new Pi stuff.
- Enable I2C and SPI in the "Interfacing" menu of
raspi-config. - Reboot.
You can install docker and run containers wherever you want, on the Pi, or another host. The code assumes localhost be default for the InfluxDB connection.
Installing docker on a Pi running Rasbpian is easy:
curl -fsSL https://get.docker.io | sudo bash
sudo apt install -y docker-compose # the install script does not include compose :(
sudo usermod -aG docker pi # should take affect after a re-loginInstall dependencies
sudo apt install -y python3-pip libopenjp2-7 libtiff5
sudo pip3 install --no-cache-dir rpi.gpio influxdb adafruit-circuitpython-ssd1306 Pillow Adafruit_DHT python-dotenvDownload the repo
sudo apt install -y git
git clone https://github.com/bmiddha/oven-tempCopy the systemd service. The service assumes that the repo is cloned in /home/pi, change the service file if repo is located in another location.
sudo cp oven-temp.service /etc/systemd/system # in the oven-temp dirStart the Grafana and InfluxDB services
docker-compose up -d # in the oven-temp dirStart and enable service
sudo systemd enable --now oven-temp.service-
Open a browser to
http://RASPBERRY_PI_IP:3000/to access Grafana. Default credentials are admin, admin. -
Add a new datasource for InfluxDB with the host as
http://influxdb:8086, access as "Server" and the database, username, password details based on configuration. Might be worthwhile adding a read-only user for Grafana using theINFLUXDB_READ_USER, andINFLUXDB_READ_USER_PASSWORDenvironment variables. -
Now you can make cool graphs! πππ


