How to Create a Photo Booth with the Raspberry Pi

Edit Article Photo booths are a lot of fun and make a crowd pleasing addition to social events such as parties, birthdays, and weddings. Guests enjoy posing for pictures and end up with distinct keepsakes of a memorable event. While renting a photo booth can be costly, using a Raspberry Pi, you can make your own for a lot less money and have a lot more fun doing it!

Set Up Your Raspberry Pi

  • How to Create a Photo Booth with the Raspberry Pi

    Ensure your Raspberry Pi is up to date.You will need a Raspberry Pi model 2B or later, running the latest Raspbian Jessie with PIXEL operating system and the standard peripherals such as a monitor, keyboard, and mouse. If you do not already have your Raspberry Pi set up this way, check out the guideHow to Get Started with the Raspberry Pifor detailed step-by-step instructions.
  • How to Create a Photo Booth with the Raspberry Pi
    Update your package libraries.Open a new terminal window by pressing the terminal icon in the top left of the task bar and type the following:
    sudo apt-get update
    then pressEnter. This will update your software package lists so it can determine which programs need upgrading and which are already up-to-date.
  • Upgrade your packages.In the terminal, type:
    sudo apt-get upgrade
    then pressEnter. This will upgrade your programs and operating system if newer versions are available.

Connect the Camera Module

  • Shut down the Raspberry Pi and disconnect the power.
  • How to Create a Photo Booth with the Raspberry Pi
    Locate the camera port.
  • How to Create a Photo Booth with the Raspberry Pi
    Lift the back tab by pulling up on the two sides.
  • How to Create a Photo Booth with the Raspberry Pi
    Insert the ribbon cable so the metal connectors are facing away from the Ethernet port and towards the HDMI port as pictured.
  • How to Create a Photo Booth with the Raspberry Pi
    While holding the camera ribbon cable in place, press down on the two tabs.This will lock the camera's ribbon cable into place. Ensure the ribbon cable is secure and sitting evenly in the camera port.
  • Reconnect the power and start up the Raspberry Pi.
  • How to Create a Photo Booth with the Raspberry Pi
    Open the Raspberry Pi configuration menu.Click the raspberry icon in the top left corner of the task bar. Go to “Preferences” then click “Raspberry Pi Configuration.”
  • How to Create a Photo Booth with the Raspberry Pi
    In theInterfacestab, make sure the camera software is enabled.Then pressOK.
    • The computer may prompt you that it needs to restart before changes can take effect. It will then ask if you want to restart the computer now, in which case, selectYes.
  • Test the camera by taking a picture!Open up a new terminal window and type:

    raspistill -o cam.jpg

    then pressEnter. The camera preview will turn on a second later it will snap a picture. It will be saved to your user's home directory with the filenamecam.jpg.
    • You can replacecam.jpgin the above command with whatever filename you prefer so long as it ends with.jpg
  • How to Create a Photo Booth with the Raspberry Pi
    Open the picture file you just created.You can open the File Manager by clicking the file folder icon in the top left side of the task bar. You should see the picture file in your home directory. Double click the file and this will open the picture with the Image Viewer. Excellent!

Choose a Photo Printer

  • How to Create a Photo Booth with the Raspberry Pi
    Consider the pros and cons of various printers.
    • Inkjetprinters are usually less expensive and produce good photo-quality prints. However, they typically have slower print speeds and are deceivingly expensive when printing in large quantity. The photo paper is sold in sheets and the ink cartridges are sold separately by color.
    • Laserprinters have excellent print speeds but even color laser printers don't normally produce photo-quality images nor do they print on photo paper. For color laser printers, the toner cartridges are also sold separately by color.
    • Dye-sublimationprinters provide excellent photo-quality prints, fast printing speeds, and vary greatly in price. The photo paper for dye-sublimation printers is sold with the exact amount of dye film needed to print the same amount of paper. For the more expensive high volume models, the paper and dye are sold together in rolls and the printer automatically cuts each photo off after printing. For the less expensive lower quantity models, the photo paper and dye are sold together in sheets.
  • Consider your needs and your budget.What type of event will your photo booth be used in and how many photos are you likely to print? What photo size do you want the prints to be and how costly is the required media? Are you going to use the photo booth in the future? Depending on your circumstance, it may be in your best interest to rent a professional event printer or buy a used model at a fraction of the cost.
  • Ensure your printer is compatible with the Raspberry Pi.Whatever printer you plan to use, it must be supported by Gutenprint. Gutenprint is an open source collection of free printer drivers for use with UNIX based printing systems, which is what the Raspberry Pi uses to print.Here is a list of printers which are currently compatible with Gutenprint. If it says “EXPERIMENTAL” next to your printer, it could have issues and may not work reliably on the Raspberry Pi.

