Make a Custom Membrane Keypad for Arduino

By Paul Bleisch

My son got one of these Leap Frog toys a few years ago as a gift.  He enjoys playing with it very much.  I am not sure how much counting and learning he is doing but it makes funny noises and sings to him so its a lot of fun.

Picture of Leap Frog toy

Recently the unthinkable happened.  It died.  Not the batteries but something else.  I took the back off to look at what might be wrong (which was very easy for a toy).

Unfortunately, other than the speaker, a switch, battery compartment, and a ribbon cable to the front, there wasn’t much to investigate.  A couple of glop tops and nothing else.  I fiddled a bit more with it but everything “external” seemed fine.

Did I mention my son really loves this toy?

It can’t be that hard to make something similar using the carcass of the old one, right?  It has all the external bits and pieces.  I just need to figure out how to take some input and play some sounds. Right?   So I spent a few hours figuring out the basics of what I wanted to change this thing into.  Audio driven from an atmega328.  A simple amplifier.  Make it power friendly (and run off of two AA batteries).

But what about that input?  The original toy had a very thin membrane keyboard basically.  I need a membrane keyboard of my own.   There are a few places that will make custom membrane keypads but that is too costly.  You can buy one of these hobbyist keypads cheaply ($3-$10 from Amazon and less than that from places like DXSoul).

What other options are there?

I decided to make my own.  There are a few tutorials on building membrane keypads. Most of the DIY keypads I’ve found don’t seem like they would be all that reliable nor resilient. I’m not looking for something to last forever but it should last long enough to warrant the 30 minutes of work needed to make it.

The rest of this post will cover a (boring) prototype I used to verify some thinking.

As mentioned earlier, there are sites out there that provide details of what a membrane keypad is and (more generally) what a matrix keypad is.  For my version, I’ll end up with four layers:

I drew the four layers in Adobe Illustrator and printed them out.  The decal layer uses a 4×4 matrix arrangement with some “custom” graphics (thanks icons8.com). After printing out the four layers separately, I had the templates to which I could attach my traces. (As soon as I figured out how to make the traces.)

There are a few options here but I ultimately need the keypad to be as thin as possible and as cheap as possible.  Using paper for the substrate covers those needs pretty well. After a bit of searching around I came across copper foil tape that seems to be popular (or at least known) in the wearable electronics space.

This stuff is pretty cool.  It is tape so it is sticky on one side and thin conductive foil on the other.   It comes on a roll where there is a paper separating each winding.   You unroll some of the tape, cut it off with scissors, peel off the backing and stick it where you want.  To connect two traces you just overlap the tape.  It took a bit to get used to getting the backing off but it is very easy to work with.

In places where I needed multi-layer traces (!) I just used normal masking tape between the layers.  I’m sure this causes some subtle capacitive effect but everything seems to work out.

At the bottom, row and column traces are pulled off the keypad using jumper wires. They are attached using the same copper foil tape.

The top foil layer handles the horizontal traces. I used masking tape to mask off the vertical traces so they wouldn't short out against the bottom foil layer.

The bottom foil layer is simpler and once I was happy with it I glued the cutout layer directly onto it and attached leads there as well.

Final construction of the keypad was to glue the decal layer to one side of a piece of cardstock (thicker paper) and the top foil layer to the other side.  Then I glued the bottom foil+cutout layers to another piece of cardstock.  Finally I glued the two assemblies together.

The final bit was to test out the keypad with an Arduino.  The breadboard and jumpers below are just for my convenience so the keypad could lay flat while I was testing.

Driving the keypad is simple using the existing Arduino Keypad library.  I just had to plug in the right row and column pins.  The code follows (which is just the Keypad sample with the correct row and column information filled in).

    #include <Keypad.h>
    
    const byte ROWS = 4; //four rows
    const byte COLS = 4; //three columns
    char keys[ROWS][COLS] = {
        {'1','2','3','S'},
        {'4','5','6','N'},
        {'7','8','9','P'},
        {'<','0','>','O'}
    };
    byte rowPins[ROWS] = {A0, A1, A2, A3}; //connect to the row pinouts of the keypad
    byte colPins[COLS] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad
    
    Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
    
    void setup(){
        Serial.begin(9600);
    }
    
    void loop(){
        char key = keypad.getKey();
    
        if (key){
        Serial.println(key);
        }
    }
        

In retrospect, I probably should have attached a ribbon cable of some sort to the pads instead of the jumper wire pigtails but this works.

This prototype version of a membrane matrix keypad isn’t necessarily cheaper to build than to buy one of the ones like linked above.  However, this approach has some benefits that are important to fixing the blue toy:

(I’ll clean up the Illustrator files and post them as PDFs.  For some reason when I view the ones I uploaded, all layers are baked together.  When I view the local files I just uploaded they look correct.  Odd.)

Update #1

A few people have noted that I could just use off the shelf parts or try to mimic the tactile feedback of membrane keyboards using domes for the buttons. In this case, I was mainly going for a very thin keypad where there are no physical switches and the circuitry is on the structure itself. The post is really about the prototype I made to figure out how well this method works.

The original toy had this great “touch panel” feel. It recognized soft touches and there was no tactile response. Even though it used a matrix keypad, the button shapes and thinness helped give a nice feel to the toy that I want to replicate. I’ll write up the actual replacement I made for the toy and hopefully it will make more sense why I wanted something without off the shelf switches or domes.  For a sneak peek, here is the new keypad decal layer where each truck, person, etc… you see is a button that is shaped roughly like the sticker you see.

Update #2

Here’s a Fritzing diagram for those curious what the circuit looks like.  This uses tact switches for the matrix keypad.