# Create Own Membrane Matrix Keypad (and Hooking It Up to the Arduino)

February 16th 2010
Other electronics

So you want to create your own membrane keypad? Why? well making your own keypad can be useful for many reasons. It’s cheap and easy to do, it can be placed in situations where it may be vandalized or stolen without much frustration, It can be fully customized to display whatever you like, and you can make as large a keypad as you like with as many inputs as you can handle. I created my keypad to go on the exterior of my door in residence to act as a keypad entry in much the same way as colin353 did here. I however have some more tricks up my sleeve for this coming up in a later Instructable.

NOTE: This is not a complete tutorial for the time being. It goes through the construction of a keypad fully, however it does not yet fully demonstrate the means to make it useful.

# Step 1: Understanding the Keypad

The first thing I want you to understand is how this keypad works. I know what you’re thinking… Matrix keypad?… “I’m not going to have to take any blue pills to get this to work am I?”. No its not that matrix.. The best way to think about a matrix style keypad is to think about battleship.

A matrix is pretty much a grid like in battleship consisting of rows and columns. each button corresponds to a certain row and column. See the first picture to help illustrate this better. On a 9 button keypad you would use 3 rows and 3 columns. The first button would make a link between Row 1 and Column 1 (R1C1) just like in battleship. 2 would be R1C2, 3 R1C3, and lets say 8 would be R3C2… the rest are illustrated on the image.

The point of this is instead of having 9 different buttons to wire up, all you would need to do is wire up 3 columns and 3 rows for significantly less wires. The real benefits come when you begin adding buttons. adding another row and column (2 wires) would add 7 buttons… see where I’m going?

Step 2: Collecting the Materials.

The really cool thing about this instructable is you probably already have all the things you need to build this in your house! Yes when I say that this is a simple, cheap, effective way of making a keypad I mean that it is simple and cheap. For this instructable you will need:

- Aluminum Foil (tin foil… some sort of foil) foil tape works well also
- Some sort of paper or flat material (what you choose here will effect the durability. I’m using a dry erase pad for my fridge)
- glue (unless you’re using foil tape)
- a spacer of some sort (a few layers of paper with holes cut in them may work I’m using double sided sticky foam pads)
- Laminator (COMPLETELY OPTIONAL)

# Step 3: Decision Time

The first step to putting your keypad together is deciding what you want it to look like/how many buttons do you want on it. For this instructable I will be using a 3X3 setup with the numbers from 1 to 9 on it. Once you have decided what it will look like draw it out and decide where you want all the wires to go. I want a lead off from my keypad so it will go around my door so see image 2 for what mine should look like. Make a mock up on your computer using whatever software you like (paint, photoshop, illustrator…) and proceed to the next step.

# Step 4: Mapping Out Your Cheap Matrix

What we are going to be doing is gluing on foil to make a flexible, cheap, however effective circuit board. What we need to do now is on our computer mock up we need to make how our columns and rows are going to be set-up. If you are using Photoshop make 2 new layers, one called rows the other columns. if you’re just using paint make a copy of the file called rows and another columns.

On these new layers we will put large black lines where we want our “Circuits” to go. See image 2 for rows and image 3 columns if you are confused. Image 4 shows what both layers turned on looks like. Starting to look familiar?
Now you need to flip one of your images vertically… or is it horizontally… see image 5 you’ll get what I mean.

Go ahead and print these out for the next step.

# Step 5: Faux Circuit Making Time!

Here is the fun part… well in my opinion the whole thing is fun but whatever…
Now that you have your printed out templates you can start making your circuit. Now is the time to glue down your foil where ever your rows and columns are supposed to go. Look at figure 2 for both of my circuits, yours should look somewhat like this. Also, notice how my leads go away from the keypad in an organized way to facilitate easy hook-up? Just like I planned!

NOTE At this point its a good idea to re-make your front design to include labels for the hookup at the end of the leads with the labels
R1
R2
R3
C3
C2
C1

This is just going to make it easier for you.

# Step 6: Putting It All Together.

In the next step we will be putting it all together. Take your spacers and apply them to one side of your keypad. come to think of it you could technically use silicone (the type used for caulking) as a really decent spacer… I may try this in the future actually…. hmm..

Anyways back on topic. To apply these spacers we need to make sure that there is a hole in the center of them so that the rows and columns can contact one another when they are depressed (not sad… pressed down). I kinda just tiled everything but you could use a hole punch or something to get better results. The spacers are also there to make sure other parts of our circuit do not touch each-other incidentally.

Take a look at image 1 to see all the spacers applied appropriately. Once your spacers have been applied (you may need to glue whatever you are using) you may put the other side of your keypad on top of this one (image 2). Luckily you made sure that everything was mapped out properly on your template on the computer… you did make a template didn’t you?

Image 3 is the pieced together keypad.

OPTIONAL STEP
To help my keypad enjoy a long healthy life I laminated mine. It helps provide some structural support for the paper… constant pressing can and will create depressions (again not sad) in the paper that sooner or later will cause your keypad to become ineffectively pressing that button constantly.

Image 4 would show my beautiful laminated Matrix style keypad however the laminator ate my piece of art.

# Step 7: Arduino Anyone?!

Time to hook up your keypad to the Arduino for the first time… exciting no?

Well Exciting as it may be it’ll have to wait for now! The Laminator lovingly ate my keypad so until I can find the time to make another one then it’ll have to wait. I WILL be coming back so do not to worry this step will come. Perhaps in the near future I will explain how to set it all up and not exactly show it off. For now here is the arduino code I was using with my prototypes for those of you who know where to go from here good luck. For the others sit tight.

NOTE you will have to install the keypad library from arduino.cc

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    #include <Keypad.h>

    int beep = 13; //A buzzer is attatched to pin 13

    const byte ROWS = 3; //four rows
    const byte COLS = 3; //four columns
    char keys[ROWS][COLS] = {
      {'1','2','3'},
      {'4','5','6'},
      {'7','8','9'},
    };

    byte rowPins[ROWS] = {8, 7, 6}; //connect to the row pinouts of the keypad
    byte colPins[COLS] = {5 ,4, 3}; //connect to the column pinouts of the keypad

    Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

    void setup(){
      Serial.begin(9600);
      pinMode(beep, OUTPUT);
    }

    void loop(){
      char key = keypad.getKey();
      if (key != NO_KEY){
        Serial.println(key);
         digitalWrite(beep, HIGH);    // set the buzzer on
        delay(100);
        digitalWrite(beep, LOW);    // set the buzzer off

      }

    }

John Warren

Just a place to make stuff

### Related posts

The Plasma Speaker Saga pt.III