DIY Haunted Portrait: Raspberry Pi Jump‑Scare Project (Updated)
Project Overview
Transform an ordinary LCD monitor into a chilling, motion‑activated haunted portrait. Using a Raspberry Pi 3 B, Python, and AtmosFX’s Unliving Portrait videos, you can create a realistic jump‑scare that reacts to motion. This step‑by‑step guide covers hardware assembly, image/video preparation, and the Python scripts needed to bring the scare to life.
Hardware Setup
Step 1: Build the LCD Frame
After disassembling the LCD monitor, I measured the panel’s dimensions: 17" × 11" (portrait). Using an online framing tool, I cut a 1" × 2" wood frame with inner dimensions matching the panel. The LCD sits flush inside, and the outer picture frame remains accessible from the back. I finished the frame with a wood stain, then attached it with a brad nailer.
Next, I mounted the Raspberry Pi on a 3‑D printed Pi Side Mount (Thingiverse). Mirror holders keep the LCD stable, and I drilled a hole for the PIR sensor to connect to the Pi’s GPIO header (pin 7).
Step 2: Prepare Images, Videos, and Code
I selected three AtmosFX Unliving Portrait videos (Man, Woman, Child) for a varied scare set. Each video costs $7.99 and offers high‑impact jump‑scare content. AtmosFX supplies downloadable MP4s, which I renamed to MaleScare.mp4, FemaleScare.mp4, and ChildScare.mp4.
For the initial still image, I captured the first frame of each video using VLC, saved them as MaleStart.png, FemaleStart.png, and ChildStart.png, and stored all media in a ScareMedia folder.
Folder Structure
/home/pi/Projects/Halloween/
├─ ScareMedia/
│ ├─ MaleStart.png
│ ├─ FemaleStart.png
│ ├─ ChildStart.png
│ ├─ MaleScare.mp4
│ ├─ FemaleScare.mp4
│ └─ ChildScare.mp4
Python Scripts
The project uses two Python scripts: pirDetect.py to read the PIR sensor and scare.py to launch the video when motion is detected.
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import os
class detector(object):
def __init__(self, sensor):
self.callBacks = []
self.sensor = sensor
self.currState = False
self.prevState = False
GPIO.setmode(GPIO.BOARD)
GPIO.setup(self.sensor, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
def read(self):
self.prevState = self.currState
self.currState = GPIO.input(self.sensor)
def printState(self):
print(f"GPIO pin {self.sensor} is {'HIGH' if self.currState else 'LOW'}")
def subscribe(self, callBack):
self.callBacks.append(callBack)
def callBack(self, state):
for fn in self.callBacks:
fn(state)
def start(self):
try:
self.read()
self.printState()
while True:
self.read()
if self.currState != self.prevState:
self.printState()
self.callBack(self.currState)
time.sleep(.1)
except (KeyboardInterrupt, SystemExit):
os.system('stty sane')
#!/usr/bin/python
import subprocess as sp
import time
import os
from pirDetect import *
import sys
video = ["omxplayer", "filename", "-o", "both", "--win", "0 0 1280 720", "--aspect-mode", "fill", "--no-osd", "--orientation", "180", "--vol", "-600"]
scareFile = "/home/pi/Projects/Halloween/ScareMedia/{0}Scare.mp4".format(sys.argv[1])
print(scareFile)
def onMotion(currState):
if currState:
video[1] = scareFile
subVideo = sp.Popen(video)
while subVideo.poll() is None:
time.sleep(.1)
def showImage():
os.system(f"sudo fbi -T 1 -d /dev/fb0 -noverbose -once /home/pi/Projects/Halloween/ScareMedia/{sys.argv[1]}Start.png")
showImage()
objDetect = detector(7)
objDetect.subscribe(onMotion)
objDetect.start()
os.system("sudo killall -9 fbi")
When motion is detected, scare.py displays the still image via fbi and launches the chosen video with omxplayer. After the video finishes, the still image remains on screen, ready for the next encounter.
Bringing It All Together
Run the script with a single argument to select the character:
python scare.py Male
Later, you can extend the script to pick a video at random or incorporate a Pi camera to record the intruder. This modular design keeps the project flexible for future enhancements.
For a visual demonstration, watch the finished haunted portrait in action: YouTube Video.
Read the full technical write‑up: Possessed Portrait – Updated
Manufacturing process
- Eyeglass Frames: The Ultimate Fashion Accessory
- Liquid Crystal Display (LCD): Technology, Manufacturing, and Future Outlook
- Build Engaging LCD Animation & Gaming with Arduino UNO
- Build an AI LCD Companion: Your Interactive Buddy
- Build a Reliable Arduino Weather Station with DHT Sensors
- Arduino Temperature Sensor Project: Read, Convert, and Display Fahrenheit
- DIY Arduino LCD Project: Assemble with Resistors, Pushbutton, and 16x2 Display
- Arduino LCD Thermostat: Simple & Reliable Temperature Control
- Create a Real-Time Arduino PC Monitor with LCD Display
- How TFT LCDs Are Made: A Detailed Manufacturing Process