Electric Imp guest blogger Richie Zeng is a UC Berkeley student majoring in Electrical Engineering and Computer Science.
At this year’s Big Hack, an annual 24 hour competitive hackathon between UC Berkeley and Stanford University CS students, our team built something that our 8-year-old selves would have only dreamed of having – which ended up winning the competition’s best hardware prize! My team from UC Berkeley – Nikitia Kitaev, Vaishaal Shankar, Sumukh Sridhara, and I – had grown up watching Yu-Gi-Oh!, a popular television show in the early 2000s.
Unfortunately, the current state of holography technology is limited to trivial things like making Tupac appear onstage with Snoop Dogg, and not important things like children’s card games. So instead, we did the next best thing, which was to create a 3D environment in the browser. Three.js worked well for creating the environment with the game board and the cards, and we were lucky enough to find 3D models of some monsters ripped from an old Yu-Gi-Oh! GameCube game.
The next issue was recognizing when a card was played and where on the field it was played. For that we used a webcam mounted above a playing field and OpenCV to detect the position of cards. As is normally the case with computer vision, lighting and background color was a big issue, so we put our cards into red card sleeves to better detect them.
Finally, we had to figure out a way to detect which card was being played, and for that we used RFID. We slipped an RFID tag into the card sleeves so we could map an ID to a card. We used a fairly standard RFID sensor and connected it to the Electric Imp to let it communicate with the web server running our game. Originally, we were planning to hook up an Arduino with a WiFi shield to do the same thing, which would have made the device significantly bulkier. With the imp, our hardware was small enough to stuff into a glove so the cards would get scanned as they were being played.
If that was a bit too much to absorb, here’s a tastefully designed graphic:
As you can see, we had to work with many different technologies to build this system. There were so many possible points of failure and technical challenges that it was surprising the system worked as well as it did, especially in 24 hours. We owe a lot of that to imp, which made interfacing with our hardware almost trivial. The fact that there was no software to set up on my machine and that all the infrastructure was in the cloud was critical in our fast development process.
If you want to take a look at our implementation, you can find everything on GitHub.
This was actually the first hackathon I’ve done where I was working on the hardware portion of the project, and the Electric Imp guys were super helpful in getting it up and running!
Thanks, Electric Imp!
Richie Zeng
EECS ‘15 at UC Berkeley