Giter Site home page Giter Site logo

ecom-engineering / raspberry-shutdown-deprecated Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 318 KB

Raspberry-Pi Python3 script for secure shutdown with external switch

License: MIT License

Python 100.00%
python-script raspberry-pi shutdown button-switch sd-card switch ready-signal linux-boot raspberry

raspberry-shutdown-deprecated's Introduction

Project DEPRECATED - will be replaced for new raspberry OS (Debian 11 +)

The s_shut project describes a very simple system in order to shut down Raspberry Pi safely. It consists of a Python 3.x script s_shut.py, a simple schematic and this description.
This project is tested in Raspberry models 3, 3B, 4B, zero-wh under raspbian V10 and above.
The python script uses the awesome libgpio library

Background

A running Linux computer should not be powered off without a controlled shutdown by the operating system, because this can result in damaging the file system on the SD_Card. Controlled power down is especially critical to achieve in so called headless systems with no monitor and keyboard. Raspberry computers do not provide a reset or power down switch. The presented solution allows initiating shutdown or a restart with a switch or an external signal. It also provides a hardware signal (e.g. LED) indicating the running operating system state.

Functionality

Power up
After Linux boot, a selectable port (default BCM21) is driven high and LED goes ON

Switch pressed > 2 seconds
Linux command 'shutdown -P now' will be executed by the script s_shut.py . As soon as critical storage operations are completed, LED goes OFF.

Switch double clicked
System shuts down and restarts.
Linux command 'shutdown -r now' will be executed by the script s_shut.py.

Switch pressed > 6 seconds [optional]
System shuts down and activates a selectable port until no more SD card access occur. This signal may be used in order to completely power down Raspberry by switching off the external power supply .

Restart after shut down
This is only achievable by external power off and on again. (A much more convenient solution is using the "UPS-2" project, that will follow here in the first Quarter 2021)

Project Components

  • The python script s_shut.py
  • A push button switch
  • A high efficiency LED
  • 1 or 2 resistors

More information

See user-guide.md

Written with StackEdit.

raspberry-shutdown-deprecated's People

Contributors

ecom-engineering 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.