Introduction: Wireless Quiz Game

I was commissioned to build this wireless game-show type quizzing system for an AWANA Bible Quizzing event, but it could be used for any sort of quizzing game.  The system was designed to allow for three choices (A, B, or C) for multiple choice questions, or to allow for speed type questions (where the first contestant to "buzz in" gets to answer the question).

This build uses Synapse radio modules (2.4 GHz) for wireless communication; one in each Quiz Box and one connected to a PC via USB (for viewing/scoring).  The PC program is written in Java, so could be run on any operating system, although, the serial USB connection is OS specific and I have only implemented it on Windows.

The build requires beginner to intermediate soldering skills.  Also, you will have to send the electrical schematic files (that I have created) to a printed circuit board (PCB) manufacturer to be manufactured.  In addition, you will need to be able to perform some drilling in the plastic quiz box.  Also, if you want to add the acrylic LED shields, you will have to use a heat gun to bend them into shape.

The Bill Of Materials is attached below, and can also be found at: http://code.google.com/p/quiz-box (along with source code and other documents).  You will need to download the BOM to get a list of the parts you will need, along with the suppliers.

Step 1: Soldering the PCB

You will need a printed circuit board for each quiz box.  There are a few options for getting them.  You could make them yourself (difficult).  Or, you could send the eagle files (from http://code.google.com/p/quiz-box) to a PCB manufacturer and have them make your PCBs -- this can be relatively inexpensive and easy; some place like Seeed Studio is a good place to start.

On the download page in the google code site, I have placed a file, qb_docs_v2.zip.  In that file there is another zip file containing the gerber files that a PCB manufacturer would need.  You could use this, but it would be better if you learned how to generate your own, that way you could check it, add the order number, etc.

Once you have a PCB, you will find that it will require some soldering.  There are two ribbon cable headers, two radio module headers and 4 resistors to solder in place.  The resistor values are not very critical, I chose them to make a nice balance in the brightness of the LEDs, I might try to tweak them in the future to be a bit brighter and use more common resister values.  UPDATE: I've since tweaked the resistors, now they are: 470, 220, 100, 1K ohm for RYGB respectively (originally they were 610,270,100,100; then 510,270,180,820).

The radio module headers are the trickiest.  They require care, because if done incorrectly, solder will wick up into the sockets and prevent the radio from being plugged in.  If this happens, the best thing to do is to pull the plastic header part of with pliers, de-solder the pins, and try again with a new header.  I've found that the best way to avoid this is to tape some masking tape over the open end of the header (see picture).  Make sure that it goes as far back against the pins as possible, and use a small flat head screwdriver or similar tool to press the tape on.  Then, put the header in the PCB and solder in place.  Use a temperature controlled soldering iron and make sure that it is set at a low temperature (around 325 C works well for me).  Try to apply the minimum amount of solder in order to get a good solder joint.  Test fit the radio when done.

Update: I've found a better way to solder the radio headers.  Just put the masking tape over the holes in the PCB, then poke holes in the tape with a pin (it may help to hold up to a light to see through the tape).  Then score the tape along the holes with a knife.  Finally, push the header into place, through the pin holes.  After soldering, just pull the tape out from either end (it should break where it was scored).

The ribbon cable headers and resistors are easy in comparison.  Just make sure the cable headers are straight.  Bend the resistor wires as needed to fit them in.

Step 2: Solder the Button Wiring Harness

Each of the 3 buttons will need to be soldered to the 6-wire ribbon cable.  Start by cutting of a 6 inch length of ribbon cable.  I found it worked best to use quick disconnect terminals to connect the ribbon cable to the button.  Basically, you attach one quick disconnect to each wire on the cable.  The ribbon cable wire is a little too small to connect directly to my quick disconnects, so I crimped and soldered a short segment of 22 gauge wire (1.5 inches) to the quick disconnects.  Note, I have found some quick disconnects that work better with smaller wire, so the 22 gauge wire may not be necessary.  I hot glued the connection for added strain relief.  I then soldered and heat shrink tubed the 22 gauge wires to the ribbon cable wires.  Make sure that you put the heat shrink tube over the wire before you solder to the ribbon cable wire.

Finally, crimp the 6 pin connector onto the ribbon.  This is best done with a vice, with smooth jaws, or something smooth over the jaws, so that the connector does not get chewed up.  The vice will allow you to get the connector on parallel and positioned correctly.  Press the two halves of the connector over the cable carefully and slowly, until they are just touching and they snap into place.  Put the connector on so that the cable goes out over the end of the PCB with the red and brown wire on the red pin as labeled in the PCB.

Step 3: Solder the LED Wiring Harness

Each of the 4 LEDs and the battery wires will need to be soldered to the 10-wire ribbon cable.  Start by cutting of a 6 inch length of ribbon cable.  Take care to solder the wires to the correct terminals on the LEDs; they are polarized, so you must wire them correctly in order for them to work.  On an LED the longer wire is the anode (+) and the shorter wire (on flat side) is the cathode (-/ground) -- see picture.  Also, take care with the battery wires, they are counter-intuitive.

Red LED:     (+) = Red wire,     (-) = Brown wire
Yellow LED: (+) = Yellow wire, (-) = Orange wire
Green LED: (+) = Blue wire,     (-) = Green wire
Blue LED:    (+) = Gray wire,     (-) = Purple wire

Red Battery: BLACK wire
Black Battery: WHITE wire

Note:  I find the best way to solder these is to cut/pull the individual wires apart from the ribbon cable an inch or so, and separate pairs of wires down 2 or 3 inches  (see picture).  Next, put some heat shrink tubing over each wire (and put a larger heat shrink tube over the pair of wires), strip the wire, wrap the wire around the LED wire,  solder it, cut off the excess, move the tube over the joint, heat shrink, and finally heat-shrink the pair of wires.

Finally, crimp the 10-pin connector onto the ribbon.  This is best done with a vice, with smooth jaws, or something smooth over the jaws, so that the connector does not get chewed up.  The vice will allow you to get the connector on parallel and positioned correctly.  Press the two halves of the connector over the cable carefully and slowly, until they are just touching and they snap into place.  Put the connector on so that the cable goes out over the end of the PCB with the red and brown wire on the red pin as labeled in the PCB.

Step 4: Drill Button and LED Holes in Box

Print out the attached PDF and cut out to use as a template for drilling holes in the Radio Shack project box.  The LED and button mounting holes are drilled in the lid, and a battery switch access hole is drilled in the box bottom.  The template should be attached to the outside of the lid (for alignment, try pushing the box screws through the template).  Use a sharp awl to mark where the holes should be drilled, then remove the template.  Use a paddle bit (1-1/16" or 1-1/8") for the large button holes; a drill press is nice, but not necessary.  Use a 1/4" twist drill for the LEDs.

For the battery access hole, place the template on the outside of the bottom of the box and mark.  Remove the template and drill a 3/8" hole with a twist drill.

Step 5: Assemble the Box

First, use double sided tape to attach the 2-AA battery box to the bottom of the project box, taking care to position the on/off switch over the access hole that you drilled in the previous step.  Next, mount the buttons on the lid, and also mount the LEDs in the lid, using the Radio Shack LED mounts (which clip the LEDs in place).  Attach the ribbon cables and the synapse RF266 radio to the PCB, and slide the PCB into the project box (see picture).  Carefully arrange the wires so that everything fits and put the lid on the box.

Congrats, you should now have a working QuizBox!  (Well, it still needs to be programmed).  If you have a fresh from the factory (default) RF266 installed in it, you should see the yellow LED light up, and nothing else.  The buttons will not respond, yet.  Skip ahead to step 7 to program a more useful box, or continue on with the next step to first create a light "visor" for your box (this next step is optional).

Step 6: Create the LED "visor"

This step is optional. 

I created a "visor" for the box, to hide the status LEDs from other teams.  You could cut the pattern out of clear, 2mm acrylic yourself, or you can get it precision laser cut at Ponoko: http://www.ponoko.com/design-your-own/products/quizbox-eyeshade-x25-8721

Once you have the acrylic cut, you will need to bend it to shape.  Each of the two ends will need to be bent twice, to form a long angled piece with flat tabs on the end (see pictures).  I used a hot air gun and a thin piece of wood with a notch cut in it to direct the hot air along the line that I wanted to bend (I also added some sheet metal to the notched board, to keep it from burning).  Make sure that you get the acrylic plenty hot, it should bend easily (or it will break).  If it starts to bubble, it is getting too hot and will burn.  Try heating on both sides.  After it is hot enough, bend the acrylic along the line around a square piece of wood, with rounded edges, hold it for a few seconds until it cools enough to hold its shape.  Take care, the acrylic and the notched wood both get very hot -- you may want to wear leather gloves.

Once the acrylic is bent, place it over the quiz box lid and mark where the screw holes are with a sharpy.  You can then drill one hole on each tab, just large enough for the screw shaft to go through (1/8 inch).  Finally, print the visor pattern (from the pdf) on some brightly colored paper and cut out with scissors.  Bend the paper inside the visor (to block the light!) and screw the assembly to the Quiz Box.  You are done!


Step 7: Connect Base and Program Quiz Boxes

Connect an RF266 to a USB adapter (for example the Sparkfun XBee Explorer USB). Next download the Portal application from the Synapse website at: http://synapse-wireless.com/

Install Portal.  Open the script directory in MyDocuments/Portal/SnappyImages.

DownloadQuiz2_install.zip from http://code.google.com/p/quiz-box/downloads/list  This zip file contains (among other things) a Snappy directory that contains the "Remote5.py" and "Base5.py" files that you will need to program your RF266 radio modules.  You will need to copy these to files into your Documents/Portal/SnappyImages directory on your hard drive.

Start up Portal and plug the USB adapter into your computer.  Portal will ask you to connect to a port.  You will need to hit cancel, because you do not yet have a port that Portal understands --  Synapse sends the RF266's pre-loaded with a script that isn't very useful and prevents Portal from recognizing the module.  You will need to erase the script.  From the Portal menu select 'Options' - 'Erase SNAPpy Image..."  This will bring up a dialog with some parameters to enter.  Enter the com port (if there are more than one com ports in use, you may have to unplug your RF266 USB adapter and watch which com port goes away).  Next enter the platform, this will be "RF266".  Finally, press "Erase".  Wait for a dialog to pop up that says "Please restart your device to start the erase".  At this point, you need a jumper wire to connect the reset pin to ground on the RF266  (see picture).  The module should be quickly erased by Portal.  You do not need to erase any more modules.

Now, you can program a quiz box!  Turn one on (with an RF266 in it), you should see (only) a solid yellow light, indicating that it needs to be programmed.   In Portal, press the "Watch" button, a new node should show up in the Node View called "AtCommandInterpretor"  (see picture).  Look for the network address that matches the address printed on the RF266.  Select the new node in the Node View and press the refresh button in the Node Info tab.  Next, press the Upload SNAPpy Image button and upload the remote.py script.  After it uploads, press the Configuration Parameters button and set the Device Name to a short name that makes sense, like "AWANA_01".  Also, set the Device Type to "remote".    Also, you may want to (maybe not now but later) change the "Network ID" and "Channel" to something other than the default -- note that in order to communicate, both/all modules must have the same network ID and channel.

Now, find the "SNAPpy Modules" listed on the right side of the Node Info tab and find a function called "setBaseNodeAddr(address)"  Click on this and you should get a dialog with an "address" text entry box.  Enter the six characters of the address (as seen on the Node Views tab) - in quotes.  It will look something like: "\x5D\x24\xBD" -- remember to include the quotes, backslashes and x's.  Now, find the "setNodeName(name)" and enter a very short name (in quotes) -- something like "A01".

Now check your quiz box, the power light should be blinking blue (the base is not programmed yet -- wait to do this later).  And, the red, yellow, and green LED's should turn on in response to pressing the buttons.

You can now program the reset of your quiz boxes, just remember to give each one a unique name -- this will make it easier to identify them later on.



Step 8: Program the Base

The Portal application has a requirement that it can only communicate with an unscripted  (erased) module.  So, you want to leave uploaded the script to the base until after you are done with setting up all the modules.  Before uploading the script, you will also want to set any configuration parameters on the base as explained in step 7.  (Configuration parameters are retained when uploading or erasing scripts).

Once you have the configuration parameters set, you can upload the base script in the same way that you uploaded the remote script.  

In the last step, you already downloaded Quiz2_install.zip from http://code.google.com/p/quiz-box/downloads/list and you copied the "Base5.py" file from the zip into your Documents/Portal/SnappyImages directory.  Return to Portal and select the base node in the Node View and press the refresh button in the Node Info tab.  Next, press the Upload SNAPpy Image button and upload the base.py script.

Now that you have a base unit and remote quiz boxes, you can use the quizzing software.

Step 9: Run the Java Quizzing Program

Go to: code.google.com/p/quiz-box/downloads

Download the files (Quiz2_9.jar (and quiz2_install.zip -- if you haven't already)) and extract to your hard drive.  Also, download and read the "README.txt" file; there are some additional files that you will need to download rxtx here and install (make sure that you get 64 bit, if you are on Windows 64 bit).   Also, you will need Java 7 JRE (Java Runtime Environment) installed on your computer : download here.

In addition, you will need to open the file "quizzing.properties" in the install directory and change the port (2nd line) to the actual port number of your USB explorer.

Also, you will need to open the file "QuizResults.csv" in the same directory and setup the boxes.  The first column contains the box number and box id, for example: "1_0x5D24BE" where "1" is the box number and "5D24BE" is the id (which is the last 6 digits printed on the actual RF266 module.  The second column is the team name.  You may change this to whatever you like.  The next column is the current team score; set this to zero.  Next is the place (as in 1st, 2nd, 3rd); set this to zero also.  Finally, set the speed count to zero (this is a counter used so that the number of speed questions that a team answers can be limited).

One of the uses of the QuizResults file (in addition to loading teams) is to record the results, which is the purpose of the score and place columns.  In addition to reading in the team names on loading, the app also loads the scores, so that a game may be picked-up where it left off.