Skip to content

Raspberry Pi Temperature Logging HAT. SHT31-D sensor and ST7735 display.

License

Notifications You must be signed in to change notification settings

BramDriesen/rpi-temperature-logging-hat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rpi-temperature-logging-hat

Raspberry Pi Temperature Logging HAT to measure and display the temperature.

Tiny project to plot the temperature of an Adafruit SHT31-D humidity/temperature sensor on a graph which on it's turn is displayed on an SPI display by Pimoroni (ST7735)

Features:

  • Read sensor values from a Adafruit SHT31-D humidity/temperature sensor
  • Plot a chart with matplotlib and save it as PNG file
  • Display chart on a Pimoroni ST7735 SPI display
  • Write sensor data to a CSV for further processing if needed
  • Button features:
    • Short press: Toggle on/off display
    • Long press (5 sec): Reset chart and wipe CSV

Dependencies and requirements

Updating your RPI

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python3-pip libopenjp2-7 libatlas-base-dev
sudo pip3 install --upgrade setuptools

From Adafruit CircuitPython

Installing required dependencies

# SHT31-D Library
sudo pip3 install adafruit-circuitpython-sht31d

# LCD SPI Library
curl https://get.pimoroni.com/st7735 | bash

# Matplotlib and Numpy 
sudo pip3 install matplotlib
sudo pip3 install numpy --upgrade

Raspi config

sudo raspi-config
  • Interface options
  • Enable SPI

Reboot before usage!

Installation

Clone the project:

git clone [email protected]:BramDriesen/rpi-temperature-logging-hat.git

Copy the default-config file to config.py

cp default-config.py config.py

Edit the configuration file if required to set the log frequency (in seconds)

LOG_FREQUENCY = 10

Usage

To simply run the script execute the script file.

python3 /home/pi/rpi-temperature-logging-hat/script.py

Rsync file to local

rsync -avz [email protected]:rpi-temperature-logging-hat/chart.png ~/Downloads/chart.png

Autostart

Edit your rc.local (or use any other method as described here) file to make the script run at boot. Edit it using the command:

sudo nano /etc/rc.local

Using your cursor keys scroll to the bottom and add the following line right before the exit 0 line:

sudo python3 /home/pi/rpi-temperature-logging-hat/script.py & > /home/pi/rpi-temperature-logging-hat.log

Now reboot your Pi and the script should automatically start.

sudo reboot

About

Raspberry Pi Temperature Logging HAT. SHT31-D sensor and ST7735 display.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages