Introduction: Living Portrait Scare for Halloween Using a Raspberry Pi, PIR and Python
Lets make a living portrait effect for Halloween, and scare some people.The goal is to have the portrait remain still until the motion sensor is triggered and to do this without a blank space between videos, the scare or the reset of the image. Many of the triggerable media players aren’t seamless and for those that are its quite expensive.The cheaper ones results in a black screen in between scares or even between scenes, which totally ruin the effect.Here we will use a raspberry pi and python3, and by the end of this you too can have a wonderful Halloween prop, and scare anyone that comes close.
Parts needed:
- Raspberry pi 2|3: $35.00
- 5v PIR (Passive InfraRed) sensor: $5.00
- I got mine from amazon for around 8.00 (now 11.00) but it comes with 5 from Amazon
- Unliving portrait video: $8.00 AtmosFX
- TV|Monitor: you have this laying around
- Wood or old frame to cover monitor
Software Needed:
- Python: pre-installed on Raspbian
- Omxplayer: pre-installed on Raspbian
- Omxplayer-wrapper library
Step 1: Software and Connections
I’m not going to go into how to setup a pi, there are plenty of documents around that, but if you need it here is the documentation on how to install Raspbian. I recommend using SSH and setting up wifi to make it easy to test and start the script. How to setup SSH on windows and Raspbian here.
Now we need to install Omxplayer-wrapper and grab a script from my github.
Open a terminal in Raspbian and enter
- sudo python3 -m pip install omxplayer-wrapper
- this should install all the requirements and should be all you need to set it up
- Grab my portrait player script from My github page or attached to this instructable.
- Copy your living portrait video to the pi somewhere.
- Once this is done, omxplayer-wrapper is installed, and all the files are ready turn off the pi and continue on.
- To set up the PIR to work with the PI you need to connect the Sensor.
- PIR VCC to 5v(pin2)
- PIR Out to GPIO4(pin7)
- PIR GND to GND(pin6).
Your PIR might be different in layout please ensure its correct. Also turn all the potentiometers counter clockwise which should be all the way down, you can adjust sensitivity later if needed. If you need a narrow field of view from the sensor I recommend removing the plastic cover from the PIR.
Attachments
Step 2: Testing
With this hooked up start up the pi and navigate to the folder where the living_portrait.py script is, depending on your settings you may need to adjust the screen width or screen height. In the living_portrait.py script change the swidth and slength variables to match your monitor. Mine was 1440x900.
To start the effect run:
- python3 living_portrait.py filename
- for example:
- python3 living_portrait.py UP_Gent_LivingNightmare_TV_V.mp4
It is important to note that what happens in this effect is the player starts the video and then pauses it immediately before the scare happens. Make sure you pick a video that when un-paused it will produce the effect you want.
Lastly, we need to frame our monitor, you can either use an old frame that fits or you can make your own for pretty cheap. Buy some molding from Home Depot cut it on 45-degree angles and either nail or staple it together. I also mounted to L-brackets to my frame so I can hang it on the monitor. For a final touch I drilled a hole for the PIR sensor, but this isn't necessary and sometimes takes some trial and error to make the trigger work to ones desire.