The project was done in SF BASIC for a client so I cannot go into too much detail. As for the capacitive touch part, the keyboard is implemented as PCB copper pads on the top side (see picture). Each of the 24 pads is routed through a pair of 16-to-1 multiplexers (74HCT4067) to act as the timing capacitor to a TS555 (CMOS version of 555) timer running at about 2MHz in astable mode.
A timer in the PIC is set up as a counter. It counts the number of pulses in a fixed time frame (I use 2 ms). When a pad is touched, its capacitance increases thereby lowering the frequency (lesser pulse count) of the TS555. You will typically see 10-15% change when a key is touched. Because the capacitance can (and will) drift due to temperature (and the fact that each key will have a slightly different capacitance due to trace length, etc.), you will need to employ some algorithms to ensure accurate readings. There is an app note on the MC website that describes this.
The nice thing about this method is that you can use any PIC - it does not need to have a capacitive sense module to work and uses fewer I/O pins. I implemented a similar scheme using the ARM Cortex M0/M3 but the same principle can be applied to work with just about any microcontroller.
![]()
Bookmarks