Code Monkey home page Code Monkey logo

raspberry_fan_controller's Introduction

Raspberry fan controller

Simple python script for control speed of a pwm cooling fan.

Tested with a KDB0605HB laptop cooler on a Raspbery Pi 4, Ubuntu server 19.10 64bit, 20.04 64bit; Raspberry Pi OS

Dependencies:

  • python3 (installed and made default by update-alternatives)
  • package RPi.GPIO
  • package gpiozero

How to use:

I assume you connected to Pi via SSH before (Ubuntu server has it and started it by default). ReferenceLink

  1. Download packages with pip or apt
    • pip: $ pip install RPi.GPIO gpiozero
    • or apt: $ sudo apt-get install python3-rpi.gpio python3-gpiozero
  2. Copy fancontroller.py to user directory (in my case /home/ubuntu)
  3. Create cron job:
    • open crontab: $ sudo crontab -e
    • insert a new line and paste @reboot /path/to/python3 /path/to/fancontroller.py
      • e.g.: "@reboot /usr/bin/python3 /home/ubuntu/fancontroller.py" in my case
    • save and exit
  4. Reboot Pi and script should work after system startup

Note:

I am using Raspberry Pi 4 with KDB0605HB blower fan - whitch is a part of an Asus laptop - as my own DIY project. 300Hz was quite appropriate as PWM output frequency for this cooler, but if you have another type (for example this one), this can be different.

References:

Test result:

Temperature in idle mode fluctuated between 41-43 Celsius under Ubuntu 19.10, therefore PWM.ChangeDutyCycle() got 20% in those loops. Note that Ubuntu server for RPi consumes much resource and heating CPU compared to Raspbery OS.

P. S.

This is my first uploaded project, so execuse me if experience any deficiency on my commit...

raspberry_fan_controller's People

Contributors

tibor8472 avatar

Watchers

James Cloos avatar  avatar

Forkers

roukydesbois

raspberry_fan_controller's Issues

Typo in the code

Hello!

Thanks for your work, it works as a charm on the 2 RPIs I have behind me and it's nice for my ears to not have them blow full speed all the time ;)

I have noticed what I think is a typo in your code: on this line

pwm12.ChangeDutyCycle(0)

shouldn't it be pwm instead of pwm12? I made the change on my side and it fixed my issue.

Cheers!

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.