Git Product home page Git Product logo

rpi-fan-control's Introduction

RPi-Fan-Control

Another Raspberry pi fan control daemon (made for a retropie box)

This is a very simple (no dependency, working with systemd) fan controller daemon for a raspberry pi

  • download the source
  • run make to build the daemon
  • edit fan.service file to locate the daemon and setup parameters (see below for parameter details)
  • copy fan.service to systemd files: sudo cp fan.service /lib/systemd/system/
  • and activate it: sudo systemctl enable fan.service

The fan is controlled with a mosfet from any GPIO pin (GPIO17 for me, it was easier to solder). It will start when pi temperature reach a maximum threshold value, and turned off when the temperature decreases below another threshold.

Schematic

myimage-alt-tag

Very simple! the 10k resistor is limiting the current from the GPIO pin, the 200k is a pull down resistor, to turned the mosfet off when the gate is disconnected from GPIO. Those 2 resistors make a voltage divider, so be careful when choosing their values as the voltage on the mosfet gate will be 3.3v * R2 / (R1 + R2), which has to be greater than mosfet gate threshold voltage (Vgss). You can also omit the current limiting resistor (R1/10k), as I did, but do it only if you really know what you're doing!

Any n-channel mosfet should work, as long as Vgss is below 3.3v * R2 / (R1 + R2) and the maximum drain current is greater than the current running through the fan. In my case I have 5V/140mA Fan and use a 2N7000 mosfet (Id = 200mA).

Systemd configuration

You need to edit 'fan.service' in order to setup the GPIO pin used to control the fan and the temperatures threshold values. Those parameters are the argument passed to the daemon when systemd launches it:

[Unit]
Description=Fan daemon

[Service]
Type=simple
ExecStart=/home/pi/fan/fan --daemon 17 53 56
Restart=always

[Install]
WantedBy=multi-user.target

What you need to change here is this line :

ExecStart=/home/pi/fan/fan --daemon 17 53 56

First, change the path to match the directory where the fan program is. The first argument (--daemon) is used to make the program run an endless loop (a daemon), the second argument (17) is the GPIO pin, 53(°C) is the min threshold temperature and 56(°C) is the max threshold temperature.

rpi-fan-control's People

Contributors

pilochambert avatar

Stargazers

 avatar

Watchers

 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.