Photobooth with RaspberryPi

A fun maker project for a personalized gift

MM

A Personalized Gift

This winter season my partner and I have gotten into tinkering with raspberry pis and microcontrollers. Now that the holidays are coming, we wanted to make my family a personalized gift. With a couple of components we had, we were able to make a simple photobooth using a raspberry pi and some peripherals. In this post I'll walk us through creating a digital picture frame that will take pictures and add them to a slideshow.

Things you'll need:

To get started, you'll need a couple of components:

I also bought a simple wooden frame from ikea and used some hot glue to place the raspberry pi in the frame. More on that when we assemble the frame at the end.

Step 1: Setting up the Pi

First, you want to get the biggest microsd card you have at hand and flash adafruit's PiTFT raspbian image, which you can download here. You can use dd, or etcher to flash the image onto the microsd card. I recommend installing and using etcher as it's fast and hard to mess up (dd can cause some serious damage if you don't know what you're doing!). We're using this image in particular because it allows the screen to work without setup, saving us some time. After flashing, open up the boot folder and create a blank document named with touch ssh. On the newest versions of Raspbian, ssh is disabled by default. Creating this file enables ssh without having to connect your pi to a screen on its first boot. To connect your pi to the internet on start up, in the same boot folder, open a file called wpa_supplicant.config and write the following:

                                

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
      ssid="YOUR-NETWORK-NAME-HERE"
      psk="PASSWORD"
}

Put your microsd into your pi, and boot! To ssh into the pi, you'll also need its ip address. Connect the pi to ethernet and power. You can use nmap to find the ip of your pi once its booted with the following command:
sudo nmap -sP 192.168.0.1/24
The ip address you imput into the command above depends on the addresses your local network uses (i.e. some networks use 192.168.0.1, 192.168.1.1, etc.).
Then you can ssh into the pi like so:
ssh pi@ip.address.of.your.pi
With the default password being "raspberry".

Now we can do some configuration to the pi. We want to expand the filesystem so we can make the most out of the space. We use raspbian's raspi-config to change some settings with:
sudo raspi-config
To expand the filesystem, scroll down to Advanced, select Expand filesystem, and enable it. You should also change the password from the default by scrolling down to Change User Password and input your new password. Lastly, enable your picam by going into Interfacing Options and enable the camera. Reboot your pi with sudo reboot and ssh back into your pi when it has finished booting. This will fully make the changes you made using sudo raspi-config.

Getting the code

Now that you've ssh'd back into your pi, you can clone my repo:

                                

cd ~
git clone https://github.com/mayorquinmachines/photobooth_raspberrypi
cd photobooth_raspberrypi

This will create a folder in your /home/pi directory. It will have all the scripts to run the peripherals you'll use. Open up the crontab_raspberrypi.txt file and you'll see three lines that need to be added to your crontab for the photobooth to startup after reboot. Edit your crontab with the command crontab -e. If you haven't set up your crontab it will ask you to setup some configurations. Follow the instructions given and add these three lines to the bottom of the file. Save and quit and these commands should execute a minute after your pi reboots.

Reboot your pi again and go ahead and take a couple pictures! In a couple minutes you should see your photos display on the screen and the slideshow will begin. Happy tinkering!