Introduction: Monster Mayhem: Using NFC Readers to Release Gumballs Through a Matching Game
Using NFC readers to release gumballs through a matching game.
One NFC reader allows the user to program their NFC card with a Kinoma Create. After programming, the user places the NFC card on the second NFC reader, where they can play a matching game with the second Kinoma Create. With a successful match, the gumball machine releases a gumball.
Parts List:
We used two Kinoma Creates with NFC Controller Breakout Boards to set up the matching game. The second Kinoma Create was also set up to an acrylic gumball machine that would release a gumball via solenoid with a successful match.
- Download Kinoma Studio
- 2 Kinoma Creates
- 2 NFC Controller Breakout Boards (PN532)
- MiFare Classic (13.56MHz RFID/NFC) Cards
- Breadboard Jumper Cables
- Breadboard
- Acrylic Pieces
- Nuts and Bolts, Glue
- Gumballs
- Solenoid
- Large Battery Source (We used 21V)
- Diode
- PNP Transistor
- 68.1 ohm Resistor
Step 1: Basic Measurements
We have proven Kinoma Create can read and write to NFC cards through NFC Breakout Boards while using that information to change something in the physical world. We would be delighted to see others push this concept further with more complex NFC read/write systems and gumball machines.
Step 2: Building Process
We purchased acrylic pieces from Tap Plastic in California. The pieces were put together using glue, nuts and bolts.
One important aspect of the gumball machine is the solenoid design. We opted for a pull solenoid that would obstruct the path of the gumball in the feed tube. When activated, it would be pulled back, releasing the gumball. A spring would pull the solenoid back into position, ready for the next player.
Another design feature is the angled piece of tube at the bottom of the feed tube. This ensures that the falling gumball will dispense out into the capture ring instead of jamming in the tube.
An optional portion of our design is the feed tube going through the entire gumball machine. Gumballs would be loaded at the top and be stopped by the loaded solenoid as previously mentioned. By having a direct tube that fed straight to the dispense tube, we were able to eliminate many potential jamming issues.
Step 3: Wiring
Since the Kinoma Create cannot supply enough voltage or current to fire the solenoid, we needed to wire a simple circuit using a larger power source. We used AA batteries hooked together to create a 21V source. The flyback diode is used to prevent arcing of electricity. The resistor prevents shorting between the 21V source and the Kinoma Create. The transistor acts as a switch for the circuit.
Step 4: Monster Mayhem Code
Download Source Code: Monster Programming -- Monster Matching. Import the apps and needed BLL's into Kinoma Studio. First download the code. The zip file contains the app code and required BLL's. Unzip both files to a directory.
Step 1: In Kinoma Studio, select Import from the File Menu.
Step 2: Select Existing Projects into Workspace.
Step 3: Choose the select root directory option and navigate to the unzipped files. The projects and associated BLL directories should show in the input panel. Select the "Finish" button to complete the import.
At this point, you can edit and run the application files in src. To run each app, navigate to the corresponding application.xml files and click the Run page. You will see your Kinoma Creates if they are on the same Wi-Fi network.
After you launch both the Programming app and the Matching app on separate Kinoma Creates and set up the electronics, you can start playing the game with NFC tags!
Step 5: Code Snippets
This KinomaJS projects has two parts to play the game: programming the NFC card with your character and playing the matching game. They both make use of the read/write abilities of the NFC card
The NFC reader can be used to prompt the application to switch screens. The application constantly checks to see if there is a card within the range of the reader. When the reader detects a card, it sends the card information to the Kinoma Create. The Kinoma Create will act accordingly to the information found on the card. Similarly, the Kinoma Create can use card information to send a signal to fire the solenoid on a successful match.
Congratulations!
You’ve done it! Or if you got stuck along with way, we’re here to help — come visit us at our forum and let us know how we can help.