/raspberry-pi-photo-booth

A python script for a raspberry pi photo booth with the pi camera modul

Primary LanguagePythonMIT LicenseMIT

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

  1. download and unzip lastest Raspbian (Jessie)
  2. install Win32 disk manager (windows)
  3. 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

  1. python
    • is preinstalled
  2. RPi.GPIO
    • is preinstalled on newer versions of raspbian e.g. jessie
  3. picamera
    • is also preinstalled on newer versions
    • if not: sudo apt-get install python-picamera or python3-picamera
  4. Image (PIL)
  5. 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.

  1. install apache2
    • sudo apt-get install apache2
  2. install php5
    • sudo apt-get install php5
  3. test server
    • cd /var/www/html
    • sudo nano phpinfo.php
    • <?php phpinfo(); ?>
    • strg+o
    • strg+x
    • find out your pis ip address with
      • ifconfig or
      • sudo 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
  4. 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

  1. sudo apt-get install proftpd
  2. 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
  1. cd /etc/proftpd/
  2. sudo ftpasswd - -passwd - -name <name> - -uid 33 - -gid 33 - -home /var/www - -shell /bin/false
  3. sudo /etc/init.d/proftpd restart
  4. sudo chmod g+s /var/www
  5. sudo chmod 775 /var/www
  6. sudo chown -R www-data:www-data /var/www

Run

  1. 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
  2. if usb is used
    • format = FAT
    • name = PHOTOBOOTH
  3. make sure you are in the directory /home/pi/raspberry-pi-photo-booth/ and run
    • ./start-booth-usb.sh or
    • ./start-booth.sh
  4. when finished run
    • ./remove-usb.sh