It's been a while, and we've been concentrating on the "nicer" (i.e. nerdier) side of our electronic board game. That is, storing and retrieving game play data and displaying it on a nice, fancy character LCD. This week, we've been looking more into the actual mechanics of game play. Now, our earlier attempts at tracking playing pieces on a board did work, but the board itself left a little to be desired. Because we were making and breaking contacts on the board surface, the playing side of the board was littered with lots of little metal studs.
These didn't look particularly nice so we've been investigating capacitive sensing - specifically, placing the copper/metallic pads under a printable surface and moving the pieces around on top. This should allow us to create a number of board games with different layouts, finishes etc. but more importantly, to remove the need to drill hundreds and thousands of little holes all over the place.
Cap sensing is quite straight-forward.
Create some large pads, connect to the i/o on your microcontroller, set the pin to output and send it high. Wait a few uS then set the pin to input and give it a few uS to settle. Read the input pin.
If your finger (or an object acting as a ground plane) is over the pad, you've effectively created a miniature capacitor and the input pin will still be high. If there's nothing immediately over the pad, the input pin will be low.
Heres' how we tested the principle:
First cut out some sticky copper tape - we cut around a penny coin and left a trailing "lead" coming off it (so we had something to connect our wires onto, to connect to a PIC microcontroller. We placed three of these onto a sheet of cardboard, then wired them up to PORTB on an 18F2455 chip.
The input pins were pulled to ground through some 500k resistors.
The process described above was carried out and the pads touched with a finger.
The corresponding LEDs lit up as each pad was touched. Next, a sheet of 350gsm (quite thick) cardboard was placed over the pads and the experiment repeated. The LEDs continued to flash as each pad was "touched" through the sheet of cardboard. At least we can be confident that we can create a grid of pads and put a nice, printed face over the top without affecting performance.
Then we placed our penny coins over the pads.
The LEDs did not light, unless the coins were touched. But once they were touched, the effect was the same as touching the pads directly, and through the sheet of cardboard.
One last test remained - if we used metallic playing pieces, with a metallic base, they should behave in the same way our coins were. But what if the playing pieces were coated in acrylic (or other non-conductive) paint? Our last test was to touch the coins "through" a sheet of paper (a shopping receipt was easily to hand).
Now we had a working prototype, we considered how we could detect the presence of a coin above our pads but without the player having to touch them. This proved trickier than we thought. The only progress we made was discovering that touching the piece/penny was the same as connecting it to the ground pin through a wire.