A simple and lightweight daemon for controlling the cooling system of your Raspberry Pi.
This project was developed as a hands-on exercise to gain familiarity with the C programming language and to explore the setup of a DIY home server.
-
Supported Devices: This daemon is tested and confirmed to run on the Raspberry Pi 4B with Raspberry Pi OS (Debian-based).
-
Compatibility: While the instructions provided are specific to the Raspberry Pi 4B, they are likely applicable to other Raspberry Pi models running a Debian-based distribution.
-
Recommended Cooling System: The project is designed for use with the Ice Tower CPU Cooling Fan.
-
Alternative Cooling Systems: Other cooling systems can be used as long as they connect the fan to GPIO pins via 5V, GND, and TXD. To ensure speed control, the fan should support PWM (Pulse Width Modulation).
To control the fan using PWM, you need to connect the cooling system to the appropriate GPIO pins on the Raspberry Pi. Ensure the following connections are made:
- Red wire: Connect to 5V power (e.g. Pin 4)
- Black wire: Connect to a Ground pin (e.g. Pin 6)
- Blue wire: Connect to the PWM control pin (Pin 12 on physical header / GPIO 18)
-
Install Dependencies
Before installing and using Fan_Control, ensure that the WiringPi library is installed. This library is necessary for controlling the fan via the GPIO pins on your Raspberry Pi. Follow the instructions in the WiringPi Installation Guide.
-
Build Fan_Control from Source
Open a terminal and execute the following commands:
# Install Git sudo apt install git # Clone the repository git clone https://github.com/TarikTornes/fan_control.git cd fan_control # Build the package sudo make
-
Daemonize Fan_Control
To run Fan_Control as a daemon using
systemd
, follow these steps:Open a terminal and execute the following commands:
# Reload systemd manager configuration sudo systemctl daemon-reload # Enable Fan\_Control to start on boot sudo systemctl enable fan_control.service # Start the Fan\_Control service sudo systemctl start fan_control.service # Check the status of the service sudo systemctl status fan_control.service
After building Fan_Control from source, a configuration file should be available at /etc/fan_control.conf.
temp1
andtemp2
are temperature thresholds in Celsius that determine the fan speed of your cooling system.
[General]
temp1 : 30
temp2 : 50
With the above configuration:
- The fan remains OFF when the temperature is at or below 30°C.
- The fan runs at MID speed when the temperature is between 30°C and 50°C.
- The fan operates at FULL speed when the temperature exceeds 50°C.