GithubHelp home page GithubHelp logo

wacrex / py-rpi_pwm_controller Goto Github PK

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

A PWM Controller with fan profiles written in Python 3 for the Raspberry Pi 4 Case Fan.

License: Other

Python 68.17% Shell 31.83%
raspberry-pi raspberry-pi-4 python3 pwm pwm-fan pwm-controller fan-control shell-script python-script json

py-rpi_pwm_controller's Introduction

CodeFactor DeepSource

Py-RPi_PWM Controller

#f03c15 WARNING! This is an early development release, any use of this script is at your own risk! #f03c15


The project originally started off as a custom script for the NESPi-4 Fan Control PCB, but was later changed to be used with the official Raspberry Pi 4 Case Fan instead.

The script will not only turn the fan on/off, but also adjust the fan speed according to the temperature using a fan profile.

Installation

  1. Go to the Getting started section on the official website and follow the first 5 steps except for the 4:th step where you should instead connect the cables like this:

    Fan Pinout

  2. Next install the fan controller python script:

    wget -qO- https://raw.githubusercontent.com/WaCrex/Py-RPi_PWM_Controller/master/install.sh | sudo bash -

Fan Profiles

The script comes with 3 fan profiles: silent, linear & cool. With linear being the default preset.

Fan Profiles

Configuration

The python script is by default looking for a json-file with the same name as the python script, by default this should be fan_ctrl.json.

/opt/fan_ctrl/fan_ctrl.json:

{
    "profile": "linear",
    "gpio_pin": 18,
    "pwm_freq": 100,
    "profiles": {
        "silent": [
            40, 40, 41, 41, 42, 42, 43, 44,
            45, 46, 47, 49, 51, 53, 55, 57,
            59, 61, 63, 65, 67, 70, 73, 76,
            79, 82, 86, 89, 93, 96, 100],
        "linear": [
            40, 42, 44, 46, 48, 50, 52, 54,
            56, 58, 60, 62, 64, 66, 68, 70,
            72, 74, 76, 78, 80, 82, 84, 86,
            88, 90, 92, 94, 96, 98, 100],
        "cool": [
            40, 44, 47, 51, 54, 58, 61, 64,
            67, 70, 73, 75, 77, 79, 81, 83,
            85, 87, 89, 91, 93, 94, 95, 96,
            97, 98, 98, 99, 99, 100, 100]
    }
}
Option Default Description
profile linear The name of the profile currently in use (must be listed under profiles).
gpio_pin 18 The GPIO Pin that the fan's PWM cable is connected to.
pwm_freq 100 The frequency of the PWM signal.
profiles A dictionary of fan profiles, with Duty Cycle values (%) for the temperatures 50-80°C. The values must be between 0-100% and decimals aren't allowed.

py-rpi_pwm_controller's People

Contributors

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