#HowTo make a photobooth / Part 5 Building a better button box

#HowTo make a photobooth / Part 5 Building a better button box

Also…

Part 1: #HowTo make a photobooth with i.MX processor based Utilite and Wandboard, Freedom KL25Z board
Part 2: #HowTo make a photobooth / Part 2 The new starting point
Part 3: #HowTo make a photobooth / Part 3 The new remote display
Part 4: #HowTo make a photobooth / Part 4 More slideshow and the photo booth script

Button Box

To get user input, I’m using a 52mm diameter LED lighted arcade button with a Teensy3.1 programmed as a combination Button arrayUSB serial/keyboard/mouse/joystick device. The mouse and joystick profiles are not used at all. Button presses are converted into keystrokes using the keyboard profile. The serial port is used so that the photo booth script can blink the LED that illuminates the button.

To connect the button to the Teensy, I used an extra board I previously had made to mate with the Teensy. The board was originally designed to accommodate five buttons and drive 8 channels of FETs.

It also was meant to piggy back onto the Teensy, as not seen in the photo above (the breakout board is underneath the green board). Since the FTF photo booth kiosk is going to be on display, I thought it important to see the Teensy and breakout board. Below is a photo of the kiosk’s button boards boards. As populated, only the one switch is connected blog5image2along with one FET to drive the button’s LED.

The Teensy is programmed using the Arduino software. The maker of the Teensy has a plug in for the Arduino tool that translates the compiled code into a form usable on the Teensy 3.1 hardware and by the Kinetic K20 at the heart of it. It also has several different USB devices already set up – you just choose them from the pull down menu.

The code is basically unmodified from my 5 button version. I had to commenting out the blue button because that line needs a pull resistor to keep it from repeatedly sending a character (a better choice before spinning the board could have avoided this…). More buttons will be added inside the enclosure for administrative functions.

 

Here’s a photo of the button and board connected to the kiosk board:

blog5image3

Setting up the Linux Environment…

To install Linux on the Hummingboard, I used Solid Run’s Ignition installer. You download it and dd it to a microSD card, stick it into the board, and give it network. It boots to a GUI where you can select from a number of distributions. I clicked the show all, since I wanted to install Debian Wheezy and it was not in the default list. It reformats the card and installs the chosen distribution from the network. It’s a pretty slick installer compared to the gyrations required to put Linux on other boards. Once it finishes installing, it reboots and you’re up and running with the new OS.

 

Once installed, I had to fix one of the apt-get sources in /etc/apt/sources.list. As installed, the line with “http://repo.gbps.io/BSP:/Cubox-i/Debian_Wheezy/” did not work. After searching the web for a bit, I found two replacement repositories that did work instead: “http://repo.r00t.website/BSP:/Cubox-i/Debian_Wheezy” and “http://obs.gbps.io:82/BSP:/Cubox-i/Debian_Wheezy/“.

 

With sources.list fixed, I did “apt-get update”, followed by “apt-get upgrade” and “apt-get dist-upgrade” to bring everything up to date. This was all required since one of the later packages would not build until the dist-upgraded was performed. Here’s the list of things that were subsequently installed:

  • python-pygame – this package is how keystrokes from the button box are capture and how images and prompts are displayed on the screen
  • python-serial – this is required by the serial port in the button box
  • python-imaging – this package is used to avoid writing still frames from the camera to the SD card
  • graphicsmagick – this package composites the individual images
  • ghostscript – this package bring in fonts used by the booth script to put the image number on the print strips
  • mpg123 – an mp3 player so that sound prompts can be added (played through the TV via HDMI)
  • apache2 – the web server for the camera board to serve the composites to the remote display board
  • fbi – a command line image viewer
  • libv4l2-dev – required to build v4l2capture
  • python-dev – required to build v4l2capture
  • v4l2capture – this package gets video and still from the USB webcam; (this is what required the dist-upgrade…)

 

Setting up autologin and the scripts to run on login…

Since I will be in Michigan while the kiosk is at FTF in Austin, I need to make sure that it runs relatively unattended. That means, it just has to work with little attention and assuming that there are no debugging resources available.

Toward that end, the scripts need to start running when the boards boot up. At first I was invoking the script with a line in /etc/rc.local. This isn’t so great an idea because it runs as root and it never actually ends up even logging in – the script is invoked as by a root level process at the very end of linux launching. While it worked, running things automatically as root is probably not the greatest idea.

According to Google, editing /etc/inittab and adding –autologin in should have done the trick…  But apparently not so much with the Debian image installed by Solid Run’s Ignition installer. No changes to inittab had any effect, so I had to take to digging into all the instances of getty in the image…

As it turned out, this particular Debian image uses systemd. The inittab file is still in place, but there are configuration files under /lib/systemd/system that control the logins via getty. The file where I had to add in the –autologin was /lib/systemd/system/getty@.service.
Now, with autologin accomplished, I wanted to configure it so that the script only ran when logged in as the non-root user on tty1. To do this, I edited the .profile script in the user’s home directory and added the following:

 

 blog5

 

 

 

This allows me to log in as ‘debian’ via ssh or another tty without attempting to launch another instance of the script.

 

Another invaluable tool to administrating these boards is Webmin. I used it to create the non-root user ‘debian’, set things up so that the board would go out and find an ntp server to set the machine’s time (there is no real time clock on these boards), and to set the permissions for ‘debian’ so that it could access the framebuffer and input devices. Webmin is very much your friend.

 

Kiosk Enclosure

Given that time is passing rapidly, I gave some thought to the enclosure for the kiosk this week and drew up some plans. The plan is to encase the two TVs, board, button, and other things in a clear acrylic enclosure on top of a pedestal. So, here’s a diagram of the pieces for the acrylic cover:

blog5image4

 

I didn’t have any CAD software handy, so I just sketched up what the kiosk top will look like:

blog5image6

 

David DiCarlo is a hardware applications engineer for Freescale i.MX applications processors.

David DiCarlo
David DiCarlo
The human analog of a Swiss Army knife, David DiCarlo has been by providing hardware systems support for the past 17 years for the i.MX family of applications processors and audio digital signal processors, enabling customers to bring their products to market. Formally schooled as a material scientist (ceramics in particular), he plays an engineer by day and maker/re-maker the rest of the time.

Comments are closed.

Buy now