
Photo by Hep Svadja
Everybody loves clowning in a digital photo booth at parties and weddings, then sharing the photos online. But who wants to risk a laptop getting doused with margaritas or champagne?

Read articles from the magazine right here on Make:. Don’t have a subscription yet? Get one today. On the cover: NASA’s JPL is using VR tech to create the next Mars rover. Illustration by Viktor Koen.
These days, cheap single-board computers make it easy to roll your own standalone photo booth that can connect to the internet with no help from your precious PC. Here’s a simple build that’s based on the Raspberry Pi mini computer and Pi Camera Module. It’s touchscreen-controlled by partygoers, and it automatically emails your photos (if you wish) and uploads them to Google Photos where anyone with the password can see and share. All the software is open source.
Our gang at WyoLum originally made a Raspberry Pi photo booth to write custom images for E Ink badges at the Open Hardware Summit in 2013, pairing the Pi with our popular AlaMode Arduino-compatible development board. The touchscreen display we used (also used in the “PiPad” tablet in Make: Volume 38) was nice, but expensive. Since then, the official Raspberry Pi Touchscreen has been released, and the new Raspberry Pi Model 3 has integrated Wi-Fi. Perfect for this project!
So we redesigned our OpenSelfie photo booth as the TouchSelfie, and tied it all together with a minimal set of mounting brackets you can 3D print (or laser-cut) to mount the whole thing on a tripod. You can also design and build your own amusing enclosure if you prefer.
Build Your Touchscreen Wi-Fi Photo Booth
First you’ll set up the Pi with the right software, then connect all the hardware. I like to use a wireless keyboard for setup, but you can use a wired keyboard, or after initial configuration, you can use SSH.
1. Configure the Pi’s operating system
If this is your first Pi project, follow Raspberry Pi’s Quick Start Guide. You’ll need to download the latest version of Raspbian, the official Linux operating system for Raspberry Pi.
Then copy the Raspbian-Jessie.img file onto your SD card (Figure A), using Apple Pi Baker (Mac) or Win32DiskImager (PC).

Figure A
Place the SD card in your Pi, and plug the Pi into a monitor and keyboard. Plug in your camera module too (you’ll connect the touchscreen later).
Now power up the Pi, open Terminal, and run the command:
sudo raspi-config
Follow the Setup Options (Figure B) to: a) Expand Filesystem, b) Enable Camera, c) Change User Password, and d) set your Internationalization Options (locale/time zone). Now reboot the Pi.

Figure B
2. Install the requiredplatforms on the Pi
Connect the Pi to your network (Wi-Fi or Ethernet) and type the following commands:
sudo apt-get update
sudo apt-get install python-imaging
sudo apt-get install python-gdata
sudo apt-get install python-imaging-tk
sudo pip install --upgrade google-api-python-client
sudo apt-get install luakit
sudo update-alternatives --config x-www-browser
This will provide you with a menu of browsers to pick as the default; set it to luakit.
NOTE: We’re using luakit because Raspbian’s default browser doesn’t work with Google 2-part authentication.
3. Download the TouchSelfie scripts
Still in Terminal, run:
mkdir git
cd git
git clone https://github.com/wyolum/TouchSelfie
NOTE: Be sure that for the following steps you’re continuing to use the web browser on your Raspberry Pi / monitor setup.
4. Set up your Google Photos album
Go to Google and create a Google account (or use your own account if you have one already). Then go to Google Photos and create a new Album. You’ll have to upload at least one photo to create it (Figure C).

Figure C
5. Get an app-specific password
Visit your Account Security Settings and enable 2-Step Verification. Then return to the same page and click on “App passwords” to generate a 16-character application password (Figure D). Write it down in a safe place. You’ll use it later to connect your photo booth to Google Photos.

Figure D
NOTE: If you lose the app password or forget it, don’t worry; you’ll just have to generate a new one.
6. Create API keys with Google Developer
While logged in to your account, visit Google’s Developers Console. Click on Select a project → Create a project, and name it whatever you’d like (Figure E).

Figure E
While your new project is selected, click on Credentials on the left menu, and then select the “OAuth consent screen” tab. You’ll need to create a “Product name shown to users,” which can be anything you’d like (Figure F).

