Building a Photobooth with a DSLR and a Raspberry Pi

I had the idea to build a photobooth for my cousin’s wedding, which shouldn’t be too hard to do. I already knew libgphoto2 which can be used to control a DSLR via USB. My Canon EOS 600D is compatible and supports the Live view feature, which I wanted to use. My initial plan was using a Raspberry Pi (and the DSLR connected to it) with Flask displaying the live view on the webpage and controlling it from there. After reading a little bit about displaying the live preview on a website I came to the conclusion that I am way too lazy to try and get that working. My next and final plan was writing everything in C++ using Qt, there is a working integration of libgphoto2 into Qt Multimedia¬†which I was planning to use. The taken pictures should then be uploaded to a web app where the wedding guests would be able to download the full resoultion picture.

When using qtmultimedia-gphoto displaying the preview is as simple as this:

After having that little demo up and running I realized that the default Raspbian would not work out for me, because Qt kept having an issue with OpenGL and after displaying the live view for a few seconds weird graphic artifacts were showing up. So the next step for me was solving these issues that Qt had. After doing some reasearch I came across a tutorial that described how to build a Yocto embedded linux for the Raspberry Pi (including Qt). I followed this tutorial and got a working OS on my Raspberry Pi which did no longer have any issues with OpenGL. After confirming everything worked I actually adapted the bitbake image to only contain the stuff I needed:

Now if I wasn’t lazy and would need this more often I would create recipes for both qtmultimedia-gphoto and my own Photobooth app, but as compiling both on a Raspberry Pi 3 only takes a few seconds each I was not going to look deeper into that.

Next step was to get all the C++ code together. You can find it all on GitHub in gwaldvogel/QtPhotobooth. My primary class is the RaspberryPiConnector which is exposed to the QML as a context property, it also holds the GPIOWorkerThread which runs in the background and constantly checks the status of the given GPIO pin. I ordered a gameshow buzzer which will be connecting GPIO22 and the neighboring 3V pin when it is pressed. Fetching the GPIO status was actually a problem: As already stated I am actually pretty lazy, so I was looking for ready-to-go solutions for fetching the GPIO status, and after trying two or three different ways I settled with GPIOClass from Hussam Al-Hertani which is what I am now using. The only thing that annoys me about it is that a crash in the app will actually require the GPIO status to be reset because of the way it is implemented. On top of all of that I added some QML and JavaScript to enable the desired usability.

The only things still missing is the web app and the upload of the pictures taken. Once I am done with that I will write another post about it and publish the web app on Github too.

 

// Gregor Waldvogel

/* I am a 24 years old software engineering student, I love working with Laravel on all kinds of web apps. I am also familiar with cross-platform development on iOS, Android, Linux and Windows using the Qt framework. */