Yet Another Raspberry Pi Photo Booth

2,962

45

22

Introduction: Yet Another Raspberry Pi Photo Booth

Recently, my company (cubitux) had the opportunity to participate to a contest to present a photo booth solution to a client. Because I'm an open-source fan, I picked Raspberry Pi technology and started creating something around it.

------------------

Everything runs with a customized Raspbian - Desktop Edition (Special Linux flavor for Raspberry Pi)
An already made SD card image is available on the following GitHub repository: https://github.com/phenelle/RPi_Photoboth/tree/mas...

------------------

However, this guide will show all the steps that we did to customize our Raspbian and make it very close to an embedded system...

Step 1: Required Hardware Component

Hardware

Additional tool

  • A screw driver to fix the LCD screen on the stand
  • A keyboard (I prefer that over a touch screen virtual keyboard, however, both options are available...)


Total hardware requirements cost around: $182 USD


Note: I suggest getting hardware from the Adafruit Industries because they highly support open source technologies, and also provide nice and fast support

------------------

At this point, you should have a working Raspberry Pi with Raspbian Desktop and a working Camera module enabled.

You can test the Camera module by following this manual: https://www.raspberrypi.org/learning/getting-start...

Step 2: Splash Screen Customization

Everyone who runs Raspberry Pi knows that, when the device boot, the raspberry images shows up with bunch of ugly text lines (boot message).

----------------

Because the photo booth was design to be use by the public, we changed the default "start screen" to hide those information and we replaced them with a nice image. (Long story short, the text messages still output somewhere, but we display an image above it)

----------------

As root, go to "raspi-config":

  • Enable "Console Autologin"
  • Disable "Splash Screen" (we use different method than plymouthd)

----------------

Based on the following guide (http://www.raspberry-projects.com/pi/pi-operating-...)

  1. Create a 800 x 480 splash screen images. (We placed our image in /etc/splash.jpg)
  2. Edit /boot/cmdline.txt and change the line "console=tty1" to "console=null"
  3. Edit /boot/cmdline.txt and add "logo.nologo quiet" at the end of the command line
  4. Edit /boot/config.txt and add "disable_splash=1" at the end of the file
  5. Create a startup script (/etc/init.d/splash)
  6. Call "sudo insserv /etc/init.d/splash"

----------------

Dont worry, the console is still there. If you press "enter" or move to different terminal (for ex, ALT + F3), you will see the shell and be able to run X.

----------------

At this point, the device should boot and show the splash screen instead of the default (raspberry image + init text message)

Step 3: Install 3rd Party Applications

To make this work, we will install a little custom website that will be used as graphical interface (GUI) for the user. (Web is an awesome lightweight technology that can be easily created and customized...)


Therefor, we need will need apache webserver, PHP and "uv4l" (UV4L is used to stream the webcam live to the user and take pictures)

The following commands should install all them nicely:

(more documentation to install UV4L available here: https://www.linux-projects.org/uv4l/installation/ )

You might need to give permission to the apache user to use "video / webcam" hardware

In order to do that, add the user "www-data" to the group "video". The following command should do the trick...

  • sudo usermod -G video www-data

Now, start apache and make sure it persist on reboot:

  • sudo /etc/init.d/apache2 start
  • sudo /etc/init.d/uv4l_raspicam start

To test that apache is installed and working, open the following URL from within your RPi: http://127.0.0.1/

To test that uv4l is installed, open the following URL from within your RPi: http://127.0.0.1:8080

(as shown on the screenshot)

Now, make this persistant when device reboot:

  • sudo update-rc.d apache2 enable
  • sudo update-rc.d uv4l_raspicam enable

Reboot your device, and test that both apache and uv4l are started...

Step 4: Deploy Photobooth Website Application

Open a shell and type the following command:

# Install various tools for splash screen

sudo apt-get install xscreensaver feh

# Remove default homepage

sudo mv /var/www/html/index.html /var/www/html/index.html.orig

# Clone repository

git clone https://github.com/phenelle/RPi_Photoboth.git

# Move all site's content to the /var/www/html folder

sudo mv RPi_Photoboth/source/www/* /var/www/html/

# Allow apache to create files in the "snaps" folder

mkdir /var/www/html/img/snaps

sudo chown www-data:www-data /var/www/html/img/snaps

--------------------

The default website installed on the Pi should now show the RPi Booth web application

--------------------

You can now configure various settings of the "config.php" (such as SMTP, Virtual Keyboard, etc...)

--------------------

Now if you reboot, everything should work nicely!

I hope you enjoy this tutorial

Step 5: Create Custom Auto-login Procedure at Startup

Now that we have all in place, we need to customize the RPi, so it will automatically run X and open that website for us.

To do that, I enabled "shell auto-login" on the RPi. And I create 2 specials files: .xinitrc and .bashrc,,,

BashRC

This file is parsed everytime a shells open.

XinitRC

This file is parsed everytime X runs

The idea here is to run X with special options... (not the defaut Gnome interface)

Have a look at the Github repo to see what are the options to make:

https://github.com/phenelle/RPi_Photoboth/tree/mas...

Share

    Recommendations

    • Water Contest

      Water Contest
    • Tiny Home Contest

      Tiny Home Contest
    • Creative Misuse Contest

      Creative Misuse Contest

    22 Discussions

    I love this project and want to play around with making it.

    Is it configurable to put in my own Logo and change the interface?

    1 more answer

    is a gret idea , i do bad fot me have a little problems, i use 5 inch display and cat fix this error, i dont know php

    That is really cool. You could probably make one of these much cheaper than renting a photo booth for a special event.

    12 replies

    i am having problem with the email attached image.please help

    Hi, how did you manage to fix it senting images in the email?

    I have received the email without my photo.

    Did you manage to get the photo in your email?

    I am having the same issue, everything seems ok except there is a broken image tag in the email

    Hi,

    Sorry for the delay to reply

    Perhaps wkhtmltoimage is not installed ? (or not working as expected?) It could be a permission issue as well..

    The generated image attached to the email comes from "card.php"

    The code to send email and attach the generated image is in "sendmail_form.php"

    If you could provide more trace / debug information.. It would help

    after more digging, I found the following in my apache error log

    No protocol specified
    QXcbConnection: Could not connect to display :0
    Aborted

    I do have - putenv("DISPLAY=:0"); - in my sendmail_form.php

    Hi,

    I have tested wkhtmltoimage in the command line to create an image of a webpage, that works okay... although i do first have to type

    export DISPLAY=:0

    Ive tried chmod all directory/files to 777 but unable to chmod snaps directory/files. It shows as owner www-data. I tried adding user 'pi' to the group but still am unable to change chmod

    Thank you for the tutorial. But what do I have to do at this point:


    1. Create a startup script (/etc/init.d/splash)

    Do you have the line of code?

    Thank you :)

    1 reply
    0
    None
    jupman

    7 months ago

    Is there a way to save the files to x directory, either on the mSD card or an thumb drive?

    1 reply

    Yes, the code that takes the picture is in "snap.php"

    Perhaps creating a "directory variable" in "config.php" and then re-use in various place of the code would do it.. (feel free to pull request ;)

    0
    None
    vdubuk

    5 months ago

    When trying to unzip the Github download, I get an error, any ideas what i can do to fix?

    An unexpected error is keeping you from copying the file............................

    Error 0x80004005: Unspecified error

    rpi-photobooth-20170923.img
    Type: Vivid Ray-tracer