Raspberry Pi Soft Power Controller

AVR based power controller to power on and shut down a Raspberry Pi (properly.)

Similar projects worth following
The total circuit includes an AVR microcontroller, a near-zero current LDO, and a switching (buck) supply. My current design draws about 350nA when Vin is 9V. The AVR controls power to the Raspberry Pi. Two GPIO pins are used. One for the AVR to initiate a shutdown and one for Raspberry Pi to tell AVR after filesystem has been unmounted.

The Raspberry Pi files here, are duplicates from the Raspberry Pi Soft Power Controller GitHub repository. I don't expect many changes at this point, but the latest will be there. I'm still actively modifying the AVR code, so I am not ready to post a copy of that here.


State diagram for power controller

Portable Network Graphics (PNG) - 89.29 kB - 06/11/2017 at 21:43



Puts a Raspberry Pi GPIO Pin LOW. (Intended to be used with a systemd service during shutdown.)

C Source File - 1.03 kB - 06/10/2017 at 18:39



systemd service to call c-start (boot) and c-stop (shutdown).

service - 479.00 bytes - 06/10/2017 at 18:39



Puts a Raspberry Pi GPIO Pin HIGH. (Intended to be used with a systemd service during startup.)

C Source File - 1.03 kB - 06/10/2017 at 18:39



systemd service to call c-watch during boot.

service - 457.00 bytes - 06/10/2017 at 18:39


View all 6 files

  • Adapting Raspbian to run scripts at startup/shutdown

    baldengineer06/30/2017 at 06:44 0 comments

    I've written up detailed instructions on how to create Startup and Shutdown scripts for Raspbian. Turns out Jessie doesn't use SysV for it's init scripts. Which is the system every tutorial I found is based on. After reading through some documentation on systemd, the new init system(?) used, I'm on to something.

    I have a service that runs a C-Program, written with wiringPi, to put a Pi GPIO pin high at startup. And then at shutdown it brings the signal low. Additionally I created a second service and utility that monitors another GPIO pin for a signal from the power controller. This allows the power controller to initiate a shutdown and know when the filesystem is re-mounted as read-only!

    Full write-up is on my blog.

  • New State Machine

    baldengineer06/10/2017 at 06:27 0 comments

    While trying to documentation the first version's state machine, I realized it was too complicated. So while I intended to re-factor it, I ended up re-writing the entire machine. Now it is much simpler.

    Also, I now understand that "Jessie" on the raspberry Pi uses systemd for init. Not SysinitV like most other Linux (or wheezy). So in the raspberry Pi directory of the GitHub repository, I have a functional systemd script. Finally.

  • Circuit overview

    baldengineer05/03/2017 at 23:21 0 comments

    On my blog, I've posted a full description of the circuit. Next I'll write-up the state machine in the AVR. Lastly, the bit of code needed on the Raspberry Pi.

    There are still bugs to work out, which I'll post updates to the project here.

    Here's the circuit overview for the raspberry pi soft power controller.

View all 3 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates