Remote stations are mounted on posts around town along the Safe Route to School.
When students see a station they hold their NFC School Tag up to the station to
make a record of the visit. The station transfers a record of the station visit
into the tag.
When the student arrives at school, the student tags in at the School Station which reads all of the visits made and rewards the student based on the rules of the game.
- NXP NTAG 213 chips are used in School Tags
- 144 bytes user programmable read/write memory
- 36 four byte pages
- MIFARE Ultralight C
- 144 bytes user programmable read/write memory
- NDEF Records are used to transport data
- 1st Record: URL of Tag's UID
- https://schooltag.org/tag/{UID}
- Android phones will open a browser to view player's scoreboard
- 2nd Record: Mime Type =
text/vnd.stag
;
- entry separator,
- field separator- 1st entry identifies version
1;
- Subsequent entries are visits
{station-id},{timestamp};
- station id is unique within the system
- ids should be short to use fewer bytes
- timestamp is seconds since epoch
- opportunity to reduce size should be explored
- station id is unique within the system
- A message with visits to two stations
1;1Ad,109239092;Pz8,109249393
- 1st Record: URL of Tag's UID
- Timestamps must be available
- Tolerant of +/- 1 minute float every 6 months
- Low Power
- Battery should last 6 months
- Sleeping during hours outside of game time is acceptable and encouraged
These requirements are common requests, but won't be implemented:
- School Identifier
- A single sensor may serve multiple schools
- The connected school station will identify the game being played
- Security to ensure only School Tag can read/write the data
- Make the MFRC522 NDEF library portable
- Make a portable read/write library for the data
The code is written to work with the Arduino dev board which has limitations that must be overcome to match the requirements:
- timestamp
- unique identifer
- low power / sleep
Use this development environment to compile and test the software on the Arduino Uno.
- Download
- Version 1.8.9 confirmed
- Install
MFRC522
Library- Tools -> Manage Libraries ...
- Version 1.4.4 confirmed
- Open
SchoolTag-remote-station-arduino.ino
Verify
- Warnings and notes will appear when compiling the
MFRC522
library the first time.
- Warnings and notes will appear when compiling the
Using VSCode provides a more advanced editor than the Arduino IDE that supports many files with easy linking to code definition. The VSCode editor requires the Arduino IDE to be installed.
- Setup Arduino IDE as described above
- Download
- Version 1.37.1 confirmed
- Install Arduino extension
- Command Palette -> Arduino: Board Config
- Select Board
- Arduino/Geniuno Uno confirmed
- Select Port
/dev/cu.usbmodem...
- Select Programmer can remain unset
- Select Board
- Command Palette -> Arduino: Upload
- Command Palette -> Arduion: Open Serial Monitor
- Set Baud to 9600
- Open .vscode/arduino.json
- Add
"output": "../build",
- Add
When testing the Arduino via the Serial Monitor, the Arduino IDE splash screen will appear.
In the Compiler output you should see similar output:
Starting] Verify sketch - SchoolTag-remote-station-arduino.ino
Please see the build logs in Output path: /Users/aaronroller/dev/projects/school-tag/school-tag-remote-station-arduino/build
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
Sketch uses 10672 bytes (33%) of program storage space. Maximum is 32256 bytes.
Global variables use 293 bytes (14%) of dynamic memory, leaving 1755 bytes for local variables. Maximum is 2048 bytes.
Uploading...
[Done] Uploaded the sketch: SchoolTag-remote-station-arduino.ino
In the Serial Monitor, you should see similar:
[Starting] Opening the serial port - /dev/cu.usbmodem141101
[Info] Opened the serial port - /dev/cu.usbmodem141101
Sketch has been started!