RaspberryPiFoundation/jam-photobooth

Name: jam-photobooth

Owner: Raspberry Pi Foundation

Description: Raspberry Jam photobooth

Created: 2018-01-24 21:03:09.0

Updated: 2018-04-16 22:04:08.0

Pushed: 2018-02-24 19:01:15.0

Homepage: null

Size: 1020

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Raspberry Jam Photobooth

Yet another Raspberry Pi photobooth project. This one is made especially for Raspberry Jams participating in the Big Birthday Weekend.

Its features include:

Requirements

Hardware:

Software:

Automated installation

Open a terminal window and type:

 -sSL http://rpf.io/jampb | bash

Note this reboots the Pi at the end of the script, and launches the program automatically.

Manual installation

Start with a Raspbian Stretch desktop image.

  1. Connect the camera module and wire your button to GPIO14.

  2. Enable the camera module using the Raspberry Pi Configuration Tool in the main menu, or using raspi-config on the command line.

  3. Reboot.

  4. Open a Terminal window.

  5. Install the requirements:

     apt update
     apt install python3-gpiozero python3-picamera python3-pip git -y
     pip3 install twython --upgrade
    
  6. Git clone this repository:

    clone https://github.com/raspberrypifoundation/jam-photobooth
    
  7. Enter the project directory and run the photobooth script:

    on3 photobooth.py
    
  8. You should see an image preview appear, and the message:

    y!
    s the button to start...
    
  9. Now use the button to progress to the next step, and continue.

  10. Without a Twitter API key, the application will not attempt to tweet the photos. It will simply save the photos in the Pictures folder at /home/pi/Pictures.

  11. Press and hold the GPIO button for 5 seconds to close the application.

  12. To make the program run on boot, add the following entry using crontab -e:

    oot python3 /home/pi/jam-photobooth/photobooth.py &
    
Twitter API keys

In order to enable the Twitter feature, you'll need to provide Twitter API keys for the account you wish the photobooth to tweet from, i.e. your Jam's Twitter account.

  1. Log in to Twitter and ensure a mobile number is added to your account.

  2. Go to apps.twitter.com and create a new app.

  3. Fill out your application details. If you use https://github.com/raspberrypifoundation/jam-photobooth as the website, other people will be able to see what generated the tweet.

  4. Go to Keys and tokens and click the Create my access tokens button.

  5. Open auth.py from the project folder and enter your consumer key, consumer secret, access token and access token secret in the variables provided, e.g:

    KEY = '0GrZb5jUk9O9KK9W6xhALmNhD'
    SEC = 'CDXCGvmGuMvOBQvvrDZO7lzbj83rDMVpcEnqWYXxkfLGfGrFpL'
    TOK = '27241881-XPa2YtoA4PwHkIelgYYgMbf24kaEYXj4bp6Ualmk8'
    SEC = 'ruydKmwQ1ft5fPNkL3AVsOS6EltMdutkek3N80Dlhsjkl'
    

    Now when you run photobooth.py, it will be able to tweet the photos. There is an option to cancel a tweet before it is sent.

    Photos tweeted are still stored in the Pictures folder.

    To disable the Twitter feature, simply restore the CON_KEY variable to an empty string

    IMPORTANT: Do not share the API keys. Do not accidentally push them to GitHub.

Languages

Simply edit text.py, which contains dictionaries of the strings used as camera text annotations, and add a copy of the English language dictionary text_en below, renaming it as appropriate. Then replace the dictionary values (right hand side) with the translated equivalents, leaving the keys (left hand side) the same.

Please note that the camera firmware does not support non-ASCII characters.

To select a language, edit the following line in photobooth.py:

 = get_text(language='en')

Current language support:

Pull requests with more language support welcome, as are any improvements to existing translations (they were all done using Google Translate).

Modifications

Feel free to edit the code to your own specification. Note that the JamPiCamera class is a slightly modified version of PiCamera (as you can see in jam_picamera.py).

You may wish to rotate your picture around 180 degrees if your camera is upside-down. Simply add camera.rotation = 180 after camera = JamPicamera().

You can also change the overlay image to another image. Just make sure it's the same size as whatever the camera resolution is set to (here it is set to 1024x768).


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.