Wednesday, 22 February 2012

Investigating capacitive sensing

The results from our earlier testing for a multi-plexed capacitive sensing grid are in and...... it's not good. The idea just didn't work. It seems that to use "simple" capacitive sensing - ie energising a pad then checking to see if an input is present a few moments after shutting off the power - the pad has to be directly under the top "plate" of the capacitor (i.e. your finger).

We were hoping that putting power onto a plate immediately to the side of what would be the bottom "plate" would suffice but the only way we could get an inputs to activate was to introduce a "real" capacitor and make a mechanical contact to the plates.

This got us thinking about alternatives for our cap-sensing board (and if it would even be possible). While an RC network on each input pin is immediately obvious, converting this into a grid also gives us a few headaches. So we're now investigating how to use rows and columns of pads and our working cap-sensing prototype

.We already know that we can activate/deactive single input pins one-at-a-time and detect if a piece is above it. But when it comes to multi-plexing, re-using the same inputs for different "rows" of pads is quite tricky. But we've come up with another idea which keeps the same (working) technique and builds on it:

We're going to make strips of pads, all connected in a line. At 90 degrees to these, we'll have strips of pads on the other side of an insulating material. We can then send an entire row high, flip the pin to input and check for a signal on the input pin - just like before. What we're hoping to do is to use the pads running perpendicular to "mask out" some of these pads, so if we get an input high, we know which of the pads in the strip triggered the input.

Let's say the lower (darker) pads in the diagram are on the X axis, and the paler (higher) pads are on the Y axis. We can send row X1 high and check for a high input back. But it could have been any of three pads in that row which triggered the input. BUT - if we send columns Y1 and Y2 high, when row X1 flips to input mode, only capacitance from X1,Y3 will be detected (since when row X1 goes low, Y1 and Y2 stay high, so if your finger is over X1,Y1 or X1,Y2, it won't actually "discharge" until these columns go low as well).

That's the theory anyway.
Once again, it's a bit late to try the whole thing from start to finish, but here's as far as we got:

We started by drawing 1" squares onto a strip of 1" wide sticky copper tape. In the centre of each square, draw around a penny coin. Draw lines to connect all the dics in a row and cut them out using a sharp knife

As we're going to have rows and columns running in opposite directions, we'll need some insulating material and to stick the strips of pads on each side. Ideally we'd have preferred to use tracing paper or tissue paper - but in true "hacker" style we used whatever was to hand; these paper towels were quite thin:

Stick the rows of pads in one direction, and the "columns" at 90 degrees. If we'd used tracing paper, we would be able to see where the pads had been placed on each side - we couldn't and had to guess, which is why they're a little bit out of alignment. We're not even sure if this idea is going to work - let's hope this doesn't prove critical when we come to try it out!

Rather than spend all night making a large grid of pads, we're after proving that the idea works (or, if it's anything like last time, whether it doesn't).  So we've marked the four pads in this arrangement that have pads in both the X and Y axis on opposite sides.

All that's left to do is to write some new firmware and try the idea out!
Unfortunately, it's gone midnight now and with work in the morning, this will have to wait until tomorrow.....