After a one-week holiday, I went back to work on monday 8 april. We sat together and discussed the work that has to get done this week. I worked on a couple of frontend jobs last month, so it was time to get back on track with the check-in application.
We initially decided to use an Arduino Uno together with an RFID shield as our hardware to make the physical of checking in. Frederik told us that the Raspberry Pi can also be programmed like a microcontroller. So I started researching if it was possible to use the Raspberry Pi as a wireless device that can read RFID tags and then sent a request to the check-in api.
I was blown away by the possibilities of the Raspberry Pi! The tiny yet powerful Raspberry pi is a computer that runs Linux, has USB sockets and HDMI video output and stores his data on a SD card (min. 2GB). There are also GPIO pins and they allow the Raspberry Pi to be connected to custom electronics. Users of the Arduino and other microcontrollers will already be used to the idea of GPIO pins.
I needed to make a shopping list of all the hardware that needed to be bought, and find the best online e-shops where those elektronics could be bought. Here's what I came up with:
- Raspberry Pi Model B (512MB): the tiny linux computer that will control the elektronics.
- USB Power adapter 5V/1,2mA: the powersource to our raspberry pi, using a microUSB cable.
- Wifi USB dongle: to access the local wifi network instead of using an Ethernet cable.
- SD card: the storage for our OS and other files. Needs to be 4 GB or bigger.
- Adafruit PI Cobbler Breakout Kit: The cobbler kit is a 26-pin board connected with a ribbon cable to the pi.
- Adafruit PN532 NFC/RFID controller Breakout Board: The PN532 is the most popular NFC chip, used in pretty much every phone or NFC device.
- RFID cards: some cards to check-in (size of a credit card)
- RGB LCD screen: a multi-colored LCD screen for use with the raspberry pi
API, routing and Silex
I also had to make a simple yet powerfull (REST) API that could retrieve some basic information about the user: his userdetails, his checkins and his badges. One can also do a POST request to check himself in or out.
I also started rewriting my code and using router by Bramus (also used in my API) which perfectly did the job. But thursday I was thinking of moving to Symfony2 or Silex, so I could use the Symfony components & service providers like DependencyInjection, Filesystem, Routing, UrlGeneratorServiceProvider, Monolog, FormServiceProvider, Validation, SessionServiceProvider, ... And I needed a template engine, so I chose TWIG of course. I already had some experience with the Symfony2 components and the TWIG engine because I made a school project with the Symfony2 framework.
Next week, when I have converted my code to Silex & twig, I'll start to make all kinds of statistics and start to program the Raspberry Pi in Python to scan NFC/RFID cards and make the appropriate requests to the API. I can even turn the raspberry pi into an Apache webserver and host the check-in application on the raspberry pi!
I arrived at the Thinline office on thursdaymorning 9AM when I saw the police talking to my co-workers. In the middle of the night, the office window apparantly got smashed with a big cobblestone and some hardware got stolen, among others an Apple Cinema Display 27" and a Macbook Pro. Luckely, a nearby police team was able to arrest the three individuals responsible for the burglary when they were fleeing. The stolen hardware was also found, but the glass plate of the Apple Cinema Display was shattered.
We had to wait a couple of hours until the lab team finished collecting finger- and footprints, and then we cleaned up all the glass and removed all the ash used to detect fingerprints, and we got back to work.