Link-AM / omv-x735-fan

Raspberry Pi Fan Controller: A Python script and accompanying service to control the speed of a fan connected to a Raspberry Pi based on the core temperature. Designed for use with the x735 board and OpenMediaVault, but adaptable for other setups.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

omv-x735-fan Control Script

This project contains a few small scripts intended to control a PWM fan connected to a Raspberry Pi based on the core temperature of the Pi. I originally made it as a better solution to control my x735 board PWM fan on a raspberry pi 4 with OpenMediaVault installed, because the software provided by the x735 manufacturer was deprecated and I was not happy with the fan speed settings.

๐Ÿ“ Files

install.sh

This shell script installs omv-x735-fan files. It installs the python script to /usr/local/bin/, makes it executable, and sets it up to run as a service via the other shell script.

omv-x735-fan.py

This is the main Python script that controls the fan. It continuously checks the core temperature and adjusts the speed of the fan accordingly.

omv-x735-fan.sh

This shell script is used to start and stop the omv-x735-fan.py script as a service. It provides the following commands:

  • start: Starts the omv-x735-fan.py script in the background.
  • stop: Stops the omv-x735-fan.py script by killing the process.

This script is designed to be placed in /etc/init.d/ and run at startup.

๐Ÿ“‹ Requirements

  1. Python
  2. RPi.GPIO and gpiozero Python libraries
  3. Raspberry Pi with a fan connected to a GPIO pin

๐Ÿ› ๏ธ Installation

To install the service, navigate to the project directory and then run the install.sh script with superuser privileges:

sudo ./install.sh

This will copy the necessary files to their appropriate locations and tell the service to start on boot. It will also start the service immediately without needing to reboot.

To stop the service, use the following command:

sudo /etc/init.d/omv-x735-fan.sh stop

If you want to manually start the service after it has been stopped, you can do so with the following command:

sudo /etc/init.d/omv-x735-fan.sh start

๐Ÿž Debugging

The Python script includes a DEBUG_LOGGING constant that can be set to True to enable debug logging. When debug logging is enabled, the script prints the core temperature and the fan speed each time they are checked or changed.

About

Raspberry Pi Fan Controller: A Python script and accompanying service to control the speed of a fan connected to a Raspberry Pi based on the core temperature. Designed for use with the x735 board and OpenMediaVault, but adaptable for other setups.

License:MIT License


Languages

Language:Python 73.2%Language:Shell 26.8%