#HowTo make a photobooth / Part 6 Cron job, uploading, emailing and laser cutting…

#HowTo make a photobooth / Part 6 Cron job, uploading, emailing and laser cutting…

For other parts in this series…

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
Part 5: #HowTo make a photobooth / Part 5 Building a better button box

Cron job…

Any OS prefers that things be shut down in an orderly fashion so that things get written to the hard disk and open files are properly closed.
Since the remote slideshow board is running without a keyboard, how can it be told remotely to shut down or reboot? Further, since running things logged in as root is frowned upon, how does a normal, unprivileged user signal a reboot?

Toward that end, I created a cronjob that runs as root every minute:

blog6image1

 

 

It runs the Python script rebootcheck.py:

blog6image2

 

 

 

 

 

 

 

The script checks for the presence of a file named “reboot” or “shutdown” in debian’s home directory. When it finds a file so named, it will delete the file (so we don’t end up in a repeating reboot/shutdown cycle) and then reboots or shuts down. This works because the cron job runs as root and and has the proper permissions to do so.

Uploading and Emailing…

To deliver the photo booth pictures to the users, the script uploads the photos via FTP to a domain for which I have a hosting account. Once up there, the script shoots an email to http:ifttt.com, which has previously been set up with a recipe to post to an album on a Facebook page.

Why the circuitous route to uploading the images to the page on Facebook? The short answer is that there is easy/obvious/pre-existing method to do so via a command line driven script. There once was a PHP command line script that could but Facebook changed their API about two years ago and broke it. The author never fixed it.

I wont bother posting the code here since it can be seen in libsocialmedia.py and credentials.py (which doesn’t exist in the git repository, it comes from credentials-template.py, since it’s really bad form to publicly share passwords and stuff…). Feel free to peruse the code at: ftfpbk/photobooth · GitHub.

Laser Cutting…

Here are some photos of the laser cut internals of the kiosk. The first four are of the pillar that both TVs mount on. The last two of of a small button box that will sit inside the enclosure for administrative functions. These buttons will be able to shutdown and reboot the kiosk. It may do more, possibly even play a game of Simon, but there’s not much time to implement that before FTF 2015…

blog6image3 blog6image4 blog6image6 blog6image7 blog6image8

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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