Sunday, 31 July 2016

Introducing the PiMoodBox

In this post I´m going to give some details of a small project using the Raspberry Pi. Maybe not a step by step tutorial but detailed enough for anybody to replicate with very little effort, including a link to a github repository with the source code.

Some airports have had, for quite a while, feedback systems that allow them to collect information on how a particular process is perceived by the public. I have seen this in the UK for example after the security check. As you walk into the waiting area, you have several buttons to vote and rate the "security experience". At the beginning of the year I was approached at work to see what it would take to recreate the system to try and measure the mood of the department. Since I had been playing around with the Raspberry Pi for a while doing timelapse videos and playing pong with my children using buttons made with pegs and alufoil, this was clearly within easy reach.

The concept is extremely simple: two buttons and one LED to give feedback to the user, all connected to a raspberry pi running a python script inside a shoe box. I used Fritzing for the schematics below.

Unfortunately I am not allowed to hook up the Raspberry Pi to the wifi on our campus, which would have paved the way for a nice mini IoT project. Instead, I found a bash script written by Andrea Fabrizi that uploads data into Dropbox. The nice thing is that it connects to dropbox using the API and limits access to a given app folder so, even if somebody takes the unattended Raspi and cracks the password, I don´t have to worry about people accessing my account (not that there is a lot in there anyway, I only created it a while ago because it was a required for a MOOC). The first time you use the Dropbox-Uploader, you will have to connect it to your app by entering the app key and secret and later entering an authorization token into the browser. Quite straightforward.

My script runs when the Pi boots up and records the time stamp every time a button is pressed. If both buttons are pressed then the Pi looks for my phone hotspot and, if connected, uploads all existing files to dropbox (note that I actually use the skip function so only new files are uploaded).

If I ever have to do any maintenance or troubleshooting, I can connect to the Pi through ConnectBot (by the way, you may also want to get the Hackers keyboard app). While there is room for further automation and improvement, it was interesting to see how easy it is to go from idea to realization with existing blocks. It sounds very topical, but this was a weekend hack and a lot of the time was getting the holes into the shoe box and soldering the two buttons. I appreciate this is not very sophisticated, but for the amount of effort that it took to put together, it is more than enough. Truth be told, I´m really pleased by how well this has worked for the last seven months, despite a couple of hiccups that have made me realize how even a simple project with the simplest of interfaces still has plenty of issues to iron out before scaling up.

I participated recently in a meetup organised by a colleague and prepared the snapshots above, so I thought I may as well share this with the raspberry pi community.

Tuesday, 19 July 2016

Erwin Schrödinger Zentrum

I would have loved to have this library close by in the mid and late nineties.