A DIY photo booth for events that takes photos and uploads an animated gif to a Tumblr account.
Now Version 3.0
I recently updated this tutorial and code for a new version. It’s simpler and works more efficiently. Also, I added an optional second raspberry pi connected to a projector showing the event’s images.
If you are just looking for the nitty gritty, consider looking at the code on GitHub, the how to photos on Flickr, and the results on Tumblr. You will also need picamera, pyTumblr, and GraphicsMagick. Be sure to have a strong connection to the internet (wired is best) and good lighting. Set yourself up for success with the photos and posting.
This post begins with a story. My wife started grad school in the Fall of 2012 at the Cooperstown Graduate Program. We moved to Cooperstown, NY in the summer of 2012. Given the two-year program, it gave me a two-year duration for a photo project. I decided to use the iPhone app PocketBooth to take photo strips of people that we would meet in those two years. Of course this was before the word “selfie” was used all the time. It turned into a fun project. I printed the strips and hung them in our house as the number grew. Then, on the night of graduation, I brought the exhibit to their reception. It went over very well. I then posted the photos online on Flickr.
Overall I was happy with the project. I was constantly surprised at how easy it was to get people to smile and let loose in front of a camera when it’s a photo booth. However, the overall project was very time intensive. I had to take my phone out of my pocket, open the app, take the photo strips, save the strips to my computer, print out the strips, cut the strips, and then hang them on the exhibit. Part of the beauty of the original photo booths is they were automated.
So then I decided to make an automated photo booth for my wife’s graduation reception—a bit of a guerrilla exhibit. It sounded like fun. I had been playing around with the Raspberry Pi for a bit, so this seemed like a great use for the camera module.
So the goal was to make an easy to use photo booth for guests at an event. Then turn the photos into an animated gif and automatically post it online for easy sharing.
I began with a notebook sketch of the idea, algorithm, and construction. See here. Then I researched other photo booths out there for inspiration. Then I started wiring, coding, and testing. Once I had the parts working, then I built the enclosure.
Here is the basic algorithm:
- Set the device on top of a camera tripod and point it at a good location for guests to stand
- Make sure there will be good lighting on the guests
- Power up the device
- Light up all the lights on the front for a bit to show that it’s running, then turn them off
- Await a button press
- Big button press
- Once the button is pressed, blink the first light for a few seconds, telling the guests to get ready
- Show the real time video preview on the screen
- Take four pictures
- Light up the “Pose” light (Note, in later versions, I removed the LEDs for the steps. It was a better user experience to just put images on the screen for the steps.)
- Take a photo and save as a .jpg with a time stamp in the filename
- Repeat four times
- Process the images
- Turn off the preview monitor
- Blink the “Uploading” light
- Combine the four jpgs into a new animated gif (consider adding a footer to all the pics)
- Upload to Tumblr (since Tumblr natively handles animated gifs)
- Stop blinking the light
- Light the “Done” light for a few seconds
- Replay the images on the screen a few times for instant gratification of the guests
- Await another button press
- Have another button in the system, and if it is pressed shutdown the Raspberry Pi safely. Light all the LEDs first as a clue to when it’s safe to turn off the system. (Note, I removed the second button. It was working inconsistently. And adding keyboard interrupts was a lot easier to use when coding. It may be a bad habit to just turn off the raspberry pi instead of a proper shut down. But I have yet to have a corrupted card. Cross my fingers I don’t have problems. If you’re worried, just plug in a keyboard, hit escape to exit pygame, hit ctrl-c to exit python, and then type sudo halt to shutdown.)
Here is a basic parts list without the enclosure:
- Raspberry Pi computer ~$40
- The newer pi’s work just fine too.
- Raspberry Pi camera module ~$30
- I’m using a version 1 camera, but newer versions work as well.
- SD Card
- I used a 32 GB card with a decent read/write speed
- But an old camera card at least 8GB should be fine
- 5V Power adapter with USB A to Micro B cable ~$10
- 7 inch monitor
- Video cable
- Video power adapter
- You’ll need one unless it’s included in your monitor purchase. I used a variable adapter set to 12v that I had sitting around.
- A standard USB keyboard you have laying around is just fine. You’ll only need it during configuration, not during usage.
- I use at wireless keyboard/mouse combo, which is nice to leave plugged in even during operation at an event.
- A standard USB mouse is fine, as you’ll just need it during configuration.
- An arcade button. I used one with a built in 5V LED ~$2
- GPIO cables ~$10
- Used to connect the GPIO pins to the button
- A tripod mount
- Originally I made one to fit my camera tripod, but it was a little too shaky.
- On the latest version, I used a PA system tripod mount. It’s much more stable.
Here is an optional parts list, some things that are really nice to add:
- WiFi adapter ~$12
- TTL cable ~$10
- If you want to trouble-shoot at an event, these make it really easy to use your laptop to change things on the pi. See these instructions.
- If you want to modify the circuit design at all, a Pi Cobbler, solderless breadboard, and jumper wires
- USB power panel mount ~$4
- It’s nice in the finished product to unplug the power and not have to reach into the enclosure. This is used to power the Raspberry Pi. If you use it, then you’ll also need a standard USB A to B cable. You probably have one sitting around.
- Ethernet panel mount ~$5
- If you’re using a wired connection, which is nice for speed and reliability, then this makes it much easier to connect in the final enclosure. You’ll also need a longer Cat 5 or Cat 6 cable.
- DC power jack ~$4
- USB port panel mount ~$4
- I didn’t add this, but I wish I did. It would make it easier to troubleshoot without having to open the case.
- Extension cable for the camera module ~$5
Setup the Raspberry Pi
Install noobs on the SD card.
I’d recommend doing most of the configuration using a large external monitor. When you’re ready to move to the small screen, note that I ran into errors getting the composite video working. I found that I needed to edit a config file.
sudo nano /boot/config.txt
Comment out the line
I ended up figuring out some other settings to get the video looking decent on the low resolution monitor.
start_x=1 gpu_mem=128 framebuffer_width=800 framebuffer_height=480 sdtv_aspect=3 disable_camera_led=1
If you haven’t already, setup the Raspberry Pi to automatically boot into the GUI desktop.
Disable the screensaver by editing the GUI session autostart.
sudo nano ~/.config/lxsession/LXDE-pi/autostart
Make sure the following is in the autostart file:
@xset s 0 0 @xset s noblank @xset s noexpose @xset dpms 0 0 0
GPIO, LEDs, and Buttons
One of the cool things about the Raspberry Pi is you can wire your own inputs and outputs. This is all done through the GPIO. I first worked out the circuit using a solderless breadboard. You can see the wiring diagram below. Then I got my wire cutters, soldering iron, and heat shrink tubing out. I used the gpio cables to connect to the button.
First, with the system turned off, plug-in the camera. Then boot it back up. You’ll need to follow the initial setup instructions.
Creating the Animated Gif
I first tried ImageMagick, but had some issues with the jpg delegate. I then used GraphicsMagick instead. It works great. Read the installation instruction here for Unix. But the following should work.
sudo apt-get install graphicsmagick
Once GraphicsMagick is installed, you can test it with the following code. It will combine all the jpgs in the current directory.
gm convert -delay 100 *.jpg joined.gif
Uploading to Tumblr
To install pytumblr, follow these steps:
- If it is not installed on the pi, install PIP somewhere on your pi
- In the terminal, navigate to the pip folder you downloaded and moved to the pi. Then run the following code:
sudo python get-pip.py
- Download pytumblr and copy the files somewhere on your pi. For instance, in the command line, you could navigate to your chosen file and then type:
- In the terminal, navigate to pytumblr-master folder (you un-zipped the downloaded file, right?) and run this command to install:
sudo python setup.py install
The Final Code
You can download the code at GitHub. If you have not used GitHub before, check out this link. There are a few values for variables that you will need to replace with your special information. Save the code wherever you want. I put it in the folder named /home/pi/photobooth/. If you are not comfortable using the command line, learn more here.
After getting the photobooth code on your Raspberry Pi, set it to automatically run the python code at startup.
sudo nano /etc/xdg/autostart/myscript.desktop
And save something like the following:
[Desktop Entry] Type=Application Name=drumminhands_photobooth.py Comment=Start my script NoDisplay=false Exec=sudo python /home/pi/photobooth/drumminhands_photobooth.py NotShowIn=GNOME;KDE;XFCE; Name[en_US]= drumminhands_photobooth.py
I found I need sudo at the beginning, otherwise the GPIO buttons and lights don’t work.
In the first versions, I built my own case out of wood. They were a little rough as I’m still working on my carpentry skills. I did laser cut the front and back plates.
In the latest version, I decided to re-use some existing items to make a cooler looking case. I found a small brief case at an antique shop. It was originally used for holding silverware. Then I also re-purposed an old camera I had. I took off the front plate and the lens. I used an existing hole in the front plate for the new LED arcade button.
- It works best with internet access. When the users can instantly use their phone to share photos from Tumblr, it’s an overall better user experience.
- Use wired access if possible. Wireless is sometimes flaky. And using a mobile hotspot is even more sketchy. Without a good internet connection, the experience is a little bit of a drag.
- There is an option to not upload during the event. The replay of pics on the photo booth does give the immediate gratification to the users who just had their photos taken. But it does not show the rest of the guests, nor friends not at the event. I did recently build another tutorial to have a second raspberry pi showing a slideshow of photos. That’s a good second if you don’t have internet access. And I also built a batch upload script if you want to put photos on Tumblr after the event.
- Use LOTS of light. I mean LOTS. Set yourself up for success. Also, look into upping the ISO on the camera if you know light will be poor. At the last event I used this at, some of the photos were taken just before sunset. The ambient light combined with overhead shop lights made much sharper images. At night, with only the shop lights, there were still lots of blurry photos.
- Consider the height of your audience. For many adult audiences, this works quite well on a strong tripod. But kids and other shorter individuals have a tough time getting their faces into the frame without a step, bench, or ramp. At the last event, I tried using a loveseat and lowering the camera. It worked fairly well, but when people were seated, they could not reach the button. If they stand, then they can step backward after hitting the button before the first shot.
- I might look into using a version of Linux that boots up faster. If the pi looses power during the event, you need to explain what is happening during the reboot.
- I might build a better power circuit so that there is only one power adapter.
See my final pics here: drumminhands.tumblr.com. If you build one, post your link in the comments below. If you have any questions about this, also post in the comments below. Have fun with it.
And if you make one similar, please send me photos or post them in the comments below. I’d love to see other iterations in use.
See what other folks have done:
- St. Louis Science Center had their ScienceTechGirls make one.
- @jspotproduction made one with a great CNC enclosure.
- @CongoJoe made one for a wedding.
- Here’s another.
Some folks have been talking about this project. Here are a few. If you have a post about the project, please let me know and I’ll add it here.