Welcome to Facet Family of Companies
Raspberry Pi Photo Booth

A Remix of the Raspberry Pi Foundation's All Seeing Pi

Facet Photo Booth: a Remix of the Raspberry Pi Foundation's All-Seeing Pi

If you are looking for a challenge, or wish to learn some coding basics for Raspberry Pi while setting up your photo booth, we encourage you to follow the Pi Foundation's instructions at their website here.

This tutorial is a remix of the Pi Foundation's original learning resource. We added additional buttons to ours, mixed up the overlays, and changed a few things around in the code. The Facet Photo Booth operates without a mouse or keyboard, making it a good choice for large groups of people (especially children), or for those who want a sleeker look. The Pi Foundation also created neat housing for their booth, and includes instructions for those who wish to use a touchscreen LCD with their photo booth.

Now, on to the instructions!

Supplies:

Included in Facet's "Raspberry Pi Photo Booth Starter Kit"

Raspberry Pi 2 or 3, Model B

This tutorial is written for a Pi 3 loaded with NOOBS, connected to the internet without any special configuration. You can find SD cards pre-loaded with NOOBS at Facet Technologies and Nerds on Call.

Raspberry Pi Camera

8 Male-Female Jumper Wires (plus some for extensions, if needed)

Breadboard

4 Tactile Push Buttons (3 if you do not wish to Tweet with your photo booth)

Monitor or Projector

Time to make it happen!

  1. Let’s start with the basic setup of your Raspberry Pi! Start by connecting the camera module to the board using the ribbon cable and, if needed, a toothpick or other small pokey thing to open the slot. The blue side should face the USB ports.

  2. Now it’s time to wire up your buttons. A pin guide can be found in Appendix A. For each button, you will need two wires: one ground and one GPIO input. Let’s start with the breadboard.
    1. A quick note:  You absolutely can connect your buttons and GPIO inputs in any pattern you choose (as long as you’re using correct inputs). The spots we have chosen are arbitrary. It does, however, make this tutorial easier if you use the same spots.

  3. Grab your breadboard and stick your buttons in the middle (3 buttons without Twitter incorporation, 4 with Twitter) with their legs in different rows. A picture of my breadboard can be found in Appendix B. Your momentary buttons should push down snug against the board. This may take a little oomph. Spread them out as you please, as long as the legs in different rows (1-60). If you have buttons with four legs, straddle them across the middle of the breadboard.

  4. Let’s move on to the Raspberry Pi. You’ll need two jumper wires per button. Stick one wire each in the same row (1-60) as both of the legs. Now, using the pin guide found in Appendix A, take one wire from each button and connect it to a ground (GND) pin. Then, connect the buttons for:
    1. Taking a picture to GPIO 25
    2. Changing the filter to GPIO 23
    3. New picture to GPIO 17
    4. Sending a tweet (if you are enabling Twitter) to GPIO 19.

  5. Whew! You’re done wiring up your photo booth.

  6. If you haven’t already, enable your camera. Open a command prompt window and type in sudo-raspi-config to open the setup menu for your Pi. Use the arrow keys to enable the camera. Reboot the system.

  7. Before you start tackling the photo booth itself, there are a few software packages you’ll need to install on your Pi (Remember, to install software on your Raspberry Pi, you’ll need to open a terminal window).
    1. Python 3 picamera (to integrate your camera into Python)
    2. Python 3 guizero (a program for making simple GUIs, or graphical user interfaces)
    3. Python 3 twython (a python library for accessing Twitter)
    4. Python 3 PIL (or Python Imaging Library, which allows you to work with images)

  8. Install them using these commands:
sudo apt-get install -y python3-picamera python3-pip
sudo pip3 install guizero
sudo pip3 install twython
sudo apt-get install -y python3-PIL
  1. You can copy and paste all of these lines at once into your terminal window and press enter (terminal will go down the list for you). Your Pi will grab and install all of these software packages.

  2. Now, on to the software. Open up the file explorer and create a new folder in the home/pi section. You can call yours what you please. Ours is called facetphotobooth. Note the path.

  3. Click on the raspberry in the upper left hand corner of the screen. Go to the programming menu and choose Python 3.
  4. Create a new file and save it to the facetphotobooth folder you created as facetphotobooth.py.

  5. Let’s test the buttons you wired up. Import the gpiozero library into your Python file with the command: from gpiozero import Button.

  6. Assign names to the buttons you set up. Use the commands:

next_overlay_btn = Button(23)
next_overlay_btn.when_pressed = next_overlay

take_pic_btn = Button(25)
take_pic_btn.when_pressed = take_picture

new_pic_btn = Button(17)
new_pic_btn.when_pressed = new_picture

send_tweet_btn = Button(19)
send_tweet_btn.when_pressed = send_tweet

  1. Have the buttons print a message when pushed for testing purposes with the code:
def next_overlay():
    print("Next overlay")

def take_picture():
    print("Take a picture")

def send_tweet():
    print("Send Tweet")

def new_picture():
    print("New picture")
  1. Press F5 to run this set of code. Check your buttons by pressing them and making sure the right text comes up for each.

  2. If you are looking to write out the code for the photo booth yourself, use the Raspberry Pi Foundation’s excellent resource worksheet at: https://www.raspberrypi.org/learning/the-all-seeing-pi/worksheet2/. If you wish to simply copy, paste, and play with your photo booth, or troubleshoot issues when following the tutorial, the code we edited for the facetphotobooth file can be found here (both WITH and WITHOUT Twitter integration). Once you’ve copied the code into the facetphotobooth file, continue to the next step.
# WITHOUT TWITTER

