construction building skyscraper
Sipmle system displaying data in Grafana using a Raspberry Pi to get sensor data.
Using Grafana this project creates graphics from a binch of sensors.
I use it to monitor my heating systems. (Woodpellet burning system and solar panels.)The systems uses a raspberry pi to get the one-wire sensor data. The data is send to an influxdb and prcessed by Grafana.
The most simple installation uses a raspberry pi 3b and no display.
A Python script is fired from crontab every minute. It collects the data and sends it to an influxdb on another server to prevent massive write actions on the Pi's memory card.
I also made a version with a Adafruit PiTFT display.
This helps to install all sensors and and adds a nice way of quickly reading all temperatures.
Install raspbian. Tested on a Raspberry Pi 3 Model B Rev 1.2 Raspbian with version Raspbian GNU/Linux 10 (buster).
You wil need to install pip3 and some modules:
Use raspi-config to enable the one-wire interface.
At the file /boot/config.txt I appended:
The crontab entry for sending data to the influxdb:
* * * * * root python /fs01/sensor_data_logger.py
To get all sensord uid's run this script:
For adding the PiTFT I added some more Python3 modules:
The PiTFT lcd display is added normally as a hat. The one wire connection is made to the extension connector on the PiTFT.
Just follow the Adafruit guide to get the display running: https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/easy-install-2
I use the setting to duplicate the HDMI screen, but then set the Pi to boot into the text console.
This can be done using raspi-config, and when you are there, als enable the one-wire interface!
In addition to the sensor_data_logger.py we now need another script to get data on the display.
This could be integrated into one script, but keeping yhem separate allows for running the datalogger on the systes clock evrey minute not matter what is being displayed or touched on the lcd.
I use the following script and made it into a systemd service so the display starts at system boot.
The script grabs the touch input, so your mouse and is not working on the hdmi display as long as the scripts runs.
Hence the for a embedded device not so common exit button in the upper right on the lcd.
I am not a Python programmer. Normally I would have used an Atmel AVR chip and coded some C. Making the whole thing interrupt driven so touches are working smooth and timing is always correct.
This piece of code gives massive room for improvement... But is does the job for the moment.
[Unit] Description=Simplified simple emon service After=syslog.target
[Service] Type=simple WorkingDirectory=/fs01 ExecStart=/fs01/sysdtest.py StandardOutput=tty StandardError=tty TTYPath=/dev/tty11 [Install] WantedBy=multi-user.target
and enable this service.
(systemctl daemon-reload, systemctl enable emon.service)
now reboot the pi and after a short while the display shoud start showning the program.
You can download an image file for Raspberry Pi 3B with PiTFT on this site. (1.6GB).
Using Rufus or something similar, write this image to an sd card and you are good to go.