Make a Custom Membrane Keypad for Arduino

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.

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).

That screams fun right?

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.

Future blog posts will cover more details of the final new “front panel” of the toy.  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:

  • A “front decal” layer that has the images of the buttons.  This is what the user sees.
  • A “top foil” layer that contains the traces that link the rows of buttons together and provides “pads” onto which to connect wires.  The top foil layer is the opposite side of the front decal layer (i.e. the “inside” of the front of the keypad).
  • A “bottom foil” layer that contains the traces that link the columns of buttons together and provides pads.  The bottom foil layer is the “inside” of the back of the keypad.
  • A “cutout” layer.  This layer is sandwiched between the top and bottom foil layers and provides just enough separation to prevent the row and column traces from shorting when a button is not pressed.

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  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.

Top 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.

IMG_4596 IMG_4597

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] = {
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(){

void loop(){
  char key = keypad.getKey();

  if (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:

  • It is thin.  Total thickness is two pieces of cardstock paper.  You can make it pretty much as thin as you want it to be.
  • Custom decals.  While the layout of this is still a pretty boring 4×4 keypad, I got to choose my decals.  Some of the matrix keypads out there let you print out buttons and insert them but that would affect thickness and possibly reliability.
  • Custom layout.  I didn’t change the layout or size of the buttons in the example above but using the foil tape lets me effectively have any layout I want to.  Buttons can be arbitrarily placed and the traces can follow arbitrary decal shapes and sizes.  This is critical for replacing the blue toy’s front panel.  I’ll follow up more on this later.

(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 on 1/25/2015

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 on 2/4/2015

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



7 thoughts on “Make a Custom Membrane Keypad for Arduino

  1. Hi,
    This is really cool. I am embarrassed to say I didn’t know about Arduino. What if you want to turn the signal from a pressed membrane keypad into MIDI signal or message? This is essentially what electric keyboards do.

    How hard do you think the programming would be?



    1. The programming should be really easy to turn a key press into a MIDI signal. There is a MIDI library (a collection of code someone else made) located here: Also there is a MIDI example in that comes with the Arduino Development Environment software. To get to it in the menu goto File->Examples->Communication->Midi . Essentially it opens the serial port at 31250 bits per second and sends Note On and Note Off MIDI commands as serial data. The electronics part is easy. It just requires a resistor. The example describes in detail how to wire it up.


    2. I probably should have given the example in the context of the code in this blog post.

      You would change the code to look like:

      void setup(){
      // Set MIDI baud rate:

      // plays a MIDI note. Doesn’t check to see that
      // cmd is greater than 127, or that data values are less than 127:
      void noteOn(int cmd, int pitch, int velocity) {

      void loop(){
      char key = keypad.getKey();

      if (key){
      //Note on channel 1 (0x90), Middle C = 60, middle velocity (0x45):
      noteOn(0x90, 60, 0x45);
      //Note on channel 1 (0x90), Middle C = 60, silent velocity (0x00):
      noteOn(0x90, 60, 0x00);

      // And for completeness of this comment here is the wiring info directly from the example:
      // The circuit:
      // * digital in 1 connected to MIDI jack pin 5
      // * MIDI jack pin 2 connected to ground
      // * MIDI jack pin 4 connected to +5V through 220-ohm resistor
      // Attach a MIDI cable to the jack, then to a MIDI synth, and play music.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s