Introduction: SparkTwister: a Wearable Game Using the Spark.io Spark Core

SparkTwister is a physical game for 4 or more players. Each player wears a simple controller bracelet made of a Spark.io board with a SparkButton shield and an RGB sensor. When the game starts, all LEDs on your bracelet light up in the same color. Now you have to find another player with the same color and hold your bracelet against theirs. When you do, the RGB sensor on your bracelet will detect this, and the two of you each score one point. One LED on your bracelets will turn off to indicate this, and the rest will change to a new random color, for which you now have to find a new matching player. So you're always running around, trying to find (and convince) others to pair their color-matching bracelets with yours instead of those of other players. Whoever manages to first turn off all LEDs on their bracelet, wins the game. But of course, who would pair their bracelet with a guy who is only one LED away from winning the game?...

Each bracelet also sends its current player ID, score and color wirelessly to the iWall, an open-source interactive façade display with 20,000 RGB LEDs we developed recently. The iWall displays a current bar chart of all players competing, on the side of our Computer Science building.

SparkTwister was created entirely during our November 2014 Build Night. Thanks to Spark.io and Instructables for your support!

Authors: Dominik Schlütter (Core code), Gustavo Brant de Carvalho Marques (bracelet), David Peters (RGB sensor code), Jan Thar (RGB sensor board), and Prof. Jan Borchers (project lead), all from Dorkbot Aachen at RWTH Aachen University in Germany. Thanks to all other Dorkbotters for their support, especially Wolfgang for his twist on our game idea!

For 8 players, you need:

  • 8 Spark.io Spark Cores
  • 8 Spark.io Spark Buttons (shields)
  • 8 Kingbright KPS-5130PD7C RGB color sensors (e.g., from Farnell Germany)
  • 3 SMD resistors, 0603, for the sensor (1 x 2.2MΩ, 2 x 1MΩ)
  • Eight small custom single-sided sensor PCBs (we provide the design files) as a small shield to hold the SMD RGB color sensor chip
  • 3 strips of 40 straight header pins each for soldering onto each sensor PCB
  • 8 two-pole straight plastic female headers for the battery cables with crimp connectors (and a crimping tool)
  • Eight 3-AAA battery holders with cables
  • 24 AAA alkaline batteries or NiMH rechargeables (eneloops work well)
  • Access to a 60x30cm lasercutter (e.g., an Epilog Zing)
  • One 60x30 cm sheet of 3mm cardboard (we use "Finnpappe") to cut out the double-layer bracelets
  • 6m of 1cm wide Velcro tape for the bracelets (the kind that has hooks on one side and fleece on the other)
  • Eight 20cm cable ties to hold the batteries inside the battery holders and attach them to the bracelet

Step 1: Make the Sensor PCB

We provide the Eagle source files for the schematic and the board above. The files also include PDF renderings of the board and schematic for quick reference.

Solder the RGB sensor, resistors, and pin headers to the board as indicated.

Step 2: Making the Bracelet

  1. Attach the Spark Core and the RGB sensor board to the Spark Button. The RGB sensor board goes into the connectors on the side of the analog pins A0... Vin of the Spark Core, with the RGB sensor facing up and away from the MCU.
  2. Cut out the attached file from the 60x30cm sheet of cardboard with the lasercutter. The "x8" file is in VisiCut format (see http://hci.rwth-aachen.de/visicut) and ready to cut on Epilog laser cutters with VisiCut. However, we've also included DXF and PDF versions of the top and bottom parts of the bracelet.
  3. Sandwich each assembled Spark Button between a top and bottom part of the bracelet
  4. Crimp the female header connectors onto the battery cables, and slide them into the two-pin female plastic headers
  5. Plug the assembled battery connectors into the two separate pins on the RGB sensor board (check polarity)
  6. Put the AAA cells into the battery holder
  7. Attach the battery holder to the bottom part of the bracelet with a cable tie
  8. Loop a 40 cm piece of Velcro through the bracelet and attach it to your wrist
  9. Use a second 30 cm length of Velcro and run it around your battery holder and wrist for extra stability

Step 3: Upload the SparkTwister Code to Your Spark Cores

The game code is rather simple: It turns on all LEDs with a random color, then waits for the RGB sensor to report a matching color, then turns off one LED and turns the rest on in a new random color. This continues until the last LED is turned off, at which point you've won the game and get a rainbow effect.

In practice, things are a little more tricky. For one, the LEDs should really be turned off while we query the RGB sensor (we don't do this yet), because right now we get bias through the color of the LEDs around it reflected back from the surface of the other board. Also, the RGB sensor is rather noisy, and it's a lot of tweaking thresholds to get good color classifications. This should really be done using a proper Support Vector Machine (SVM) algorithm. For now, we get decent classifications with a few simple linear comparisons. We also tried a running average to decide if we are looking at a matching color, but with mixed results. Finally, the sensor also may drift with temperature, so sitting right next to the toasty Spark Core MCU could be a problem.