This breadboarded circuit uses a PIC chip to control the Raspberry Pi’s power supply. We first noticed this gap in the RPi features when we built an XBMC setup around the RPi board. It’s not the end of the world, but since installing the Raspberry Pi we have been unplugging it after each use. [Kevin Sangeelee’s] circuit could be the path to automating this process.
This is not really aimed at media applications. The PIC circuit does switch power to the RPi, but the goal was to add a push-button to do so. Other goals of the project include scheduled shutdown and data logging of brownout events on the power rail. As you can see, there’s a coin cell in the mix which keeps time when the system is in power down. The RPi communicates with the PIC via i2c. This facilitates full power-down using the Linux command ‘shudown -h’, as well as the ability to schedule a restart time.
Adding an IR receiver and tweaking the PIC code are all it would take to trigger the power controller from the couch.
22 thoughts on “Raspberry Pi Power Controller Adds Shutdown And Startup Functionality”
What’s the rationale for unplugging it so often? I presume you’re not worried about the power consumption.
If you can do it from a terminal command, then wouldn’t it be easy enough to just make an XBMC shutdown script you can launch?
Even after you shutdown the software the hardware remains on, cpu running.
Yes, but I meant with this. They mention that there would need to be some kind of extra hardware modification, but if you already have remote input there’s no need to make it hardware based.
NO no no no no no no!
For the sake of other devices that might be powered from the same supply, please don’t switch the ground, switch the VCC!!!!
Also, is your PIC running at 3.3V? The MOS you used has a threshold level as high as 4V, which means it is not good for this.
Here is a good one:IRF7204. It’s a PMOS so you can swith the VCC with a threshold of max 2.5V.
Other than this: the pi really would need some sort of zero current off, it reminds me of old computers with win95 that showed a message that it was safe to turn off.
I thought about doing a power off circuit for the PI:a simple RS filp flop. S is connected to a button, you push it to turn on the PI. Reset is connected to a PI pin with a small rc for delay. Last command on the PI is to trigger the reset of the flip flop.
Really? you guys find XBMC on the RasPi usable? I find it incredibly laggy and slow, an old Apple TV1 is 4X faster than the RasPi in running XBMC.
It is a bit laggy, depending on SD card and distro, Raspbmc is quite good but i find OpenElec a little bit more fluid. As for 720 and 1080 content, takes a couple of seconds to start one but once on, it’s flawless.
It did occur lag when i had the 1080 content on network and server under heavy load.
It will get a lot better once we can use the GPU for more than just video decoding. Ie. interface acceleration.
The latest Raspbmc release run great. Little to no lag at all. If you are on your existing install go to Settings > System > Video > Always enable vsync. The interface runs much smoother.
Overkill! 128KB flash? How many pins? You could do something like this with an ATtiny85 or less.
Also sounds like the sort of thing Dallas/Maxim would have a chip for. Are they still open for abuse of their free samples?
I wish to remind you that there is very little difference in prices for the larger chip, and it allows for expansion of the project later. Sure, the price may be around double, but that’s nothing when the chips never peak $5.
Would it not be easier and more cost effective to use a simple push button (on-off) and a cut usb cable to control the power than this ? PICs are awesome but come on! Even if you use a tiny pic at like $0.20USD you still need a PCB if not you are going to need to dead bug it only after programming it… Way to funky for me.
The article mentions the need for real time clock to keep time with automatic turn on of the pi. Also solar power….
I made this for my RPI game console a while back, but I used an ATTiny85 instead, no RTC (code + scheme https://github.com/gamaral/rpi-pwrbtn). I’m working on a version with an RTC, SMT and other fun stuff, but I need to finish moving before I can complete it. :)
Man. You people always beat me to it… I wanted to do this myself, but haven’t had time to.
I wanted to use a smallish PIC 16(L)F1503 and an MCP79410 RTC (has alarms too, so it can wake up the Pi). The PIC runs at 5V and switches an IRF7103 and I added an additional MCP1703-3.3 for more 3.3V current. Everything communicates via I²C. The PIC has some I/O pins left over, which gives you the possibility to add more input/outputs/pwms to the circuit, controllable from the Pi via I²C.
Another nice thing would be to have an LIRC transmitter circuit, but I couldn’t find a good way to notify the Pi when commands arrive other than using another pin as an interrupt pin…
Anyway. Here’s the raw sketch of my circuit: http://s14.postimage.org/8blk29ib5/pipoboard.png
If anyone finishes a good version, please kickstart(er) it, so I can buy it, mkay?! ;)
I’ve just realized that the microcontroller added for the shutdown features can be used as an ADC for the PI
Yes! An other things or course… ;)
I just plugged the Pi into the switched AC outlet on the back of the stereo receiver….
is the schematic wrong or is this guy actually switching GND instead of +5?
for a variety of reasons, that’s a terrible idea….i’m hoping either i’m an idiot and am reading it wrong, or the schematic is wrong!
I said the same thing…
I use a heavily discounted Xmas tree light wireless switched outlet. I can powercycle the pi via remote and keep the cords hidden from the Cat of DOOM. Micro b connectors are not as durable as they could be so not unplugging that power cable will extend the life of the pi.
I made something similar schematic and boards along with shutdown script for the raspi 3B
First press turns on pi, short press shutdown through the script, and long press forces power off.
you can order the boards through easy-eda if you like.
the first revision I hand etched and the second I ordered
Please be kind and respectful to help make the comments section excellent. (Comment Policy)