In my last post I was wailing about some bad initial design decisions that caused me some problems with a rapid-prototype I was working on. I have spent the last 12 days re-working the PCB and tweaking the code and can now report success. The capacitive keypad now works, as intended. In order to increase the operational success of the device, I had to make the following changes:
- Directly Wire the Cap-Sense Pads to the Micro: In my estimation, this was the biggest issue. By removing the approximate 10pF of capacitance of the connector and ribbon cable, I was able to have a much finer sensing threshold than before.
- Change from a Matrix to a Direct Sense: In the previous design, I was using a 3×4 matrix to sense 12 keys. Luckily, the Microchip processor that I picked had enough A/D channels to accommodate this. The 12 buttons are still physically a matrix, but I sense each button individually. I also increased the button size. So now the target area of the button is much larger so there is not as much cross-talk between buttons.
- Religiously followed the design guidelines: Microchip has an application note (AN1317) that provides a bunch of design guidelines. I implemented them exactly, to the best of my ability. Some of the design had to violate the recommendations slightly, but overall I tracked the recommendations strictly.
- Made sure to use adhesive: This appears to make a big difference. Using the recommended adhesive for adhering the PCB to the ABS enclosure was a important. Just minute air-gaps will cause the capacitive keypad performance to drop precipitously. Using adhesive does cut down on the ability to prototype though. Basically once the PCB is adhered to the cover plate, you are done re-positioning it.
- Modified the firmware: Previously I was doing a bunch of oversampling and running averages to get a result. However, I was dividing all of that to keep my result within 12 bits. Now, I keep all of the data and precision. This makes sure I don’t loose any information during the division process. I did not really have to do much firmware modification though. I am still trying to sense between a 1% and 2% signal change, but the hardware modifications and better assembly process, seemed to take care of most of the issues.
Overall, I pleased with how the capacitive keypad works. It definitely will cut down on the raw goods pricing of the design as there does not need to be a mechanical keypad or a membrane keypad. There are a couple of drawbacks though.
- Not as low power: Basically, to sense a capacitive touch, a running average must be kept. In order to do that, the micro must wake up periodically. And taking capacitive readings takes about 5ms. That is not much, but it does bump the average current from about 10mA to 40mA.
- Keypad not as robust: Keypads based on mechanical switches have a large inherent noise immunity (aside from debounce). Because the we are only sensing a 1% change, the design is much more susceptible to noise. The initial performance is good, but we are going to need some extensive real-world tested, especially over temperature, to ensure it is robust.
If more details to this saga emerge, I will be sure to update.