Skip to content

Daemon controlling cooling system for Raspberry Pi 4B on Debian System

License

Notifications You must be signed in to change notification settings

TarikTornes/fan_control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fan_Control (0.3.2)

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.

Pre-Requisites

Hardware & Operating System

  • 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.

Cooling System

  • 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).

GPIO-Pin Setup

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)

Wiring Diagram GPIO Pinout

Installation

Building Fan_Control from Source (Raspbian)

  1. 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.

  2. 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
  3. 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

Configuration

After building Fan_Control from source, a configuration file should be available at /etc/fan_control.conf.

Configuration options

  • temp1 and temp2 are temperature thresholds in Celsius that determine the fan speed of your cooling system.

Example configuration

[General]
temp1 : 30
temp2 : 50

How it works

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.

About

Daemon controlling cooling system for Raspberry Pi 4B on Debian System

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published