The Official Raspberry Pi Projects Book - Projects_Book_v4

(singke) #1

raspberrypi.org/magpi The Official Raspberry Pi Projects Book 51


With this firmly in place inside the
cupboard, Piet was able to remotely
access the Pi and create the code to
run his holiday footage.
Piet created a simple Python
script with two functions. The first
detects the presence of someone


passing by, and the second then
runs the holiday footage on the
screen. To complete the first task,
he used an IR distance sensor from
Adafruit. This would detect motion
within a set range around the


photo frame. The motion sensor
then triggers Omxplayer to play
five minutes of footage before
turning the screen off again.
To add to the look and feel of
the newspaper, Piet edited the
footage to give it a grainer, sepia

tone in line with the movie prop.
He converted the footage to H.264
so that it played through the
Raspberry Pi, creating a beautifully
executed and impressive magical
holiday souvenir.

HARRY POTTER AND THE DAILY PROPHET Projects


Above Both the glass of the frame and the bevel of the screen keep it fitted
snugly within the newspaper, with no need for glue or screws

>STEP-01
Behind the scenes
The Raspberry Pi, screen, and wiring fit perfectly
inside the recess of the frame, with a hole in the
wall leading to a power supply on the other side.

>STEP-02
Look, no wires!
By cleverly diverting the power cable through
the wall, Piet adds an extra level to the magical
illusion of the piece.

>STEP-03
Spotted!
The Python script and an IR sensor control the
screen and the duration of the video: approach
the frame and the system begins to play.

CODING MAGIC


Within the design, I marked an


area with the exact size of the


Raspberry Pi screen


Added texture and colour effects give the
video the appearance of a Daily Prophet image
Free download pdf