from picamera import PiCamera
from gpiozero import Button
from overlay_functions import *
from time import localtime, strftime, time
from guizero import App, PushButton, Text, Picture

def next_overlay():
    global overlay
    overlay = next(all_overlays)
    preview_overlay(camera, overlay)

def take_picture():
    global output
    output = strftime("/home/pi/facetphotobooth/image-%d-%m %H:%M.png", localtime())
    camera.capture(output)
    camera.stop_preview()
    remove_overlays(camera)
    output_overlay(output,overlay)
    size = 400, 400
    gif_img = Image.open(output)
    gif_img.thumbnail(size, Image.ANTIALIAS)
    gif_img.save(latest_photo, 'gif')
    your_pic.set(latest_photo)

next_overlay_btn = Button(23)
next_overlay_btn.when_pressed = next_overlay
take_pic_btn = Button(25)
take_pic_btn.when_pressed = take_picture


camera = PiCamera()
camera.resolution = (800, 480)
camera.hflip = True
camera.start_preview ()


output = ""
latest_photo = '/home/pi/facetphotobooth/latest.gif'
def take_picture() :
    camera.capture(output)
    camera.stop_preview()
    remove_overlays(camera)
    output_overlay(output, overlay)

def new_picture():    
    camera.start_preview()
    preview_overlay(camera, overlay)

new_pic_btn = Button(17)
new_pic_btn.when_pressed = new_picture

app = App("The Facet Photo Booth", 800, 480)
message = Text(app, "I spotted you!")
your_pic = Picture(app, latest_photo)
new_pic = PushButton(app, new_picture, text="New picture")
app.display()
# WITH TWITTER

from picamera import PiCamera
from gpiozero import Button
from overlay_functions import *
from time import localtime, strftime, time
from guizero import App, PushButton, Text, Picture
from twython import Twython
from auth import (
    consumer_key,
    consumer_secret,
    access_token,
    access_token_secret
)

def next_overlay():
    global overlay
    overlay = next(all_overlays)
    preview_overlay(camera, overlay)

def take_picture():
    global output
    output = strftime("/home/pi/facetphotobooth/image-%d-%m %H:%M.png", localtime())
    camera.capture(output)
    camera.stop_preview()
    remove_overlays(camera)
    output_overlay(output,overlay)
    size = 400, 400
    gif_img = Image.open(output)
    gif_img.thumbnail(size, Image.ANTIALIAS)
    gif_img.save(latest_photo, 'gif')
    your_pic.set(latest_photo)

next_overlay_btn = Button(23)
next_overlay_btn.when_pressed = next_overlay
take_pic_btn = Button(25)
take_pic_btn.when_pressed = take_picture

camera = PiCamera()
camera.resolution = (800, 480)
camera.hflip = True
camera.start_preview ()

output = ""
latest_photo = '/home/pi/facetphotobooth/latest.gif'
def take_picture() :
    camera.capture(output)
    camera.stop_preview()
    remove_overlays(camera)
    output_overlay(output, overlay)

def new_picture():    
    camera.start_preview()
    preview_overlay(camera, overlay)

def send_tweet():
    twitter = Twython(
        consumer_key,
        consumer_secret,
        access_token,
        access_token_secret
        )
    message = "Spotted by the Facet Photo Booth! #raspberrypi #coolestnerds"
    with open(output, 'rb') as photo:
        twitter.update_status_with_media(status=message, media=photo)
        
new_pic_btn = Button(17)
new_pic_btn.when_pressed = new_picture

send_tweet_btn = Button(19)
send_tweet_btn.when_pressed = send_tweet

app = App("The Facet Photo Booth", 800, 480)
message = Text(app, "I spotted you!")
your_pic = Picture(app, latest_photo)
new_pic = PushButton(app, new_picture, text="New picture")
tweet_pic = PushButton(app, send_tweet, text="Tweet picture")
app.display()
  1. Now let’s set up your overlay file on your Pi. The overlays are pictures with transparent backgrounds that “lay over” your photos and camera feed. For this step, you're going to go to the Raspberry Pi Foundation's GitHub resource for the photo booth here: https://github.com/raspberrypilearning/the-all-seeing-pi/tree/master/en/resources. Here, you'll find all of the filters they've made as well as the code for the overlay file (which also works with the Facet version). You'll need to download the overlay_functions.py file to the facetphotobooth folder.
  2. To get the overlays themselves, you’ll need to create another folder called “overlays” in the facetphotobooth folder. To this, add the pictures you can download here by right clicking on the photo and choosing "Save Picture As", the pictures you can download from the Raspberry Pi resources GitHub folder, or make your own. You can use any picture with a transparent background that is sized to 800 x 480 pixels and saved as a .png image. Save these images to the overlays folder and note their names, as you will have to change the overlay names in the facetphotobooth.py code.
  1. If you wish to add Tweeting capabilities to your photo booth, follow the Raspberry Pi Foundation’s in-depth instructions at https://www.raspberrypi.org/learning/the-all-seeing-pi/worksheet2/.
  2. Your photo booth is ready to use! Have questions? First, check your code and your wiring, then call us at (309) 353-4727.

Featured Review

Janis Wetterich

Nerds on Call will take care of you! If you have computer problems, call them up! They have remotely fixed my computer many times. If I need accessories, I just call them up, and they send them directly to my home right away! I am out of state, and get my orders very quickly!

View Original Facebook Review

Store Hours

Peoria Location
Monday - Friday: 8 am - 7 pm
Saturday: 9 am - 3 pm 

Normal Location
Monday - Friday: 8 am - 7 pm
Saturday: 9 am - 3 pm 

Pekin Location
Monday - Friday: 8 am - 6 pm
Saturday: 9 am - 3 pm