Monday, April 23, 2018

Conductive Pad Keypad footprint

When you press a key on the Canon P170-DH keypad, it presses a conductive rubber "pill" against a pattern of exposed tracks on the PC board, shorting the tracks together. Here's a link to a good description of how this works. This is what that looks like on the original Canon PCB:

This happens to be the largest of the patterns, under the most used key: the Plus ("+") key. It's about 8mm in diameter, while the smaller pattern is about 6mm. What looks like a single gold track meandering through the hole in the solder mask is actually the bare board between two tan-colored conductive carbon patterns. I don't know why they chose this odd pattern; perhaps it's for reliability, or has something to do with the way carbon tracks are constructed. For the longest time I had no idea what purpose the two exposed pads at 10 and 4 o'clock served, but I've come to believe these are test pads to allow testing of the carbon tracks and have nothing to do with the operation of the keypad.

At first I thought I'd duplicate the original pattern, but didn't have a clue how to do that with KiCad. Several forum members offered their help, making use of various tools to turn the photograph I'd posted into usable footprints. Unfortunately it's reported that KiCad v5 gets upset if you try to put unusual things on copper layers. In the end I decided to go with the more common interleaved copper tracks model.

KiCad has Python scripting support, which makes it very powerful (if you know how to use it). In one of the forum discussions a commenter offered a script that automatically generated such footprints constructed of a series of SMD pads. It took a bit of editing to get the script to run under v5 (it was written for v4), but it produced what looked like a good footprint. However, the result was 80 individual pads that the DRC reported as unconnected even though they overlapped. Multiply that by 37 keys and that's a lot of warnings to ignore, or a lot of extra hand routing.

Fortunately KiCad v5 has a new feature that allows arbitrarily-shaped pads. After spending a few hours figuring out how to use it, I wrote a short C program to calculate and print the coordinates needed to enter the custom pad shape by hand. After creating the custom pad I placed one at (-3,0) mm, the 9 o'clock position. I then placed a second at (+3,0) mm, the 3 o'clock position, rotating it 180 degrees so it meshed with the first. Here's the result:

I'm pretty happy with this. Each of the two "pads" is is drawn with 0.25mm tracks with 0.25mm spacing. The outer arcs are 3mm radius, giving the desired 6mm diameter footprint. There are two 0.25mm square SMD pads at 9 and 3 o'clock for connections, but nothing needs hand routing to avoid DRC errors or warnings. I don't use an autorouter so I don't know if it would know to avoid this pattern. Also, the automatic solder mask aperture wants to put solder mask between the fingers unless I bump up the mask clearance wide enough to prevent it.

Of course this whole process should be automated. I'm in the process of updating my C program so it calculates both haves in preparation for turning it into a Python plug-in for KiCad v5. There are only really two problems with this: I've never worked in Python, and I haven't found any documentation on the KiCad plug-in interface. That'll add a few days to the process.

No comments:

Post a Comment