Figure F
Now select the Credentials tab, select “OAuth client ID,” and click the “Create credentials” pulldown. Select “Other” for Application type, name it “Installed,” and click Create (Figure G).

Figure G
NOTE: You don’t have to explicitly enable any additional APIs; here you’re dealing with basic authentication and authorization which is used by every API, and the photo APIs haven’t been explicitly added to the console.
Now you’ll be able to see it in your list of credentials for this app. Select the “Installed” credential. Click the Download JSON button, and a file named something like client_secret_90328409238409238xxxxx.json should download to your computer (Figure H).

Figure H
Once it’s completed downloading, rename the file OpenSelfie.json (Figure I), then drag and drop it into the /home/pi/git/TouchSelfie/scripts directory.
7. Connect TouchSelfie to Google Photos
If you haven’t already, connect the camera board to the Pi. Power up the Pi, open Terminal, and run:
cd /home/pi/git/TouchSelfie/scripts
python ./photobooth_gui.py
Since this is your first time running the photo booth interface (GUI), it doesn’t yet have the proper credentials to connect to your Google account. Your web browser will pop up; sign in to Google (with the same email address and password you used to configure everything in the previous steps), and then it will ask you whether your Pi photo booth can manipulate your photos (Figure J).

Figure J
Click on Allow, and then it will display a long string of numbers and letters. Copy this string and paste it into the Terminal window after the prompt that says “Enter the Authentication Code” (Figure K). Hit Enter, and if all is well your photo booth will snap a photo and upload it to the album you have previously configured! (Or fail if you haven’t set it yet.)

Figure K
An Album ID error will pop up, indicating that you have not yet selected an album in your Google photos account to send your photos to. Click the “Customize” button in the upper left corner of the display (Figure L).

Figure L
Click the “Lookup” button beside the “albumID” label to pull up the album lookup dialog (Figure M). It might take a few seconds for the dialog to appear. If you are logged into your Google account, all of your albums should be queried into the selection list. Select the album you wish to send your photos to.

Figure M
When you see the album that you’d like, click on it in the list menu, then click the “Select” button on the top of the window (Figure N).

Figure N
The album ID will automatically be put in the correct box on the customize screen. Click the “Save” button to save your new configuration (Figure O).

Figure O
Fortunately, you only have to do this once! After this it will remember the credentials and periodically refresh them. The cached credentials are stored in a file called credentials.dat, so if you delete it, you’ll have to do the web dance again, as long as your JSON file is still there.
TROUBLESHOOTING TIPS
If you get an error that says “cannot connect to Google Account,” it’s probably because Google periodically invalidates the credentials. To refresh them, try the following:
» Double-check that you’re connected to the internet
» Remove the file credentials.dat from the scripts file folder
» Run: cd /home/pi/git/TouchSelfie/scripts
» Run: python ./photobooth_gui.py
» Allow access to Google Photos
» Re-enter credentials in Terminal window
8. Customize messages and logos
While you’re still in openselfie.conf (or the GUI configuration screen) you can also create a customized message for your event. Just edit the text shown in italics here:
emailsubject = Subject line of your email
emailmsg = Message that accompanies email
photo caption = Photo caption on Google Photos account
logopng = logo.png
albumid = XXXXXXXXXX
To customize the logo that’s stamped on each photo, just save a new PNG file (1366×235 pixels, with transparency if you wish) in the folder /pi/git/TouchSelfie/scripts. Then run the photo booth again (photobooth_gui.py) and click the Customize button. In the pop-up window, next to “Logo File” click the Browse button. Select your file, and click Open. You should see a preview of your new logo. When you’re done, click Done (Figure P).

Figure P
9. Enable Fullscreen and Touchscreen Keyboard
Reopen the photobooth_gui.py file and remove the # symbol from the beginning of the line #root.attributes(“-fullscreen”,True). Now the photo booth interface can run fullscreen on the Touch Display.
Once you connect your Pi 3 to the touchscreen, you won’t want to be lugging around your USB keyboard to type commands. To install a touchscreen keyboard on your Pi, follow these step-by-step instructions by ModMyPi.
10. Make the mounting brackets (optional)
We created simple brackets you can 3D print for standing your photo booth on a tabletop or mounting it on a standard tripod (Figure Q). You can also laser-cut the camera mount from 1/16″ acrylic if you prefer that look, but the 3D-printed version seems to hold up longer.

