GithubHelp home page GithubHelp logo

serjdud / orangepizero2_pwm_fan_control Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 2.0 164 KB

How to control a PWM fan depending on CPU temperature on a Orange Pi Zero2

License: MIT License

Python 88.57% Shell 11.43%
orangepi-zero2 pwm-fan

orangepizero2_pwm_fan_control's Introduction

Orangepi Zero 2 PWM FAN control

How to control a PWM fan depending on CPU temperature on a Orange Pi Zero 2? You can use one of four built-in PWM. You don't need any libraries, only python.

OrangePi Zero2 fan

TODO: rewrite python script to bash.

Prepare

  1. Install Python 3.7 or higher.
  2. Configure PWM on orangepi zero2. See section 3.20.5 in user manual
sudo nano /boot/orangepiEnv.txt

Add to the end of file pwm12 or pwm34.

overlays=pwm34
  1. Reboot.

Install

  1. Clone repository.
git clone https://github.com/Serjdud/orangepizero2_pwm_fan_control.git
  1. Move to source
./orangepizero2_pwm_fan_control
  1. Make sh script executable
sudo chmod +x ./fan_control.sh

Running

Run fan_control.sh with first argument = PWN nubmer. Wich PWM number you use depends on PWM pin. See picture above.

sudo ./fan_control.sh 3

To see other possible arguments run with -h argument

./fan_control.sh -h

Autolaunch on system startup

  1. Move to source (for example orangepizero2_pwm_fan_control installed to orangepi user's home directory)
cd ~/orangepizero2_pwm_fan_control
  1. Get full path to fan_control.sh
pwd

/home/orangepi/orangepizero2_pwm_fan_control

  1. Copy the full path to the parameter ExecStart in fan_control.service and add PWM number argument.
sudo nano ./fan_control.service
ExecStart = /home/orangepi/orangepizero2_pwm_fan_control/fan_control.sh 3
  1. Copy fan_control.service to daemon service folder (usually /etc/systemd/system/).
sudo cp ./fan_control.service /etc/systemd/system/
  1. Reload systemd config
sudo systemctl daemon-reload
  1. Enable service autolaunch on system startup
sudo systemctl enable fan_control.service
  1. Start service end check
sudo systemctl start fan_control.service
systemctl status fan_control.service

orangepizero2_pwm_fan_control's People

Contributors

serjdud avatar

Stargazers

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