Hardware wise, it consists of 3 major components:
- Raspberry Pi (from the B+ on up)
- PN 532 NFC/RFID controller breakout board from Adafruit
- HDMIPi screen
- Python application using NFC.py to track card touches
- Python application using CherryPy to supply latest info to web browser display
- Python application monitoring usage and enabling/disabling screen when required
This project got started when my daughter bought Zoom Zoom's, an indoor children's playground. Always looking to get an edge up on the competition, we brainstormed several ideas around until the idea of Circuit Chaser came to the fore. This device lets kids clock out, run through a previously determined course in the playground and then clock back in. Runs can be done simultaneously, i.e. more than 1 kid can be out on course at the same time (up to 11).
I covered the installation of the NFC reader on the Pi here: http://khekker.blogspot.ca/2014/01/raspberry-pi-clean-install-of-nfcpy.html.
As a card is brought near the reader, it triggers the reader into action. It reports the unique id of the card, and my Python application then records this in a SQLite3 database table. If a card currently is 'out', the application records the new time as 'in' (or finish, if you like). Otherwise, it records this as 'out', along with the time of the event. The application next does a retrieval of the last 11 records and creates a text file, which will be used by the CherryPy based application described below.
The application also retrieves the pseudonym of the card, making it more palatable for human eyes.
The application based on CherryPy continuously monitors this text file for changes. If found, it will send this file to any browser currently connected to it. If none are found, it goes to sleep for .25 seconds and repeats.
Along with the file sent to the browser is a variable containing the number of seconds expired since midnight, since this is important to keep the times shown on the display accurate. Each system does not necessarily have the same time as the next.
An insight as to how the browser gets to display this information I provided here: http://khekker.blogspot.ca/2013/12/raspberry-pi-cherrypy-and-asynchronous.html
Lastly, the application monitoring usage runs continuously and shuts down the display if no activity has been detected in the last half hour and turns it back on when a card is entered near the reader. The shutting off and starting up is based on this hack by Alex Eames for the HDMPi.
The normal screen blanking on the Pi has been disabled, as explained here:http://khekker.blogspot.ca/2015/12/screen-blanking-raspberry-pi-b.html
I spent an inordinate amount of time on the case. I knew I wanted a transparent case. First, I found a lexan case on the web, which I spent alot of time hacking so the Pi and all its connectors would fit. It looked really good. Then I realized, hey, this has to be used with kids, they can break 'pretty near' (Canadian for 'almost') anything. So I built yet another lexan case around it. Next time, I'll simply go to the specialty place where they sell lexan sheets and for not too much money they can build me a case. A couple of aluminum strips attached to the back of the case allow for attaching to a wall.
The device has been running for over three months now, and has been received well. Better still, it hasn't been broken, hardware nor software wise. It is connected wirelessly to ZoomZooms LAN, and its output could, if port forwarding was employed, be visible on the greater Interweb.
All files are up on Github: https://github.com/khekker/CircuitChaser, with the exception of NFC.py and CherryPy, as explained above.
The NFC wristbands I obtained from Overair.ca