Figure Q
» Tabletop mount Print the files camera_mount.stl and PiTouchScreenStand.stl, found on the WyoLum GitHub. This requires using two M2.5×14mm and two M2.5×16mm screws.
» Tripod mount Jenny Ching at Make: created an updated version of our tripod mount that’s a great improvement. Print the files PiTouchScreenMount.stl and PiCameraMount.stl. and use 10mm and 6mm M2.5 screws instead.
11. Assemble your photo booth
Fasten the Pi 3 and the Touch Display together using the included screws and standoffs. Connect the touchscreen’s ribbon cable to the Pi headers marked “Display.” Use a red jumper wire to connect the touchscreen’s 5V pin to the Pi’s GPIO pin 2. Use a black wire to connect touchscreen GND to Pi GPIO pin 6 (Figures R and S).

Figure R. Step shots by Jenny Ching

Figure S
Thread the camera’s ribbon cable through the slot in the camera mount. Plug it into the camera, and affix the camera to the mount with the M2 screws (Figures T and U) or double-stick tape. Plug the camera cable into the Pi (Figure V).

Figure T

Figure U

Figure V
Fasten the tripod stand to the touchscreen with M2.5×6mm screws (Figure W) through the 2 bottom holes. Then fasten the camera mount using M2.5×10mm screws through the top holes in the stand (Figure X).

Figure W

Figure X
Next, press-fit the ¼-20 hex nut tightly into the stand’s base and mount it to any standard camera tripod (Figure Y).

Figure Y
Finally, connect the Pi 3 to the wall charger or a portable battery pack using the Micro-USB cable. Your photo booth is complete!
NOTE: The portable battery must be able to output 2A at 5V to power both the touchscreen and Pi. It should also be rated at least 10,000mAh to last through a long party or event.
Strike a Pose
Your Raspberry Pi Photo Booth is ready for all manner of festivities. Here’s how to use it.
START UP
Open Terminal and run:
cd /home/pi/git/TouchSelfie/scripts
python ./photobooth_gui.py
When the photo booth launches, it will automatically take a photo and upload to Google Photos, to check that everything’s working. (If not, you probably just need to refresh the credentials — see “Troubleshooting Tips” above.)
Take and Send Photos
To take a photo, tap the touchscreen anywhere on the image. The photo booth will count down from 5 and then snap the picture (Figure Z). Then it will automatically upload the photo to Google Photos on your Google account (Figure AA).

Figure Z

Figure AA
If you want to email the photo too, touch the white box next to the Send Email button. The touchscreen keyboard will pop up. Enter an email address, press the Close KB button to close out of the keyboard, then press Send Email to send the current photo to that address (Figure AB).

