Interface 4x4 matrix keypad to AT91EB55 board

Hi all, I'm new to this group and I'm hoping someone could please help with this issue. I'm trying to interface a 4x4 matrix keypad to Atmel's AT91EB55 board. The issue that I'm facing is that this board does not have a keypad port but it does have many ADCs on it. I'm also trying to limit the number of IOs I have to use.

This keypad is the common 4x4 keypad; that is, you provide voltages to the columns (or rows) and then scan the rows. Anytime a button is pushed, a short takes place and one of the four row pins goes high.

I have looked into a resistor network that will give me unique voltage values such that I can input them to the ADC to give me a unique digital output. This didn't work too well for me as a couple of button's voltages were too close to differentiate; this was also because I only have access to 5% resistors.

Would someone be able to help me out with this? Thank you very much!

Reply to
RaMbO
Loading thread data ...

--- If you can spare 4 I/Os you can do it like this: (View in Courier)

Vcc>---------------------------+---+---+---+ | | | | +-------+ [R] [R] [R] [R] |__ __| | | | | OUT0>----------O|LE Y0|O-----X---X---X---X--- | __| | | | | OUT1>-----+-----|A0 Y1|O-----X---X---X---X--- | | __| | | | | OUT2>--+--|-----|A1 Y2|O-----X---X---X---X--- | | | __| | | | | | | +--|A2 Y3|O-----X---X---X---X--- | | | +-------+ | | | | | | | 137 | | | | | | GND | | | | | | | | | | | | +----+---+---+---+--+ | +---------------|S0 IN0 IN1 IN2 IN3 | | | | +------------------|S1 Y|--+ |_ | | +--|E | | | +-------------------+ | GND 153 | | IN0

Reply to
John Fields

:-) normal practice is to use 8 pins to reado one of them.

assuming a 5V supply you'd want arounsd 0.3V steps between buttons

germanium diodes have Vf of 0.2V, maybe you could use a bunch of them?

+--------------------------- output | | 4x germanium diode | +5-[10K]-+->|--+->|--+->|--+-->|--+ | | | | | | | | | +---+ | | | | | ---|-----|-----|-----|--+->|->|-+ | | | | | | | | | +-||-+ | | | | | 15x germanium diiode | | | | +-|
Reply to
Jasen Betts

Hi John, Thanks for your reply! I had a few questions regarding your suggestion, as I'm quite new the realm of microcontrollers.

1) Where would I find these "137" and "153" chips? I've tried looking on the web but I couldn't find anything. At least if there's a specification for what these chips do, that would be great!

2) Since I don't know what the chips do yet, where do the "OUTx" signals come from and where would "IN0" go to?

Your help is greatly appreciated.

Reply to
RaMbO

--
http://focus.ti.com/lit/ds/symlink/cd74hc137.pdf
http://focus.ti.com/lit/ds/symlink/sn74hc153.pdf
Reply to
John Fields

This will get you down to 4 pins:

formatting link
You can also mux the port with a LCD display if you want.

In general, I've found that using a part with more pins is easier than adding ANY additional hardware. You may save a pin or two by adding two extra parts, but that's counter to the idea of using the UC to do everything. If you're building one, it's cost effective to add a uC to do the peripheral functions. Fewer parts, less space, more flexibility.

YOu have several choices with resistors. You can select from 5% resistors to guarantee sufficient voltage difference. Assume you're only gonna build one??? You can add a calibration method. You can split into two resistor networks to get more difference.

Another interesting possibility is to use RS-232 and an external keyboard. A $10 garage sale HP200LX makes an excellent keyboard/display for uC projects. Can also do the same with a PDA, but I've not tried it.

--
Wanted, Serial cable for Dell Axim X5 PDA.
Return address is VALID but some sites block emails
with links.  Delete this sig when replying.
FS 500MHz Tek DSOscilloscope TDS540 Make Offer
Bunch of stuff For Sale and Wanted at the link below.
MAKE THE OBVIOUS CHANGES TO THE LINK
http://www.geocities.com/SiliconValley/Monitor/4710/
Reply to
mike

Hi John, Thanks for the great idea. Everything looks good from a theoretical perspective; now I'm actually going to try and build version in addition to the others.

Thanks again!

Reply to
RaMbO

Hi Jasen, I'm not sure if I understand this correctly and perhaps, you can clarify a few things for me.

1) On the following row, I would expect the rightmost column to be at 4.6 (which it is) but the voltage should be increasing as we move to the left. According to your matrix of values for the first row (3.8 4.0 4.2 4.4) seems to be the reverse.

+5-[10K]-+->|--+->|--+->|--+-->|--+

Also, I didn't mention this but I'm forced to use a 3.3V supply and with a 4x4 matrix keypad that basically scans all rows (columns) to determine which button was pushed.

In your diagram, I got confused probably because I couldn't see where the connection point are to be. Maybe you can specify this for me?

Also, there seems to be more than 15x diodes along the vertical side. Is this a typo or by intention?

Thanks for your help as well.

Reply to
RaMbO

Hi Mike, Thanks for the feedback and the link to the site. This procedure is quite similar to the case Jasen mentioned but using a PIC instead. I will probably investigate this route as well if time permits.

The reason I'm using the 4x4 keypad (pre-built from Grayhills) is because I'm forced to use them. I'm currently helping make labs for a uC course more robust.

Thanks again!

Reply to
RaMbO

that matrix was upside down too. pushing top left button bypasses most of the diodes and pulls the output down to O.6V

you may have to swap the diodes for 1% resitors, 16x0.2 is 3.2 V which is way too close to 3.3 to do anything with.

that'd require a reasonably constant current source to feed the chain.

if the resistors were all 1K a 15K resistor might do for a current source but it'd compress the output range in a non-linear way to 0.2 - 1.6V

use 16x 1K resistors instead of mixing sizes (where there are some in series) if they all come from the same batch (off the same strip of paper) they will more closely matched than 1%.

at the top just after the 10K resistor.

typo... I think I forgot to count the ones going to ground.

this is probably not a good design, none of the experts here mentioned enything like it. The could be in awe of my brilliance, but I think not more likely they're ignoring me.

some problem that I see with it are

1> it wastes electricity (this may not be a problem for you) 2> it's hard to read, - you need to debounce an analogue signal. 3> it's hard to maintain - dirty contacts will result in incorrect or eratic reads.

I think their advice to use a micro with more pins is probablly the wisest option.

--

Bye.
   Jasen
Reply to
Jasen Betts

Thanks for the follow-up on this issue Jasen.

I'm currently looking into the uC option.

Reply to
RaMbO

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.