DIY Smart Picture Frame & Calendar Using Raspberry Pi 3 – PART 2

DIY Smart Picture Frame & Calendar Using Raspberry Pi 3 – PART 2

smart picture frame

 

smart picture frame

PART 2 of this tutorial will take you through the steps of building a frame for the Smart Picture Frame and Calendar and connecting a PIR motion sensor to control the picture frame slideshow transition to calendar.

Continuation of this project will use everything that was setup in DIY Smart Picture Frame & Calendar Using Raspberry Pi 3 – PART 1 of this tutorial and take you through the steps of installing OS add-ons in order to run the Python Scripts to control the PIR Sensor.

There are specific steps in every project to get from Concept to Deployment. PART 1 of this tutorial brought us through the Concept stage to the Prototype Stage and ended with Testing. In PART 2, we will make Revisions, go through Design adjustments before Getting a 2nd Prototype, which we will then Test before getting a final Deployment.

HARDWARE

  • Microprocessor: Raspberry Pi 3 Model B (1GB)
  • Monitor: HannsG HL161 16inch Monitor
  • VGA Adapter: Generic HDMI Input to VGA Adapter Converter For PC
  • Power Supply: DC 12V/2A
  • Power Converter: SINOLLC DC 12V to 5V Converter
  • Sensor: EMY HC-SR501 PIR Motion Sensor
  • Cables: USB Type-A / Micro-B; Generic 15-pin VGA Cable for Monitor; Breadboard Jumpers
  • Breadboard: Generic Solderless Breadboard
  • Case: Official Raspberry Pi 3 Case
  • WiFi Router: Generic WiFi Router

OS ADD-ONS

  • rpi.gpio
  • uinput

FRAME

  • Board: 22in x 15in x 3/4in Wood Board
  • Stip: 4in x 22in x 1/4in Wood Strip
  • Cover: Natural Cork Role 24in x 48in

TOOLS

  • Meter: Generic DV Voltage & Impedance Meter
  • Solder Iron: Generic
  • Saw: Jig Saw
  • Stapler: Generic Stapler
  • Drill: Counter Sink; Wood Bore
  • Router: 1/4in Plunge Bit
  • Misc: Tape Measure; Screw Driver; Plier Snips; Utility Knife
  • Screws: 3/4in Wood Screw; M4 VESA Screw
  • Tape: Double Sided
  • Glue: Wood Glue
  • Mounts: Adhesive Zip Tie Mount; 3M Command Mount
  • Misc: Zip Ties; Picture Frame Wire

From idea to development

smart picture frame

 

 

STEP 1 – Revisions

It’s not enough to have easy access to our Family’s online calendar. This project went a step further to integrate a slide show of family photos so as to add a nicer aesthetics to this wall mounted piece. We’ve taken the steps of putting all the content in the cloud through the use of Google Apps and overGrive. Now we need to control the switch between calendar and slideshow with a Motion Sensor so the monitor will only display the calendar when someone is standing in front of it.

STEP 2 – Design

 

smart picture frame

PART 2: We’ll connect a PIR Motion Sensor to the Raspberry Pi (RPi) GPIO pins and install the necessary OS add-ons to be able to run a Python script that presses ESC when it receives input from the sensor. This way, when there is movement in front of the Smart Picture Frame, the slideshow will terminate, revealing the Family calendar in Chromium.

STEP 3 – Prototype

I. Getting Started

1) BOOT the RPi PART 1 disk image # This should load directly into Chromium Kiosk displaying your calendar

2) [Ctrl]+[Alt]+[F2] # Exit Kiosk Mode

3) >login:< with >Password:< # Get to the command prompt

4) startx # Startup Pixel GUI without Chromium

II. Install Python Script Dependencies

1) Open a Terminal window to enter commands

a) CLICK-ON the “Raspberry” icon in the upper left hand corner

b) SELECT the >Terminal< application under the >Accessories< menu

2) sudo apt-get update # Check for and install latest Raspbian Jessie updates

3) sudo apt-get install python-rpi.gpio python3-rpi.gpio # Install Python RPi.GPIO dependency

4) wget http://tjjr.fi/sw/python-uinput/releases/python-uinput-0.11.2.tar.gz # Download Python uninput module

5) tar -xzf python-uinput-0.11.2.tar.gz # Uncompress downloaded file

6) cd python python-uinput-0.11.2 # Open uncompressed folder

7) python setup.py build # Build installer

8) python setup.py install # Run installer

9) sudo nano /etc/modules # Open modules file to edit

a) uinput # add to the end of the file

b) [Ctrl]+[X] # Exit file

c) [Y] # Yes to save file

d) [Enter] # write file
smart picture frame

10) sudo reboot # Reboot RPi for changes to take effect – follow the steps in I. Getting Started to get back to this point

11) Open a Terminal window

a) CLICK-ON “Raspberry” icon in the upper left hand corner

b) SELECT the >Terminal< application under the >Accessories< menu

12) lsmod # List active modules – confirm “uinput” has loaded

III. Connect PIR Motion Sensor

1) Using a Breadboard and Jumpers (Black, Blue, Red) connect the PIR Motion Sensor to RPi Board Pins

a) Connection Jumpers to the RPi Board GPIO pins using this color code for each pin (2)-Red, (6)-Black, (10)-Blue

smart picture frame

b) Connect the Jumpers to the PIR Motion Sensor pins using this color code by orientation
smart picture frame