Figure AB
Touch the screen again to initiate the next photo. And so on.
When your party is all said and done, log into your Google account and view all your party photos in Google Photos!
Customize Messages
You can also edit the photobooth_gui.py script to display different on-screen messages during your party. For example, we uncommented line 165 (remove the # symbol from #can.create_text) and edited it to prompt users “Tap here when ready” — but this could say anything you like!
Build Your Own Enclosure
Our 3D-printed mounts are very handy, but you might prefer to build a fun enclosure to house your new Raspberry Pi photo booth! To help you design it, you can grab dimension drawings of the Touch Display and the Camera Module from the Raspberry Pi site. Jenny Ching at the Make: Labs built an awesome jumbo SLR-style enclosure for our photo booth, using ¼” plywood and round gift boxes from The Container Store.
More Fun Enhancements
Of course you’ll want to have props and masks handy, but why not take it further? You could add your own lighting effects, modify the code to take multiple pictures in a row, or even add face detection. We’re excited to see where you’ll take this project.
nice!
can we change the image quality?
<< my room mate Mary Is getting paid on the internet $98/hr"…..!k375n:
two days ago grey McLaren. P1 I bought after earning 18,512 Dollars..it was my previous month's payout..just a little over.17k Dollars Last month..3-5 hours job a day…with weekly payouts..it's realy the simplest. job I have ever Do.. I Joined This 7 months. ago. and now making over hourly. 87 Dollars…Learn. More right Here
!k375n:
➽:➽:.
➽.➽.➽.➽ http://GlobalSuperJobsReportsEmploymentsPhaseGetPay$98Hour…..
★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹:★✹::::::!k375n….,….j.
Is it possible to add the email to a database once they’ve sent themselves a photo?
Thanks
Matt
https://github.com/wyolum/TouchSelfie/blob/master/scripts/email_logger.py
It has the basic capability of logging the email address to a file, you just need to set the filename in here
Cheers
Seems to Log automatically to the EMAIL.LOG file in the scripts directory
Very Nice. Only thing I can thing of would be to add a output to turn on (or up) an external light when the photo is triggered
It looks like there is code in there to do enable LEDs, but, I don’t really understand how to hook up the trigger from the pi to lights.
The LEDs looked like an incomplete or partially feature. I think if you go the picamera firmware route, you don’t need to change the app at all. However, I had added the GPIO.output(18, GPIO.HIGH/LOW) calls before and after the camera.capture calls before I learned about that approach. For me, pin 18 is hooked to an optoisolator and then to an HBridge to drive some LEDs from a non-functioning LED light bulb.
Steve,
Is there any way that you could share the plans and materials used to add the LED lighting? Thanks!
I don’t have a drawing and your supplies will likely vary, but here it is in a nutshell. I had a “dead” 9W LED par20 bulb that I liked the look of. I was able to remove the AC/DC circuit and found the three white LEDs to be working. Working backward from there, I found I could power them through a L293D (quad h-bridge). That’s 600ma per channel but I use all 4 in parallel. Add a big fat resistor in series with the bulb to limit the current. The value you use will depend on the voltage of your flash power supply. I use a separate 12V power supply for the flash. Pick a value that doesn’t overload the L293 (say no more than 1.5A). If the L293 gets hot, that’s probably too much and it won’t work long. For an extra margin of error, I added a heat sink (superglued it to a scrap of metal) AND, being a flash, the LEDs are not lit for long period of time. The flash is not as bright as the original bulb but it does fill in the shadows and adds to the effect. Given you have a different voltage, you want to be careful to protect the pi. That’s where the optocoupler comes in. It physically separates the logic circuit(pi) from the high power/voltage flash circuit. You can use a common ground; I didn’t. I used a PC123 but they fairly similar so buy one or steal one from some old circuit board (it probably be the only 4 pin IC you’ll see and will often have a dashed line running through it). To the PI, it is a small LED. It needs a current limiting resistor in series (~130 ohm). To the L293, it’ll be a switch. When the LED is on, the switch closes and enables the L293. A high valued resistor will pull the voltage back to ground when the switch opens and the L293 will stop driving the outputs. Note that you need to enable both sides and bring all four inputs HIGH on the L293. You can permanently enable the L293 if you wish. Create your flash circuit and test it it by hooking the input to the optocoupler to 3.3v. If this works reliably, you’re ready to connect it to a GPIO pin of your pi. Hope that helps.
you can ‘enable flash’ via picamera firmware (or blob?) this is sent to gpio 17, then you can add a relay to an extrernal flash. Im not sure where to add the ‘enable flash’ in the picamera script though????
http://picamera.readthedocs.io/en/release-1.10/recipes2.html
Thanks for a great project,setup works great except i’m unable to send emails from the photobooth,any suggestions would be greatly appreciated.
Have you tried running apt-get install for a message transfer agent? I’m not super familiar with it, but I think there needs to be an dependency installed before the Pi can send emails…
http://www.sbprojects.com/projects/raspberrypi/exim4.php
I have to admit I am still having this issues as well. I’ve logged into Gmail on the pi and sent email through the web interface. Gone through the Google troubleshooting for this issue. All before and after installing the ssmpt agent. (it appeard to be there already. But no change. Disabled two step verification and allowed lower security apps. None of which has modified the error message at all. I’m going to start again with a fresh Raspbian image. But I’m open to other suggestions if anyone has them.
I’m having a similar problem — in Terminal, I get the error: “Send Failed:: (535, ‘5.7.8 https://support.google.com/mail/answer/14257 c13sm1165635pfc.40 – gsmtp’) where the string before gsmtp changes each time
I am having the same issue. I took the whole process from the top, thinking I messed up somewhere – but same results.
I pinged them on Twitter.
redo the google api download
sudo pip install –upgrade google-api-python-client
delete the credentials.dat and do the troubleshooting section….
This got me going…
Still getting “Send Failed:: (534, ‘5.7.9 Application-specific password required. Learn more atn5.6.9 https://support.google.com/account5/answer/185833…”
The photos post to google photo with no issue.
Got it. I must have made a typo when I put the app password in.
I also pulled the latest commit they on GIT.
Hello! Where do I put the app password? Deleting Credentials.dat did only ask the generated key which I copypasted… no help on email sending, the upload to google photos works fb.
Generate an app password:
https://support.google.com/accounts/answer/185833?hl=en
Edit the “.credentials” file – first line is your google acct name/gmail address. second line is the generated app password
could you help with this I am having the same issue
same issue did you resolve?
frustrating I am having send issues as well
I keep replying but my comments keep disappearing I am having same issue. Help!
How would you modify the code to take more than one picture at a time? Like this:
3…2…..1.. *picture*;
3….2…..1..*2nd picture*;
3….2….1..*3rd picture;
Merge them into a single photo and upload them to the cloud. Thanks!
I basically earn close to 6000-8000 bucks /every month working online. For anyone prepared to complete basic at home jobs for several h each day from your living room and make decent payment for doing it… This is a job for you… http://self90.com
Good news… this is supported. The quick fix is to change the command to “snap()” on about line 168 of photobooth_gui.py:
was:
im = snap(can, countdown1=countdown1, effect=’None’)
new:
im = snap(can, countdown1=countdown1, effect=’Four’)
does this merge them into one photo?
yes
does this merge them into one image?
I found the code boothcam.py about line 99. there is a cmd that seems to set the variable:
def snap(can, countdown1, effect=’None’):
global image_idx
Then there are elifs to determine how the variable effect has:
if effect == ‘None’:
camera.capture(custom.RAW_FILENAME, resize=(1366, 768))
snapshot = Image.open(custom.RAW_FILENAME)
elif effect == ‘Warhol’:
# set light to R, take photo, G, take photo, B, take photo, Y, take photo
# merge results into one image
elif effect == “Four”:
# take 4 photos and merge into one image.
when I change the line to def snap(can, countdown1, effect=’Four’):
It seems to still be doing the NONE option.
I have tried to delete the boothcam.pyc file and then running the program again but that didn’t work.
Ideas would be appreciated.
Tim Cahoon
After staring at this for a week, I may have figured it out. In photobooth.py about line 253 there is this line.
effect_var.set(‘None’)
I believe this is where you change None to Warhol or Four depending on effect you want.
Will test it tonight
Good job Tim. If that does not work, you can always remove the “elif” chain and just leave the case you’d like to run.
Tim where is photobooth.py located. I cannot find it under scripts.
When I try to download the JSON file, luakit crashes with the following message: (luakit:1147): Glib-GObject-CRITICAL **: g_object_get: assertion ‘G_IS_OBJECT (object)’ failed
Segmentation fault
Any idea what might be causing this?
Any one else run into same issue and able to resolve without downloading file through SSH?
No, I just used the workaround like I described.
Yes, I switched the default browser to chromium and was able to download right on the pi.
Ok, got it to work by creating and downloading the JSON file using my laptop and uploading it to the Pi using SSH.
Just a question: would it be very hard to have the Pi save the pictures to a flash drive or external hard drive instead of uploading them to Google photos, whilst retaining the email function? It would mean sacrificing the option for downloading, but would make for a more stable/reliable system?
https://uploads.disquscdn.com/images/554d6ba6a368b3c4b0683dbe1c13ec526c916fc0c7d228bc07dc16e691fa7cf6.png
You can save photos to an archive in the customization dialog.
Ah, I missed that one, thanks!
Thank you for the workaround for the JSON file. I was having the same problem. I downloaded on my other PC and saved it to flash drive. then when I inserted it into the PI, I used filemanager to copy it to the right directory.
Has anyone tried to recreate the jumbo SLR styled enclosure as pictured in the article? I’m very new to woodworking, can someone suggest approximate dimensions for such a box and maybe a rough idea of how to construct it?
My dimensions are 24″ x 18″ x 6.5″. They were basically determined by the size of some thick black masonite I had lying around. It’s comically large and if I did it again, I might make it smaller for easier storage. As far as how to make it, google how to make a box with mitered edges. https://uploads.disquscdn.com/images/38d4c2fa759952214291829b40c667953ba7b6c15589d93268393855028637f5.jpg
This is AWESOME! I had a question though. I’ve been trying to see if i can implement a google photos AND tumblr upload
ala http://www.drumminhands.com/2014/06/15/raspberry-pi-photo-booth/
I haven’t had any luck. Can anyone help?
as far as i know there isnt a way of uploading to tumblr from google photos. The only work around i can see is to tranfer from Google photos to google drive and then run a ifttt recipe but i still havent figured it out yet. working on it……
I would love to build this, but I have a few questions. Total N00b here. Can the pictures be uploaded to a FB album I stead of or after being loaded to Google? Can an external trigger be added to activate the picture sequence or is touching the screen the only option? And could it trigger an external flash or light of some sort?
Great article, thanks for any help you can provide!
Any chance of letting me know what touchscreen monitor you used? Looked around but can’t seem to find one that looks like the one you used… and a detailed parts list would REALLY help… just sayin’…
EDIT: my ad blocker blocked the parts list on the right side of my browser… sorry… :(
My, what cheeky names for the script and album!
How about green background and automatic replacement with background photo?
anyone can help?
I got an error “No module named ImageTK”
Sudo raspi-config and enable the camera.
Just two more questions:
– Would it be possible to hide the “customize” button, so partygoers who had a little too much to drink aren’t able to change the settings?
– Would it be possible to add a default image that is displayed while the photobooth is not in use, instead of displaying the last picture that was taken?
Thanks again for a great project!
I just removed the buttons and added a test at the beginning of the sendPic method to check for two special emails addresses: “exit” and “customize”. Here’s what the beginning of sendPic looks like now. Search for Customize and comment out the button addition line.
def sendPic(*args):
if email_addr.get() == “exit”:
if root.after_id is not None:
root.after_cancel(root.after_id)
root.quit()
elif email_addr.get() == “customize”:
custom.customize(root).pack(side=LEFT)
elif signed_in:
*Discus removed the indentation but you can figure it out
I cant get the customize portion of this to work, any advice?
You got to give people a little more to go on when requesting help. For instance, you might say, ‘I can’t seem to hide the Customize button’ or ‘I changed the sendPic method but it doesn’t respond to the word customize’ or ‘the code fails with error xyz’.
My apologies,
So after I added the code and fixed the indentation, I also commented out the button, per your first post. Whenever I type “customize” into the email bar, it still assumes it is an email and can’t send the email. The exit portion works correctly.
I suspect the “elif email_addr.get() == “customize”:” is indented too far…it should be at the same indentation as the “ext” if line.
Thank you so much. That fixed it. Would you happen to know how to take out the logo all together? I tried to just blank out the logo in the customize option and the picture does not show up after it is taken. It just shows the background without the camera feed.
I keep getting an error when I try to send the photo via email. It says username and password not accepted. I’m confused about step 5 / figure D. I wrote down the password that I generated, but never used it anywhere. I am connected to my Google account because it is saving the photos to the album I created. Any help would be appreciated,
I have the same problem!
any luck? Having the same issue
The google app password is used when you first run the script – use the generated app password not your usual “google password”.
I do now know of any other way to get the app password prompt to come up besides starting over.
same problem did you resolve?
Two things…
(1) we want to adapt the tripod mount, but editing an STL file is not easy! Any chance of getting an editable source file of Jenny’s mount? (Our printer can’t print that flat without supports, so turns a 2 hr print into a 7 hour print), and we’d rather widen/thicken the “plate” that fits on to the tripod.
(2) we would also like to process out a green screen. (But due to time constraints, we’ll “do that in post”!)
Thanks for a quick project to add to our area at Calgary Mini Maker Faire!
I have had a tough time finding the screws for this project.
Any links?
I got them at my local Ace.
How could I add code to this so that the photos would print to a printer? I have a canon selphy that I am trying to add to this project. Thanks!