Jashan Bhoora | blog

Posted: 23/02/2014

I've finally got a website up and running! I hope to use this blog to record and explain some of activities I take part in.

Since this is my first blog post, I thought I might talk about an event that I, along with all my fellow course mates participated in at the end of our first week at the University of York: The Raspberry Pi Challenge, a competition for all first year computer scientists held by the university.

We were set two tasks: the first was to program a Raspberry Pi to act as a player in a game of Battleships. The other was to use the Pi in any way we thought was innovative, creative, or otherwise useful and interesting. In the case of both tasks, the culmination of the competition would take place at the end of our first week at University, where we would both pit our Battleship implementations against each other, and demonstrate our creative projects to a panel of judges, that consisted of representatives from the competitions sponsors including: IBM, BAE Systems and also Gordon Hollingworth, a York Alumni and Director of Software at Raspberry Pi.

I thought I might talk about the latter challenge, aptly named "Blue Pi Thinking". Using the Raspberry Pi I was given, I created a Near Field Communication (NFC) public locker system, similar to the kind you may find in gyms, airports, and other public locations. The difference was that instead of the current way of managing lockers, by which a user inserts e.g. a pound coin into the lock, deposits their belongings and retains the key, my system would use a phone as the key, and possibly to both handle the payment as well, the whole system being powered by just a Raspberry Pi.

To accomplish this, I needed to enable the Raspberry Pi to communicate via NFC, and so bought a relatively inexpensive NFC module that could interface with the Pi. I then needed to write an app for my phone (a Nokia Lumia 920), so that it could become a key in my system, and software for the Pi itself, both to interface with the NFC module, and keep a record of each phone that was assigned to each locker. For the demonstration, instead of trying to obtain actual lockers to test on, I settled for using two toy money box safes, in which the locking mechanism is controlled by a solenoid. By simply connecting these to the Raspberry Pi I was then able to control the "lockers" from my software.

The system flow is as follows, assuming that in this case both of the lockers in my system were vacant:
A customer wanting to hire a locker would, using the app I created (and which ideally would be available on all major app stores) simply have to touch their phone to the NFC transceiver.
At this point the phone, which is currently not acting as a key to any locker, sends a request message to the Pi. The Pi responds by checking if there are any lockers available. Since (in this case) there is, the Pi generates a unique identifier for the phone, and associates it with a locker. It then saves this phone and locker association, and returns the ID to the phone, which stores it in its own local storage.

A second customer would then come along and, not having a locker already would do the same thing. The difference here would be that because one locker is already taken, the user would simply be assigned the other one. At this point if another user tried to hire a locker the system would reject them.

Later, one of the users would come back, and again all they have to do is touch their phone to the receiver. This time, because the phone has been assigned an ID, it sends this to the Pi instead of a registration request. The Pi checks its database for the ID and, if present, unlocks the locker associated with the ID, deleting the association afterwards, meaning the locker is then free for another customer to hire.

Below are some images of parts of the final system, including the locker and solenoid, and a screenshot of the app on my phone.

In the end I decided not to implement a dummy payment mechanism into the system, as by the end of the holiday I had just finished and didn't have the time to attempt it.

Overall the project seemed to go quite well with the judges. While I didn't win the competition, myself and 3 others were asked to present our projects at the departments UCAS days, where potential York computer scientists visit the campus (probably for the first time), are given talks about the various ventures of students, and are interviewed by a member of staff. This was another great opportunity to demo our creations, and on the whole seemed to go down very well with both the prospective students and their parents.

I believe that the University will be running this competition next year for successful applicants, and I'm sure they will enjoy it as much as we did.

A video summary of the whole event can be found on the York Computer Science Department Channel. Check it out at the bottom of this post!