Install the Photo Printer

  • Install CUPS.CUPS (or Common Unix Printing System) is the program we need to be able to print from the Raspberry Pi. Open a new terminal window and type:
    sudo apt-get install cups
    then pressEnterand it will load the installation files. When prompted to proceed, typeYand pressEnter. CUPS will begin the installation process which could take 15 minutes or longer.
  • Add the user 'pi' to the group that is allowed to print 'lpadmin'.In the terminal type:
    sudo usermod -a -G lpadmin pi
    then pressEnter.
  • Plug in the printer to the Raspberry Pi using the USB cable.Then turn the printer on.
  • How to Create a Photo Booth with the Raspberry Pi
    Open the internet browser by clicking the blue globe icon in the top left side of the task bar.In the URL bar enter the following address:

    http://127.0.0.1:631

    then pressEnter. This will open the CUPS setup page in your browser.
  • How to Create a Photo Booth with the Raspberry Pi
    Click on theAdministrationtab.Then click onAdd Printer. You will be prompted for your username and password.
    • The default username ispiand the default password israspberryunless it was previously changed.
  • How to Create a Photo Booth with the Raspberry Pi
    Select your printer under the Local Printers list and clickContinue.Ignore the VNC Remote Printer and don't worry if your printer is listed twice.
  • How to Create a Photo Booth with the Raspberry Pi
    Rename your printer to something easy to remember and simple to type.In the example pictured, we will rename the printer from the defaultSony_UP-DR200to simplySonyUPso it's easier to remember and type. You can also enter a location tag if you wish. In this example we will enterphotoboothas the location. Then clickContinue.
  • How to Create a Photo Booth with the Raspberry Pi
    Select the printer driver for your specific printer's make and model.Then clickAdd Printer.
  • How to Create a Photo Booth with the Raspberry Pi
    Select the default print settings you would prefer on this printer.If you don't know what a particular setting does, it's best to leave it alone. The most important setting is to ensure that the Media Size corresponds with the paper size you are currently using. Then clickSet Default Options. You should see a confirmation page which displays "Printer 'YourPrinterName' default options have been set successfully." This will then redirect you to the printer's main status and job page.
  • How to Create a Photo Booth with the Raspberry Pi
    Check for active printers.Open up a new terminal window and type:

    lpstat -p

    and then pressEnter. This will return the name and status of the current default printer. The displayed printer name should be the one you designated earlier in the CUPS setup and the status should be "idle" if the printer is not in use.
  • How to Create a Photo Booth with the Raspberry Pi
    List the files in your home directory.In the terminal type:

    ls

    then pressEnter. This will return a list of directories and files that are in the home directory. In the list you should find the filename of the picture you took earlier in the Connect the Camera Module section.
  • Print the picture.In the terminal type:

    lp -d PRINTERNAME cam.jpg

    only instead ofPRINTERNAMEtype in your own printer's name and substitutecam.jpgwith the filename of your picture, then pressEnter. Your picture will print from the printer! Great work!

Get the Photo Booth Code

  • How to Create a Photo Booth with the Raspberry Pi
    Pick a photo booth code.Creating a photo booth program from scratch is beyond the scope of this guide. Luckily, there are many different programs floating around on the net that different users have written for their own DIY photo booth projects! Luckier still, many of those awesome people have made their open source code free to the public for personal use. You can search places like Github.com for one that suits your needs, however this guide will use a program written by Kenneth Centurion, adorably named 'boothy,' as an example. It's simple and fairly easy to understand and could be customized without too much programming knowledge. You can inspect the files and explore the code in your browser here:https://github.com/zoroloco/boothy.
  • How to Create a Photo Booth with the Raspberry Pi
    Clone the boothy repository.Cloning is simply another way of saying 'downloading' and a repository is simply a collection of files. Open a new terminal window and change the directory by entering:

    cd /usr/local/src

    then hitEnter. Next, clone the boothy repository to this folder by typing:

    sudo git clone git://github.com/zoroloco/boothy.git

    then pressEnter. This will copy the entire boothy depository and all it's files to the directory you are currently in. Great work!

Set Up the Photo Booth Code

  • Change file and folder permissions.You will need to make many of these new files writable and executable so that you can edit and run the various files. You can learn more about the different permissions settings onthe official Linux website. The quickest way is to make the entire boothy directory readable, writable, and executable to everyone. To do this, in the terminal window type:

    sudo chmod 777 -R /usr/local/src/boothy

    and pressEnter.
  • Run the INSTALL file as a bash script.The INSTALL.txt file has a list of commands that will download and install various packages that you will need to run boothy. Instead of enter them all manually, you can run the text file as a script. In the terminal type:

    sudo bash /usr/local/src/boothy/INSTALL.txt

    and pressEnter. Be sure to respond to any prompts during the installation process. This step could take quite a while, so this would be a great time to grab a cup of coffee! Wait until all the packages are installed before continuing to the next step.
  • Edit the "run" script.In the terminal type:

    sudo nano /usr/local/src/boothy/run.sh

    and pressEnter. This will open the filerun.shin a text editor within the terminal. Use the arrow keys to navigate and add a-ion the bottom line after the word "python" so the whole code appears as:

    #!/bin/bash## chmod +x run.sh##clearsudopython-i/usr/local/src/boothy/pbooth.py
    Then pressCtrl+Xand it will ask you if you want to save. Pressyand pressEnter.

