Giter VIP home page Giter VIP logo

libreelec_pwm_fan's Introduction


LibreELEC PWM Fan

Downloads Contributors Issues License

Table Of Contents

About The Project

I was looking to cool my Raspberry Pi which was running LibreELEC. The Raspberry Pi case was equipped with a 5V fan. It was running all the time on full speed when mounted to the 5V pin. It was too loud.

With this open-source project I wanted to:

  • Cool the Raspberry Pi only if it is running warm.
  • Adapt the fan speed, so that the noise is reduced.
  • Play around with transistors.
  • Enable program running on LibreELEC.

Built With

Getting Started

The available 5V fan has active power of up to 1W. However, the GPIO pins can only deliver 3.3V with a maximum of 1mA each. With a NPN transistor it is possible to control the 5V circuit with a low current from a GPIO pin providing voltage of 3.3V. To control the fan speed, Pulse-width modultion (PWM) is used (available on GPIO 12), with which the average power delivered to the 3.3V circuit can be controlled.

Prerequisites

Hardware Setup

NPN-Transistor: 2N3904

  1. Emitter connected to GND.
  2. Base connected to GPIO 12 (PWM0) with a 1kOhm resistor in between.
  3. Collector connected to fan and fan connected to 5V.
  4. Pull-Down 10kOhm resistor between GND and GPIO 12
  5. Diode between Collector and 5V (optional to protect transistor from fan)

Software Setup

Install on LibreELEC the 'Raspberry Pi Tools' addon
Addons --> install from repository --> LibreELEC Add-ons --> Program Addons --> Raspberry PiTools

Test

Run python program 'calibrate.py' to change speed via SSH for testing before setting lowest speed in the script.

Installation

  1. save the file 'PWM_fan.py' on your RaspberryPi to
/storage/.kodi/userdata/PWM_fan/PWM_fan.py
  1. and change permission of the PWM_fan.py file with chmod 777
  2. save the file 'PWM_fan.service' on your RaspberryPi to
/storage/.config/system.d/PWM_fan.service
  1. enable the service with
systemctl enable PWM_fan
  1. start the service with
systemctl start PWM_fan
  1. check if the service is working with
systemctl status PWM_fan.service

Usage

  1. Start the program as service after each start.
  2. The CPU temperature is read.
  3. Calculate desired fan speed.
  4. Update new fan speed with desired speed.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  • If you have suggestions for adding or removing projects, feel free to open an issue to discuss it, or directly create a pull request after you edit the README.md file with necessary changes.
  • Please make sure you check your spelling and grammar.
  • Create individual PR for each suggestion.

Creating A Pull Request

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Authors

Acknowledgements

libreelec_pwm_fan's People

Contributors

franzat avatar

Stargazers

 avatar

Watchers

 avatar

libreelec_pwm_fan's Issues

Change File vor PC 4 Pin Fan

Hello, what should I change in the file PWM_fan.PY? When I use a PC fan and the control signal has to work the other way around. 100% PWM is 0 speed and 0% PWM would be max speed. An attempt to change this was unfortunately unsuccessful.

Wrong parameter

Hi,
just installed your script. There is an error in line 49 in file PWM_fan.py
It needs to be GPIO.setmode(GPIO.BCM) in order to utilize GPIO12. If BOARD is used, it tries to use Pin 12 which is not the same and won't work.
Also the PWM frequency is pretty low, you should prefer something higher about 20kHz when controlling fans.
The rest of the script seems to work fine, well done.

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.