Go Down

Topic: Button pad with arduino? (Read 350 times) previous topic - next topic

1EAS1

Yesterday I found a old button pad from a basic kids batman phone. It does work but now that I have a better home phone it was no longer needed. So I took it apart and found this button pad.http://www.flickr.com/photos/94589858@N06/. Now I want to use it with the arduino Leonardo as a keyboard with my computer and I don't care for the leds either.
I have no clue how to hook it up so if anyone could help me hook it up to the arduino Leonardo would be fantastic. As well I don't know what program/code to make for this to work so if anyone could help me out again that would be awesome!;)

Thanks for all the help!

Erdin

Most of the time, there are colums and rows. But you have to figure out how.
A think the keypad library might work with it, http://playground.arduino.cc/code/Keypad

liudr

So are there 17 buttons? There seems to be a 5-pin connector and a 4-pin connector. Very possible to be a matrix keypad (5*4=20>17) as Erdin pointed out. What are the LEDs doing? back light for buttons?

Sembazuru

As others have guessed, this is probably a 4*5 matrix keyboard. This guess is supported by the labels of the two ribbon connection areas, R1 through R4 (rows 1-4) and C1 through C5 (columns 1-5). My guess is the LEDs are just backlight, also supported by the labels where there is only a LED+ and a GND (matrix keyboard wiring doesn't require GND) so the LEDs are likely not individually addressable.

I agree that the keypad library would work. In order to figure out the row/column assignments for the buttons instead of trying to follow traces just use the library and output to the serial monitor. Modifying the example on the keypad library (see Erdin's reply for the link):

Code: [Select]

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 5; //five columns
char keys[ROWS][COLS] = {
  {'R1C1','R1C2','R1C3','R1C4','R1C5'},
  {'R2C1','R2C2','R2C3','R2C4','R2C5'},
  {'R3C1','R3C2','R3C3','R3C4','R3C5'},
  {'R4C1','R4C2','R4C3','R4C4','R4C5'},
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {10, 9, 8, 7, 6}; //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 != NO_KEY){
    Serial.println(key);
  }
}


This should hopefully tell you on the serial monitor which row and column a key is when you press it. (I haven't tested this code, hopefully it works with multi-character strings in the keymap array "keys". If not, I suppose you could use 0-9 and A-J in the keymap array.) Once you have mapped this out (possibly marking on the board itself next to the contact area with row and column), you can change the constants in the keymap array to something that actually makes sense for your end application.

I know you don't care about the LEDs, but in case that changes in the future... I don't see any resistors on the board, so if you want to use them at some point, it would probably be safe to assume that you need to provide a current limiting resistor off-board. I also can't tell how the LEDs are wired (series, parallel, or some weird series/parallel combination). I do, however, see the flat on the LEDs and their respective silkscreen shapes indicating the cathode (minus side) of each LED. Use of an ohm-meter in continuity mode along with a dose of mental logic might help solve this black-box problem...
http://www.catb.org/jargon/html/I/I-didn-t-change-anything-.html

1EAS1

ok thanks! I'll do some research on 4*5 matrix keypads. and yes the leds were used to light up the buttons;)

Steen

It's perfectly clear how they're hooked up to the connector pins, just follow the marks on the backside of the plate, as well as the led hookup:


Sembazuru


It's perfectly clear how they're hooked up to the connector pins, just follow the marks on the backside of the plate, as well as the led hookup:
{linked picture snipped}

Except that the markings on the back of the board have the buttons in 3 rows and 6 columns (or 6 rows and 3 columns if you turn the board 90 degrees), but the ribbon connection silkscreen indicates 4 rows and 5 columns. Best to run a program that reports which row & column a button is when pressed. Empirical data always trumps guessing and assuming.  :D
http://www.catb.org/jargon/html/I/I-didn-t-change-anything-.html

Go Up