If you’ve attended a special event recently – events like corporate parties, fundraisers, or weddings – you’ve probably had the opportunity to use a photo booth. Photo booths have been around for more than a century now, but have only recently become popular at parties and events in the last decade. As December rolled around last year, we at TWG experimented with the idea of a photo booth to create something special for our own holiday party. The result was our .gif booth.
Our .gif booth acts like a regular photo booth – it has a camera, a button, and a printer – but does so much more. Every video taken with the booth is instantly posted online, and each visitor receives a charmingly low-fi printout with their photos and a link to share their video.
Creating our Version One
Traditional photo booths are large, physical and tactile objects; literally booths that you can sit in to have your photo taken. When building the .gif booth, we wanted to allow for more freedom and flexibility, while keeping the simple tactile and physical user experience. Instead of building a full booth, we included only the core components: a camera, a button, and a printer.
To join together all of the components we needed, we initially used a Raspberry Pi – the dirt-cheap computer the size of a credit card. The general-purpose input/output pins available on the Pi allowed us to connect a large green button and blinking LED, giving us the physical and tactile interface we wanted. We used the Pi’s USB ports to connect to a cheap Epson TM20-II thermal receipt printer and a Canon T3i DSLR, then wrote a small amount of software in Python to glue everything together.
In software, we then used gphoto2 to instruct our camera to take a 4-second video every time the large green button was pressed. This video was then uploaded to a cloud server, where a small Node.js app transcoded the video into a small MP4 and uploaded it to S3. Finally, this same Node.js app composited frames from the video into a black-and-white image, then converted this image into Epson’s ESCPOS format for easy printing. (We’ve since open-sourced the code we use to convert PNG to ESCPOS, in C, extremely quickly.) The Raspberry Pi takes this data and forwards it on directly to the printer, resulting in charming little receipts for attendees:
Building Version Two
After the success of version one of the .gif booth, we found that people wanted to use it at their own events. Broadening the scope of our installation required us to rethink a lot of the design decisions we had previously made.
Version one of the .gif booth offloaded all of the heavy computation – encoding of the video and creation of the receipt – to a cloud server. This was done to speed things up, as the Raspberry Pi isn’t very powerful, and TWG’s office has a fast internet connection. However, this method wouldn’t work very well without a strong internet connection. This prevented us from deploying the .gif booth at events without fast internet connections – or events without internet connections at all.
To circumvent this limitation, we needed to add a faster, more powerful processor to the project. Rather than replace our Raspberry Pi with a faster credit-card-sized computer (like the Beaglebone Black) we went all-out and replaced it with an iOS device. A modern iPhone or iPad is able to encode HD H.264 video in real time – while the Raspberry Pi can’t even come close. Adding a smartphone to the mix not only allowed us to encode video faster, but also gives us access to a high-quality HD camera and a built-in cellular data connection.
Integrating Raspberry Pi with iOS
After refitting the .gif booth to include an iOS device, we had one difficult problem left to solve. How do we connect the Raspberry Pi, which we still require to interface with our button and LED hardware, to our iOS device? A number of solutions were possible:
- Use Bluetooth to connect the Raspberry Pi to the iOS device. This turned out to be difficult, if not impossible. As many others online have discovered, the only reliable way to connect an iOS app with arbitrary Bluetooth devices is to use Bluetooth Low-Energy, which has very low data rates and is not very well supported on the Raspberry Pi.
- Use a serial connection between the Raspberry Pi and the iOS device. Serial cables exist for iOS, and are fairly easy to use – although the resulting app can’t be deployed to the App Store. Unfortunately, those cables don’t power the iOS device, forcing us to rely on battery power. (Also, the Raspberry Pi doesn’t have an RS232 port, but it’s not hard to add one with a few components.)
- Use Wi-Fi to connect the Raspberry Pi to the iOS device. This solution is the simplest from a hardware and software perspective. The Raspberry Pi works well with a number of third-party Wi-Fi adapters, and all iOS devices have strong support for Wi-Fi. In addition, iOS devices with cellular modems can easily be turned into Wi-Fi hotspots with their “Personal Hotspot” feature.
For version two of our .gif booth, we used Wi-Fi to connect our Raspberry Pi to our iOS device. Once both devices are connected to the same network, they discover each other by using zero-configuration networking – a standard implemented by Apple as Bonjour, and implemented on Linux by avahi. By setting up the avahi-daemon package on the Raspberry Pi and configuring it to broadcast a service (_button_server._tcp, in this case), the iOS app can listen for this service and connect to the Pi regardless of its IP address or hostname.
Our .gif booth has served us well so far, and has been a lot of fun at a number of parties and events. We’ve learned a lot while building it, and we’re still working to make it a more polished, and easy-to-use product. If you’re interested in trying it out, contact us and let us know – the .gif booth is available for rent for events of all kinds in the Toronto area!