/yahboom-raspi-cooling-fan

Code and help for the Yahboom Raspberry Pi Cooling Fan with RGB and OLED display

Primary LanguagePython

yahboom-raspi-cooling-fan

Crowd-sourced code for the "Yahboom Raspberry Pi Cooling HAT with Intelligent Temperature Control":

HAT Image

I converted the code to Python 3 and tested it on Raspberry Pi OS 32-bit. Also, users gatuno1 and attenzione tested it successfully on Raspberry Pi OS 64-bit and Ubuntu 64-bit respectively, and his notes are incorporated below.

How to run the Python code

1. Enable I2C

Use, for example, the raspi-config command line tool.

2. Install Python3 Packages

Raspberry Pi OS 32-bit

sudo pip3 install Adafruit_BBIO Adafruit-SSD1306

Raspberry Pi OS 64-bit

sudo pip3 install Adafruit-SSD1306 Pillow

Ubuntu 64-bit

sudo apt install -y python3-smbus python3-pip python3-rpi.gpio i2c-tools libraspberrypi-bin
sudo pip3 install Adafruit-SSD1306 Pillow

3. Run one or more of the Python scripts

For example, if you want the Fan, RGB, and OLED all controlled by temperature and the Pi's stats, then in three separate terminal windows, run:

python3 fan_temp.py
python3 rgb_temp.py
python3 oled.py

Starting a script automatically when booting

This easiest way I've found so far is to add a line to root's crontab with sudo crontab -e:

@reboot /usr/bin/python3 /home/pi/src/yahboom-raspi-cooling-fan/RGB_Cooling_HAT.py

Multiple @reboot lines can be given. E.g., I'm currently running these two so that the lights simply stay default green and aren't changed:

@reboot /usr/bin/python3 /home/pi/src/yahboom-raspi-cooling-fan/fan_temp.py
@reboot /usr/bin/python3 /home/pi/src/yahboom-raspi-cooling-fan/oled.py

See Also