Connect the Button

  • Shutdown the Raspberry Pi and disconnect the power.
  • How to Create a Photo Booth with the Raspberry Pi
    Locate the GPIO pins for the button.GPIO stands for General Purpose Input Output and it refers to the 40 pins on the Raspberry Pi. They are used to hook up different electronic input output objects like buttons, switches, lights, etc. and can then be programmed to do just about anything. If you inspected the pbooth.py file earlier you might have noticed that the code designates the BUTTON pin as 26. Since they aren't labeled on the Raspberry Pi, refer to a schematic of the designated numbers.
  • How to Create a Photo Booth with the Raspberry Pi
    Hook up a jumper wire to pin 26.Use another colored jumper wire and hook it up to a ground pin. There is actually a ground pin right next to pin 26 on the last pin in the same row. As shown in the image, a red jumper wire is hooked to pin 26 and a black jumper wire is hooked to ground.
  • How to Create a Photo Booth with the Raspberry Pi
    Plug the jumper wires into a breadboard.Breadboards can make it much easier to wire circuits up without electrical tape or a soldering iron and are ideal for testing if you have everything wired up correctly. Plug the jumper wire connected to the ground into the (-) negative track, and plug the jumper wire connected to the button pin into the (+) positive track. As shown in the image, the red wire (connected to pin 26) is plugged into the positive track and the black wire (connected to ground) is plugged into the negative track.
  • How to Create a Photo Booth with the Raspberry Pi
    Plug two lengths of hook-up wire into the breadboard.With a wire stripper, strip both ends of two different color wires. Plug one side of each wire into the corresponding track of the breadboard. As pictured, a red hook-up wire is plugged into the positive track of the breadboard and a white wire is plugged into the negative track of the breadboard.
  • How to Create a Photo Booth with the Raspberry Pi
    Connect the corresponding hook-up wires to the positive and negative contacts of the button.
  • Plug the power back in to the Raspberry Pi and start it up.
  • Test it out!Check to see if all the elements are working. In a new terminal window type:

    /usr/local/src/boothy/run.sh

    and pressEnter. The camera preview will start up and you will see a number counting down. Get ready to smile! It will take 3 pictures and print the resulting photo set. When it says "Press red button to begin!" it should repeat the entire process the instant the red button is pressed! Congratulations, you made a photo booth!
  • Close the photo booth program.When you are ready to end the photo booth program, simply pressCtrl+C. This will end the program abruptly and take you back to the terminal window. Then pressCtrl+Dto return back to the normal command prompt line.

Customize Further

  • How to Create a Photo Booth with the Raspberry Pi
    Edit the python code.If you want to further customize the program, you can edit the file pbooth.py in the python editor. Open a new file manager window and navigate to the boothy directory. Double click on the file pbooth.py. This should open the pbooth.py code in the python editor.
  • Save a backup!Click on "File" and the select "Save As" and save a new file called "pbooth.py.bak" as a backup file in case you change anything that will cause the python code not to work. If that does happen, simply delete the ".bak" extension from the file and overwrite the broken file with it. This way you can feel safe experimenting with learning what each part of the code does!
  • How to Create a Photo Booth with the Raspberry Pi
    Customize the python code.If you inspect the code a little closer, you'll see there are some variables and terms that are defined near the top that make it a little easier to customize this to your needs.
    IMG1="1.jpg"IMG2="2.jpg"IMG3="3.jpg"CurrentWorkingDir="/usr/local/src/boothy"IMG4="4logo.png"logDir="logs"archiveDir="photos"SCREEN_WIDTH=640SCREEN_HEIGHT=480IMAGE_WIDTH=640IMAGE_HEIGHT=480BUTTON_PIN=26LED_PIN=19#connected to external 12v.PHOTO_DELAY=8

    Some suggestions and tips:

    • Changing the values ofSCREEN_WIDTHandSCREEN_HEIGHTwill determine the screen size the camera preview displays at. You can change this to match the resolution of the screen you will be using for your photobooth, however changing this may result in off center titles for the text when the program is running. Those too can be changed but are more spread throughout the code so are harder to change.
    • If you are printing 4x6 sized prints, changing the values ofIMAGE_WIDTHandIMAGE_HEIGHTto 640 and 425 respectively, utilizes the page space more effectively.
    • Changing the value ofPHOTO_DELAYwhich will determine how many seconds the timer counts down before each picture in a series.
    • Change or replace the 4logo.png in the boothy directory to something that is personalized for your event or celebration.
  • Build an enclosure!There are lots of creative ways you could display your working photo booth and lots of examples on the internet of various installations people have made. Get creative and have fun!

Things You'll Need

  • Raspberry Pi (2B or later)
  • Raspberry Pi Camera Module (v2 recommended)
  • HDMI Monitor/TV
  • Photo Printer
  • LED Pushbutton
  • Hookup Wire
  • Wire Strippers
  • Breadboard
  • Jumper Wires
Tags:
What Others Are Reading