Raspberry Pi power controller adds shutdown and startup functionality

rpi-power-control-using-a-pic

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.

[Thanks Donn]

Comments

  1. Hugh O'Brien says:

    What’s the rationale for unplugging it so often? I presume you’re not worried about the power consumption.

  2. Willrandship says:

    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?

  3. Bogdan says:

    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.

  4. fartface says:

    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.

    • CraXyOW3 says:

      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.

    • Willrandship says:

      It will get a lot better once we can use the GPU for more than just video decoding. Ie. interface acceleration.

    • Parker says:

      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.

  5. Daaaaave says:

    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?

    • Willrandship says:

      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.

  6. atomsoft says:

    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.

  7. 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. :)

  8. raer says:

    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?! ;)

  9. eldorel says:

    I just plugged the Pi into the switched AC outlet on the back of the stereo receiver….

  10. 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!

  11. Addidis says:

    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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,376 other followers