Introduction: Arduino RFID Maze Game
Today I'll be demonstrating how I put together a little RFID maze game for Arduino. The code and 3D print files are included, so feel free to make yourself one following the steps below!
I wanted to make a toy for children, that would blend a virtual and physical experience. With this device they can scan common objects that contain RFID chips (metro cards, pets, clothes, etc) and make these objects more playful and interactive. Every time you find a new RFID chip, the arduino generates a maze for you to solve. Complete the maze and you'll hear a merry jingle through the piezo speaker. The more mazes you solve, the more music you will be able to hear!
Here's what you will need for this project:
- Arduino UNO
- 1588AS LED Matrix,
- 2 x 74HC595 shift registers
- 8 x 220 Ohm resistors
- MFRC522 RFID module
- RFID tags
- 4 x large push buttons
- 2 x thin metal wire (for the hinges)
- wires, solder, perfboard etc.
- 3D printer
I advise you to work out the project on a breadboard first before soldering everything together.
If you want to spare yourself effort of building your own matrix driver with the shift registers you also just buy the very cheap MAX7219 LED Matrix which has the same functionality built in. This will allow you to skip step 1 in its entirety!
Step 1: The LED Matrix
We'll be displaying the game on an 8x8 led matrix, powered by two 74HC595 shift registers. For this I used the following instructable https://www.instructables.com/id/Arduino-88-Led-Matrix-Driver-With-2-74HC595-Shift-/. You can go there for more detailed instructions, but I'll outline the process briefly here.
We'll be using three pins on the arduino to send data, clock and latch to the first shift register. The second shift register will share the clock and latch, but we will patch through the daisychained data from the first shift register. We'll also connect our voltage and ground to both registers. We'll also pull retain info HIGH and disable output LOW.
Now for wiring up these shift registers to the LED matrix. Lay down the LED matrix with the text on the side facing you and the pins facing upward. The pins are numbered like in image 4. In the second image you will see which shift register outputs should be connected to which pins on your matrix.
Step 2: The RFID Reader
Next up is the RFID reader, thankfully it's much easier. Download and install the library into your IDE from: https://github.com/miguelbalboa/rfid
Connect the following RFID pins to these on your arduino:
- RST/Reset RST 9
- SPI SS SDA(SS) 10
- SPI OSI MOSI 11 / ICSP-4
- SPI MISO MISO 12 / ICSP-1
- SPI SCK SCK 13 / ICSP-3
Step 3: The Buttons
We'll be using the internal PULLUP function of the Arduino so we can just connect the switches directly to a pin and then to ground. You can also make external pullups like in the picture.
Step 4: The Code
Download the code from above and look at each of the tabs. The pins used are defined at the top of each tab, change them to fit the pins that you decided to use.. Upload it to your arduino and test the game!
Step 5: The Case
Download the obj files in the zip and export it to your favourite gcode converter. Run it through the 3D printer and you should have a case that fits all of your components.
Solder everything together and fit it into the case. Be careful to keep your wiring as short as possible, because space is limited. Put the hinges of the case together and run a small metal wire through the holes in the hinges. After connecting both sides, you should have a finished product.
I hope that you enjoyed reading about this project and please enjoy!