Published in


Photo booth story. How programming is fun after work (during my wedding).

Almost ready photo booth in the garage.

Last week I had a wedding :) It was a great party but this is not a blog about entertainment. Since I’m very enthusiastic about DIY and Raspberry i thought — why not build a self made photo booth that instead of instantly printing images is uploading them on special new instagram account that everybody would have access to. I talked with my brother Rafal and we decided that it shouldn’t be a big deal. So this is how we have done it.

First of all was to decide the hardware parts. I had an old SLR Camera Nikon d80. After few tests with USB and its PTP mode I’ve found out about libgphoto2 library and its capabilities. D80 is quite old and have no live preview, so this was the only pitfall. Anyway I decided that without preview final pictures would be even funnier.

d80 SLR (picture from amazon)

Below is the quick relation of garage battlefield.

Ingredients :)

So final list of hardware parts where

  • D80 SLR
  • LED light panel
  • Some wires (power, usb, gpio, hdmi, etc)
  • Soldered battery connection with external Power Supply
  • Big button to take pictures
  • Rasperry PI with brand new NOOBS
  • Wooden box
  • Wooden parts to hold everything together
  • Square LCD display with HDMI
  • Tripod


In terms of putting in all together it wasn’t hard for some parts — a power for LED panel, LCD display and raspberry PI, but was for the others. Since D80 is quite old, addons like permanent power supply was almost impossible to get, unachievable in such short notice. Rafał had to solder the battery connection with external power supply based on diagrams from google images. Last piece of art was to connect button through Raspberry GPIO and to put it all together so that it does not fall apart during the party. Everything was inside big wooden box pictured below.

Front panel was cut with CNC machine with written instruction and bespoke holes for SLR camera, button and LCD display.


I thought that I wasn’t a first person that came with that idea, so i search the open source community i came across great python script by Balthasar Reuter. I had to amend some logic and graphic layout, but this wasn’t a hard task, much harder was that i had never ever used python before.

Instagram script with Paulo Coelho quotes.

Uploading picture thought Instargram API is not allowed. For commercial project i wouldn’t never ever try to bypass this restriction, yet this was just one day party personal event. There are lot of hacky script in github that did this so I’ve copy the method from one of them and added some funny functionality — each uploaded photo was having a caption with random quote of Paulo Coelho. You can get all the quotes from my github repository (linked below).

Watch script

Python photobooth and uploading scripts were separated so i needed a simplest way to synchronize them. I’ve come with idea

  • Once picture is done its being placed in to_upload folder
  • When watch script finds a first file in to_upload folder it moves it to uploading folder and starts putting it on instagram
  • Once picture is uploaded is was moved to uploaded folder

This was part of php instagram script now i needed a way to launch this script every time a new file is being put in “to_upload” folder. Without any dependencies following python script is doing the job.

#!/usr/bin/env pythonimport subprocess
import time
folder = "to_upload"
application = "php insta.php"
def get_drlist():
return subprocess.check_output(["ls", folder]).decode('utf-8').strip().split("\n")
while True:
drlist1 = get_drlist()
drlist2 = get_drlist()
for file in [f for f in drlist2 if not f in drlist1]:
command = application+" '"+folder+"/"+file+"'"
subprocess.Popen(["/bin/bash", "-c", command])

Startup script.

This was quite a surprise but Raspbian wasn’t respecting some standard techniques Iuse for default Linux startup script like services or putting shell script in init.d folder. In te resources section I’m linking an article “Run a Program On Your Raspberry Pi At Startup” yet none of this 5 methods actually worked on my system. What did worked in amending ~/.config/lxsession/LXDE-pi file. There I had to put commands to run two python scripts

  1. photobooth script
  2. watch script

Final Result

Sample pictures

Below are sample pictures taken during the wedding. Note the quotes :D


  1. Python photobooth script by Balthasar Reuter
  2. Run a Program On Your Raspberry Pi At Startup
  3. Raspberry PI Forum Exchange thread “Execute script on start-up”
  4. Example PHP Instagram upload script
  5. Raspery PI with brand new NOOBS
  6. All my scripts in github repository




Stories from creative software house based in Poland, with a love for all web technology

Recommended from Medium

How industries are solving challenges using Ansible

GraalVM 20.1

Full Stack Type Safety: An Enum’s Journey

Deploy a simple HTML/CSS/Javascript Application On Heroku

Hasura, GraphQL backend in the cloud — Part 2

All Eyes on Webtestit: Adding Visual Testing to Your Workflow

Venkat Guntipally’s Take on Scrum outside Software Development

Venkat Guntipally- Scrum Master — Software Development

Web Dev Bootcamp: My First Month In

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mateusz Wojczal

Mateusz Wojczal

founder of Qunabu Interactive from Gdańsk, Poland. Full-stack web developer with over a dozen years of experience.

More from Medium

Mind Reading Computers: Most Incredible Invention Ever

Mind Reading Computers — Verzeo

Create Wordle with Python

68 Likes to Know Who You Sleep With

Screenshot of Instagram’s permission request to access the user’s photos

My 5 Favorite Odysee Linux Channels