As part of my bachelor project I decided to work with Near Field Communication. I had specifically played with the thought of NFC enabled games. I was primarily thinking about how NFC is to this day mostly used as a means of mobile payment and small data transfer, and I basically sought out to find other contexts in which NFC could be deemed useful, and thus my choice landed on games that uses NFC. I will use this page as a means of documentation of the process I went through creating this game. The following concept was created using an Arduino Mega with a NFC shield, 25 LED’s and wire, and wood for the game board. I bought the wood and the Arduino Mega myself, but everything is already available at DDLab.
The concept of the game is a rather simple one, a game board consisting of 5×5 tiles was created for the players. The game was created for 2 players. Each of the aforementioned tiles had an LED placed in them and the goal of the games was to not step on an illuminated field. In the middle of the game board an Arduino Mega with a NFC reader was placed that was used to illuminate or turn off these LEDs. Players would take turns marking these fields as illuminated, this was done from an Android application made for the specific purpose of this game.
I started out in september by starting to code the Android application, Java coding was not something I had done before, but luckily there’s so many amazing helpful ressources when it comes to coding Android. (open source, yay!)
I knew I needed an application that could turn on these 25 LEDs individually, and because of the time pressure I decided not to create anything fancy, I simply wound up creating and application that consisted of 25 toggle buttons, depending on the state of these buttons the application would either send out a 0 or a 1 (off or on state for the specific LED). Below you can see an image from the NFC application.
I had initially planned a P2P way of communicating from the Android phone to the Arduino NFC shield, but because of the lack of documentation for the NFC Shield I had to improvise. The only way I could get the NFC shield to read NFC data from the phone was to process the information being received as an URL. The reason behind this is that the Android operating system pushes NCF data in the NDEF format, and the NFC Shield lacked documentation for this part, I did however manage to find an example for NDEF URLs, that could be appropriated to be used in this example. The downside of having to do it this way was that the players needed to use a NFC tag to write their game moves onto. So the communication would be from the phone where the player would devise his game move, and then write it onto a NFC tag which then needed to be placed on the NFC Arduino shield in order to be processed.
After creating the Android application I moved onto the NFC shield for the Arduino, as mentioned it was pretty difficult due to the lack of documentation for the shield. I will provide the source code asap.
I then moved on to creating the physical game board itself, I bought some wood, lent some wire, and 25 LEDs from DDLab and started working.
As can be seen above a lot of fiddling and soldering with the wires was required. But in the end I managed to get it working.
Here’s a short video of me testing the prototype on a smaller scale before construction of the game board.
As can be seen in the video above I am controlling the Arduino with messages (URLs as mentioned before) on the NFC tags. These tags are read by the Arduino and then processed in Max 6 which then controls the lighting as well, for the final board the Max patch looked like this:
Just before testing the prototype I shot another solo video testing the final prototype.
And after that the prototype was tested, users quickly picked up the rules of the game. What the videos below didn’t illustrate was that when a player had placed a NFC tag on top of the NFC shield a buzzer would sound and serve as feedback that the actions had been initiated, players then had 3 seconds, before the final buzzer that had a distinctive sound was played, upon hearing this sound players were not allowed to stand on an illuminated field. Furthermore, the players were only allowed to move once per move.:
Above a player can be seen devising a plan on the tablet. He then proceeded to place a NFC tag on the back of it to write his move onto it, and then placed it on the NFC Shield.
And here is the final video of the prototype in action.
This was a very rough update on my project. I shall expand on coding and provide source code as soon as I’m done with the next exam. Also more text will be in bound at some point in the future.