Photo-booth
This is the code for a Raspberry Pi photo-booth in python. You can find a more detailed description of the creation process of the photo-booth on https://programm4fun.blogspot.de
Hardware
- Raspberry Pi 2 Model B
- Pi Camera V1
- Jump wires and buttons
- T-Cobbler for Raspberry Pi 2
- Breadboard
- Micro SD-Card
- active USB-Hub
- Wlan-adapter (EDIMAX)
- HDMI Display
- HDMI cable
Software
- Raspbian
- Python
- picamera
- gpio
- Image (PIL)
- feh
Installation
OS
- download and unzip lastest Raspbian (Jessie)
- install Win32 disk manager (windows)
- setup a mikro SD card with the OS
Raspberry Pi - first system start
optional: I'm from germany, so I changed my key layout like this... Menu -> Preferences -> Mouse and Keyboard Settings - Keyboard Layout
sudo raspi-config
set these values:
- expand filesystem
- change password for user pi
- enable camera = true
- advanced options:
- overscan: false
- hostname: photobooth
- ssh: true
then reboot the pi.
Keep your Pi updated
sudo apt-get update
sudo apt-get upgrade
the upgrade will probably take a while, so lean back and wait...
Dependencies
- python
- is preinstalled
- RPi.GPIO
- is preinstalled on newer versions of raspbian e.g. jessie
- picamera
- is also preinstalled on newer versions
- if not:
sudo apt-get install python-picamera or python3-picamera
- Image (PIL)
sudo apt-get install python-imaging
- http://chriskrz.selfhost.bz/index.php/image-manipulation-mit-pil-bilddateien-veraendern/
- http://askubuntu.com/questions/156484/how-do-i-install-python-imaging-library-pil
- Info: Here I got an error message myself, that It it could not install some package, but it works just fine for me.
- feh
sudo apt-get install feh
Clone this repository
git clone https://github.com/easy-rider4/raspberry-pi-photo-booth.git
Display pictures in a gallery on a webserver
This part here is optional. You don't need to install the web gallery to run the script.
- install apache2
sudo apt-get install apache2
- install php5
sudo apt-get install php5
- test server
cd /var/www/html
sudo nano phpinfo.php
<?php phpinfo(); ?>
- strg+o
- strg+x
- find out your pis ip address with
ifconfig
orsudo ip addr show
- open your browser and enter /phpinfo.php
- Info: somehow my default public directory is var/www/html, so I have everything in there
- One page web gallery
- by sye.dk/sfpg/
cd /var/www/html
mkdir /var/www/html/photo-booth
sudo apt-get update
sudo apt-get -y install php5-gd
cd ~
wget http://sye.dk/sfpg/Single_File_PHP_Gallery_4.5.6.zip
unzip Single_File_PHP_Gallery_4.1.1.zip -d /var/www/html/photo-booth
- open browser: /photo-booth
Info: you need to paste some pics into the directory to see the thumbnails
Info2: I somehow had problems to unzip the file, soo I did that on my Mac and copied the files via ftp to the raspberry pi
Install ftp server
The ftp server will allow you to better access the raspberry pi files and for example copy the taken pictures to another computer.
These steps are from a tutorial: http://www.forum-raspberrypi.de/Thread-tutorial-raspberry-pi-als-webserver-ftp-server-proftpd-installation
sudo apt-get install proftpd
sudo nano /etc/proftpd/proftpd.conf
DefaultRoot ~
AuthOrder mod_auth_file.c mod_auth_unix.c
AuthUserFile /etc/proftpd/ftpd.passwd
AuthPAM off
RequireValidShell off
cd /etc/proftpd/
sudo ftpasswd - -passwd - -name <name> - -uid 33 - -gid 33 - -home /var/www - -shell /bin/false
sudo /etc/init.d/proftpd restart
sudo chmod g+s /var/www
sudo chmod 775 /var/www
sudo chown -R www-data:www-data /var/www
Run
- config.py
- USB_PATH = set if usb-device is used for storage
- NUMBER_OF_PICTURES = number of pictures that should be taken
- INTERVAL_IN_SECONDS = length of the countdown between shooting pics
- SAVE_TO_GALLERY = default value is false. Set to true if you installed the web gallery
- GALLERY_DIRECTORY= change your directory to the web gallery here
- if usb is used
- format = FAT
- name = PHOTOBOOTH
- make sure you are in the directory /home/pi/raspberry-pi-photo-booth/ and run
- ./start-booth-usb.sh or
- ./start-booth.sh
- when finished run
- ./remove-usb.sh