View Full Version : Touch-based Row/Column Matrix

04-22-2013, 08:27 PM
I had an idea of making a 7x4 touch panel that would have 28 touch points using 11 touch inputs on the Teensy3. Here is a very simple sketch of a portion of my idea:


Each "button" would consist of two concentric copper tape squares, which are the brown squares in the diagram. I would have a wire for each row and column, represented by the red lines. The inner squares would be soldered to the column wires. The end of the wire would be simply soldered, and then at each junction with subsequent squares, I would splice in a wire that would solder to the inner square. I would do something similar for the row wires as well. The red blobs in the diagram represent where I would be soldering a connection.
In code, I would then check each row and column wire to check for a delta in the touch values to determine which row and column are active, to pinpoint which button is being pressed. I only want to support single touch, so if more than one "button" is being touched, I don't care if I can't determine which exact button was pressed.

I want to know if my idea would work. My main concern is crosstalk between different rows and columns. Would a touch at C1R1 induce a touch reading in R2? I would imagine some amount of change would be registered and I'd have to play with square size/separation distance.

I welcome any thoughts/suggestions to make this work before I go about trying it out.

04-23-2013, 02:48 PM
This might work with the CapacitiveSensor library. But that approach is pretty slow, so scanning a matrix might become painfully slow.

I'd suggest trying touchRead with four 74HC4051 analog mux chips to route 4 of the touch pins to 32 (or 28) electrodes. The touchRead() function returns very quickly, especially if the electrode has low capacitance (it's being touched). You can probably just scan all 28 fast enough using this approach.

I haven't personally tried using touchRead() through an analog mux chip, but I believe it's very likely to work.

04-23-2013, 02:56 PM
Great idea, didn't even think the touch pins would work through a mux, this would greatly simply what I want to do. Thanks!

04-23-2013, 07:38 PM
Yes, it will work through a mux. The wiring and chip routing adds capacitance but if you are careful
this can be small and constant compared to the change you are sensing.
Make sure you clean everything with flux cleaner and you separate the user's finger from the conductors with an insulating plastic or something similar.
You don't want fluids from their body sticking to the circuit board.
You should ground any paths you are not sensing and most arrays such as this work better with a ground plane underneath the board.
There is a nice application note from freescale on these layouts and issues that you can find with a bit of digging around their capacitance sensing chips.

04-23-2013, 07:59 PM
Thanks for the advice Adrian, I'll try finding the application note you mentioned for further guidance.

04-23-2013, 09:24 PM
I found it again: http://www.freescale.com/files/sensors/doc/app_note/AN3863.pdf

04-24-2013, 11:47 AM
Great, thanks!