GithubHelp home page GithubHelp logo

snapstromegon / fan_control Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 32 KB

SysFS fan control written in Rust, primarily for Raspberry Pis.

License: ISC License

Rust 100.00%
rust-lang rust raspberry-pi raspberry-pi-4 sysfs sysfs-gpio fan-control

fan_control's Introduction

Fan Control

This is a fan control for a Raspberry PI based on the SYSFS interface. It should be compatible with any SYSFS compatible system which exposes the GPIO pins and thermal zones.

Hardware Setup

Raspberry Pi Board Pin Overview

Raspberry Pi 40 Pin GPIO Pinout

I'm using these fan heatsinks for my Pis: Amazon / Reichelt

You connect the red wires from the fans to one of the two red pins from the Pi. The black wire from the fan gets cut in the middle and the part connected to the fan gets soldered to the emitter pin of a transistor and the part leading to the Pi to the collector pin of the transistor. Finally connect the base pin of the transistor to any GPIO pin (I used 23 and grabbed ground from the one next to it) with a resistor in between (I used a 1k Ohm one).

Software Setup

Get Binary

Download Release for your system

I currently publish 64 Bit Arm binarys, since I'm developing this for my Pi 4s.

System Release Binary
Raspberry Pi 64 Bit fan_control

Self Compile

Install Rust (with rustup)
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Download or clone Sourcecode

Download the source from either the release, or the master of this repo.

$ git clone [email protected]:Snapstromegon/fan_control.git
$ cd fan_control
Compile

Inside of the project folder run:

$ cargo build --release

(Resulting binary will be $pwd/target/aarch64-unknown-linux-gnu/release/fan_control)

Copy Binary and Systemd service

Copy the fancontrol bin to /opt/fancontrol and the fan_control.service (example in this repo) to /etc/systemd/system/fan_control.service.

Configure

You can either configure the program via anfironment variables or command line arguments (for both, check fan_control --help).

You can configure:

  • GPIO Pin: The pin which is used to turn the fan on/off
  • Thermometer Path: SysFS path of the thermometer (should result in °C*1000 - so 40000 = 40°C)
  • Fan On Temperature: When should the fan kick in
  • Fan Off Temperature: When should the fan turn off again
  • Log Level: Use the RUST_LOG environment variable to change the log level. The default is "info".

Enable Systemd service

$ systemctl enable --now fan_control

fan_control's People

Contributors

snapstromegon avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.