I want to have a raspberry pi inside a hollowed out book with a contact switch that detects the book cover lifting, which will then send a signal to the pi to turn itself on/wake from a low power state and show a video on the screen.

Is there a way to do this?

  • Your really only wanting to start the video from closure of a switch, there should be a few thousand tutorials for something similar. The pi doesn't "sleep" like a windows computer. Sounds like you may want to turn the screen on and off, but that too can follow the same switch position.
    – Tyson
    Oct 27, 2014 at 3:33
  • There is no low power state on the Pi :( Even when its idle it wont last longer than 24 hours on some batteries at best , but playing a video a few times and that's it.
    – Piotr Kula
    Jan 6, 2015 at 21:14

4 Answers 4


Yes, there are many ways to get a switch interacting with your pi. Have a look here, for example: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/buttons_and_switches/


What do you mean by "low power state"? Raspberry pi in ON or OFF.

If you want it to be allways ON and just run the video ON/OFF based on a push-button you can just connect an GPIO I/O terminal configured as Input that runs some code to start/stop the video. Check here for further reference on this.

If you want to "realy" switch the raspberry pi ON/OFF you can use something like this litle gadget from yepkit

Cheers and best of luck for your project.

  • While it is OK to mention your own product or one that you are affiliated with this should be fully disclosed. Nov 10, 2014 at 8:31
  • You are right on that, and while I did not create it I'm biased as I work at Yepkit. I'm going through my posts that mention products from Yepkit and adding the disclaimers. Nov 11, 2014 at 18:27

Unfortunately there is no low power mode or sleep mode on the Raspberry Pi .

When the Pi is idle running Raspbian

  • Model B ~400mA
  • Model A ~115mA

So the best choice here is the Model A for low power consumption. To further decrease power consumption.

  • Under clocking will not reduce the power consumption at all.
  • Bypass the 5volt regulator and power the Pi form 3.3v rail. But this will mean that USB will not work and possibly the HDMI might not work, unless the screen powers back the HDMI
  • There are extreme mesaures to reaplace both 5v and 3.3v regulators to switching ones. The Model B+ uses switching power filters too. But this might not pay off.
  • When using batteries use an UBEC and Li-Po batteries (make sure you have the correct chargers though) if you not sure just use Ni-Cad rechargeable instead.

Wiring up the button is very simple. You just need to a button, a 10k resistor and some wires. You select a GPIO, add the 10k resistor, connect to the button. And the other side off the button to GND. In what ever flavour of program you like you just wait until the GPIO state changes and run a command line.

For video I would recommend omxplayer as its Hardware GPU and can play back 1080p 30fps with little strain to the power system. Best format is h264 using a baseline encodding.


As others have pointed there is no such thing a low power state. What you could do is to turn the Pi off every time you finish playing your video and then turning it back on from the press of a button, see How to add power button to RPI 3 b+? .

The inconvenience is that it takes (in my case with Pi 4) 40+ seconds for the Pi to boot.

You could also keep the Pi on a black/dark wallpaper until you get the cue to play the video.

Keep in mind that in any case you would need a beefier battery the longer you want the system to remain on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.