Git Product home page Git Product logo

raspi_scripts's Introduction

Useful scripts for raspberry pi.

fan.py

Use GPIO.13 (BCM) for fan control. Run when CPU temp is above 45°C and stop when below 40°C. The current of raspberry pi pins is not enough for powering the fan so a triode is used to amplify the current.

shutdown.py

Use GPIO.19 for shutdown & reboot button, use GPIO.26 for LED indicator. Press the button and the script will countdown from 10 before reboot. Press again to switch between reboot/shutdown/cancel mode.

Mode LED
reboot blink
shutdown on
cancel off

example

Run

Add execute permission

chmod 775 fan.py

Run at background

nohup ./fan.py &

Terminate

Find the PID of the process

ps auxf | grep fan.py

End the process

kill PID

Run at startup

Open the rc.local file

sudo nano /etc/rc.local

Add the following two lines:

python /home/pi/scripts/shutdown.py &
python /home/pi/scripts/fan.py &

Save and exit.

References

https://shumeipai.nxez.com/2017/07/13/raspberry-pi-to-achieve-temperature-monitoring-and-control-fan-cooling.html https://shumeipai.nxez.com/2014/09/01/add-raspberry-pi-sent-to-reboot-off-button.html

raspi_scripts's People

Contributors

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