c) Use a Breadboard to make the connection from the RPi to the PIR Motion Sensor
smart picture frame

IV. Test

1) Create a “Smart_Cal” folder

a) CLICK-ON the “Folders” icon in the upper left hand corner

b) DOUBLE-CLICK >Documents< folder

c) [Shift]+[Ctrl]+[N] # Create new folder

d) Smart_Cal # Enter name for the newly created folder
smart picture frame

2) Download Python scripts

a) CLICK-ON the “Blue Globe” icon in the upper left hand corner

b) GOTO Github Repository https://gist.github.com/glafranceri

c) DOWNLOAD the following files into the “Smart_Cal” folder

i. gpio_test.py

ii. uinput_test.py

iii. PIR_ESC.py

3) Open a Terminal window

a) CLICK-ON the “Raspberry” icon in the upper left hand corner

b) SELECT the >Terminal< application under the >Accessories< menu

4) sudo python /home/pi/Documents/Smart_cal/uinput_test.py # Run script – confirm following result “HELLO
smart picture frame

5) sudo python /home/pi/Documents/gpio_test.py # Run script – confirm following result when movement in front of PIR Motion Sensor “Motion Detected” – use [Ctrl]+[C] to exit Script
smart picture frame

6) sudo python /home/pi/Documents/PIR_ESC.py # Run script – confirm following result when movement in front of PIR Motion Sensor “^[“ – use [Ctrl]+[C] to exit Script
smart picture frame

7) sudo chmod 775 /home/pi/Documents/Smart_Cal/PIR_ESC.py # Make script executable

8) sudo nano ~/.config/lxsession/LXDE-pi/autostarts # Open autostart file to edit

a) @sudo python /home/pi/Documents/Smart_cal/PIR_ESC.py # add to the end of the file

b) [Ctrl]+[X] # Exit file

c)  [Y] # Yes to save file

d) [Enter] # Write file

smart picture frame

NOTE: After --kiosk add the url for your calendar without the quotations ( )

9) sudo reboot Reboot RPi for to test PIR_ESC.py scipt – confirm that after slide show starts moving in front of PIR Motion Sensor exits the slideshow (see video)

 

STEP 4 – Framing

1) Review Materials and tools list

2) Trace the outline of the monitor onto the center of the 3/4in Wood Board
smart picture frame

3) Trace a 1/4in smaller outline inside the monitor outline
smart picture frame

4) Use a Wood Bore to drill out the 4 corners of the smaller outline
smart picture frameDrilled out 4 corners
smart picture frame

5) Use the Jig Saw to cut along the smaller outline
smart picture frameCut out smaller outline
smart picture frame

6) Confirm Monitor fits in the opening (front)
smart picture frameConfirm Monitor fits in the opening (back)
smart picture frame

7) Measure and cut Natural Cork Roll oversized by 3 in to the Frame
smart picture frameMeasure
smart picture frameCut Natural Cork Roll
smart picture frame

8) Apply a generous and even amount of glue to the side of the frame that will be covered in the Natural Cork
smart picture framesmart picture frame

9) Press the Frame over the Natural Cork
smart picture frameStaple it to the edges of the Frame
smart picture frame

10) Use the Utility Knife to carefully cut away the excess Natural Cork
smart picture frameCross-cut and fold back the center opening
smart picture frame

11) Confirm the Monitor fits snugly inside the center opening
smart picture frameIt should look something like this
smart picture frame

12) Use the 1/4in Wood Strip to line up and secure the back of the Monitor to the Frame via the VESA mount holes
smart picture framesmart picture frame

13) Add a hanging point by adding two screws to the top of the Frame and winding the Picture Frame Wire between them
smart picture frame

14) Confirm that the Monitor is supported firmly by the Frame
smart picture frame

 

STEP 5 – Power Supply

1) Review the power requirements (Monitor 12V DC & RPi 5V DC)

2) Cut the USB Type-A / Micro-B cable in half and strip out and expose the wires on both pieces

3) Watch the following video to see how to map the USB wires and properly connect the Monitor and RPi to one 12V/2A Power Supply (see video)

Figure 2: Wire Diagram for USB Cable

STEP 6 – Final Assembly

1) Assemble all the components to mount in the Frame (see video)

2) Bore out the cavity for the PIR Motion Sensor

a) Select a Drill Bit that is the size of the PIR Motion Sensor cap
smart picture frame

b) Using a scrap strip of wood to compress and protect the Natural Cork, Drill a hole through the Frame
smart picture frame

c) Line up and trace the outline of the PIR Motion Sensor on the back of the Frame where the cap fits into the hole
smart picture frame

d) Use the Router to cut out the traced outline down to 1/2in
smart picture frame

e) Confirm PIR Motion Sensor fits in cavity and Jumpers reach RPi GPIO pins
smart picture frame NOTE: Hold PIR Motion Sensor in with non-conductive adhesive tape

STEP 8 – Deployment

1) Now that everything has been thoroughly tested and the Smart Picture Frame is fully assembled, it’s time to find a nice spot for it to go (see video)

 

CONCLUSION

The Smart Picture Frame is done and it’s already making it easier for my family to keep organized. Everyone can access the Google Calendar from their phones and add or edit events easily. The Picture Frame is a pleasant transition when nobody is looking at the calendar and also easy to update photos. I sure hope you are able to follow this DIY tutorial and build one for yourself.