Following the Official Website's Python Installation instructions, I got as far as getting the RGB and Fan working on my RaspberryPi 4B. But I couldn't figure out how to get the OLED working, with just the official instructions.
I did a little digging and found dogweather/yahboom-raspi-cooling-fan but I still couldn't get the OLED to work, so I did some research and made the necessary adjustments to get things working on 64-bit Raspbian OS.
I've adjusted the formatting to my liking and created a function in the script so that it can detect and show, in addition to the IP address, whether or not there's an active network adapter (and what that is) on the OLED display.
Here's how I did it (and hopefully it'll help you too).
Instructions tested with a fresh RaspberryPi 4B with Raspbian OS 64-bit.
1. Enable I2C
sudo raspi-config
and enable I2C.
You may also enable VNC at this time if that is something you're more comfortable with (i.e. use VNC to remote into the device and use Chromium to download files onto the device).
2. Install Python3 Packages
sudo pip3 install adafruit-circuitpython-ssd1306 --break-system-packages
*The system will prompt you to tell you that --break-system-packages
is bad. I don't know a better way to do this so, proceed!
3. Download Scripts to Device and Extract
Download 'RGB_Cooling_Hat_x64.zip' from my Releases and extract to the destination directory of your choice.
wget https://github.com/dotzeno/yahboom-raspi-cooling-fan/releases/download/latest/RGB_Cooling_HAT_x64.zip
unzip -o RGB_Cooling_HAT_x64.zip -d ./
4. Run one or more of the Python scripts
EXAMPLE 1:
If I want the Fan and RGB functions to be controlled by the device's temperature stats as well as the OLED functions enabled, then in three separate terminal windows, run:
python fan_temp.py
python rgb_temp.py
python oled.py
EXAMPLE 2:
If I want to use the AIO script (Fan is temp controlled on/off, RGB is on a cycle and OLED functions enabled), then in one terminal window, run:
python RGB_Cooling_HAT.py
EXAMPLE 3:
If I want to use my custom AIO script (Fan is temp controlled and OLED functions enabled, RGB Off), then in one terminal window, run:
python custom.py
The easiest way to do this is to sudo crontab -e
, pick a text editor you're familiar with and then add the following line to crontab:
@reboot /usr/bin/python3 /home/pi/RGB_Cooling_HAT_x64/RGB_Cooling_HAT.py
If you want to do like dogweather (run two scripts on boot for controlling the fan and OLED; no script to control RGB - RGB will default to ON and GREEN), you can also use Multiple @reboot
lines, like so (add the following lines to crontab):
@reboot /usr/bin/python3 /home/pi/RGB_Cooling_HAT_x64/fan_temp.py
@reboot /usr/bin/python3 /home/pi/RGB_Cooling_HAT_x64/oled.py
You may need to adjust the target destination to wherever you extracted RGB_Cooling_Hat_x64.zip and the target script you want to run.
- The Official raspi-config Documentation
- dogweather's yahboom-raspi-cooling-fan github repository
- YahboomTechnology RGB_Cooling_Hat Official Website
- YahboomTechnology's Raspberry-Pi-RGB-Cooling-HAT github respository
- Adafruit PiOLED - 128x32 Mini OLED for Raspberry Pi Usage Documentation
- Shell scripts for system monitoring
- How can I find active network interface from userland?