Power switch board


9 posts
by Pihkal » Wed Jul 04, 2012 9:19 pm
Hi all,

i'm trying to design a board to switch the power to the rpi on and off.
It will support a regelar push button,infrared receiver (for power on/off and lirc once booted) and shutdown by software signal.
There are 2 questions i have:

1. how do the gpio ports behave during post and boot?

2. how can i detect if the os is almost ready with powering down? (to send the poweroff signal via one of the gpio pins)

I'm still waiting for my pi to be delivered so i can't measure the pins myself.
Thanks in advance.
Posts: 52
Joined: Sun Sep 04, 2011 9:50 am
by Mortimer » Wed Jul 04, 2012 10:30 pm
If I was going to do something like this:

I would have as relay or solid state device which provides power when a logic signal is high.

This logic signal will be OR'd from two signals. One would be a time delay, which is started by an ON push button. The time delay will keep the soft switch closed long enough for the RPi to boot, and a script to send a signal out on a GPIO line to keep the soft switch closed when the time delay runs out.

Thus if the RPi fails to boot completely the power will shut off automatically.

On power down the RPi will run a shutdown script the removes the GPIO signal. The signal will be held for a short delay, and then the power switch will open cutting the power. The delay will be set long enough to allow a normal shutdown sequence to reach the system halted state.

For more sophistication you might make the GPIO signal only momentary, to reset the power on delay timer, say for 1 minute, and have a watch dog script that runs on some sort of interrupt timer, which is less than 1 minute. If the RPi hangs for some reason, the watchdog timer won't reset the delay and the power will be cut.
User avatar
Posts: 711
Joined: Sun Jun 10, 2012 3:57 pm
by Pihkal » Thu Jul 05, 2012 9:47 pm
Sound like a nice project.
How far are you in the design?
Are you planning on using a µC or discrete logic?
Posts: 52
Joined: Sun Sep 04, 2011 9:50 am
by Mortimer » Thu Jul 05, 2012 10:46 pm
Not started yet, just my tentative thoughts so far.
User avatar
Posts: 711
Joined: Sun Jun 10, 2012 3:57 pm
by MasterOfSmoke » Wed Jul 18, 2012 10:52 pm
Would a pic16f chip be an overkill for the controller?
I'd love getting away with some sort of cheap-o Wake-on-lan feature too :mrgreen:
Posts: 1
Joined: Wed Jul 18, 2012 10:41 pm
by Pihkal » Thu Jul 19, 2012 5:43 am
I was thinking about using a pic16f648A myself so i wouldn't call it overkill.
I just call it extra headroom for future extensions.

Greetz
Posts: 52
Joined: Sun Sep 04, 2011 9:50 am
by Pi-Scan » Mon Nov 19, 2012 8:01 pm
I was accually wondering if this could be done with a 555 timer.

There is a circuit for "on/off pushbutton" and a circuit for a "delay off".

I haven't been able to figure out how to combine the two however... Any help is apreciated!
Posts: 25
Joined: Fri Jul 06, 2012 9:16 pm
by BrokenFrog » Mon Nov 19, 2012 9:31 pm
CJE Micros have an on-off switch/reset switch in development for the Pi. It's not on their website yet, but I believe Eben posted a picture of it on Twitter after it was demoed at the London RISC OS show last month.
User avatar
Posts: 22
Joined: Wed Jun 06, 2012 10:32 pm
by BrokenFrog » Mon Nov 19, 2012 9:47 pm
User avatar
Posts: 22
Joined: Wed Jun 06, 2012 10:32 pm