Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

keypad over one wire

Status
Not open for further replies.

arhi

Member
I needed it few hours ago and was unable to find anything "ready to use" so I made it myself.... The principle is fairly simple ... add few resistors to the keypad so you get different resistance for each key, use that resulting keypad as voltage divider (vpp to gnd) and feed the output to ADC of your uC... read the adc, decode the key pressed :)

Attached is schematic (small pic using adc to get the info from keypad and 2 shift's to turn on the "approprate" led). The attached code is in MikroC but it is really simple to write it in any language.
 

Attachments

  • adc_leds.c
    1.7 KB · Views: 381
  • keypad_single_line_interface.png
    keypad_single_line_interface.png
    28.2 KB · Views: 1,674
I needed it few hours ago and was unable to find anything "ready to use" so I made it myself.... The principle is fairly simple ... add few resistors to the keypad so you get different resistance for each key, use that resulting keypad as voltage divider (vpp to gnd) and feed the output to ADC of your uC... read the adc, decode the key pressed :)

It's a standard technique, and has been used for decades - the second generation VHS VCR's even used it on their cable connected remote control.

It's just a question of working out sensible value resistors - and there's a thread on here somewhere where the calculations were provided.
 
I personally hate this solution. It is so slow and error prone that it is almost unusable. Just use a bigger chip and read it in the normal way.

Mike.
 
nigel, I first spent 10min on advanced search of this forum, then another 15 on google and then 10 making the circuit as I was unable to find anything on-line (I'm sure there's ton's of it as it is - easy to make, useful...) but seams I was using wrong keywords to find it :) ...

pretty sure that "one more solution" will not hurt :) (and yes, I'm pretty sure I did not invent hot water :D )

Pommie, depends on what ya need.. if I'm to design a "alarm system" or something like that, I'd scan keypad (using io pins directly or port extender or ...) and would not use the adc to do it .. but for breadboarding .. I often need few switches to test "this and that" which will not be in final "product" and this is the easy way to implement this :)
 
nigel, I first spent 10min on advanced search of this forum, then another 15 on google and then 10 making the circuit as I was unable to find anything on-line (I'm sure there's ton's of it as it is - easy to make, useful...) but seams I was using wrong keywords to find it :) ...

Searching and finding things isn't easy :D

Notice I didn't attempt to give you a direct link to the previous threads ;)
 
Just a quick point to think about (because JVC obviously didn't), choose which button you use for what function carefully.

The JVC cable remotes commonly failed on the screened wired it connected via (as you would expect) - the result was that any button you pressed was read as 'record' and wrote over the tape you were perhaps wanting to watch :D
 
Nigel Goodwin;707156(because JVC obviously didn't) the result was that any button you pressed was read as 'record' and wrote over the tape you were perhaps wanting to watch :D[/QUOTE said:
:eek::eek::eek::eek::eek:

now that's safe :D

Anyhow, I would never use the AD for anything in production... maybe it is safe, maybe it is not, but there's just too much room for error... I need this for everyday testing ... insted of
a:
- undefine that
- define this
- compile
- test
goto a

I make a big switch instead of big ifdef and test different things on "press of a button" :) and this give's me 12 switches on one pin :)
 
Anyhow, I would never use the AD for anything in production... maybe it is safe, maybe it is not, but there's just too much room for error...

It's really pretty common, although it is usually restriced to just a few keys - the larger the number of keys the poorer it's going to be.

I would suggest you've probably got at least one item (and probably more) in your home that does this.
 
I would suggest you've probably got at least one item (and probably more) in your home that does this.

wanna bet ? ... no tv, no vcr, not a single remote, wired or wireless in whole appt .... over 10 computers but only few keyboards and all very expensive ones :D .. there's a really small chance that some of the phones do that, but I don;t think so :)
 
Maybe here

EDN magazine online run, around one year ago, some articles with designs to read a keyboard using few pins.

Honestly I do not know how to search for them.

The theory justifying the resistor values was not hard to follow.
 
Last edited:
The theory justifying the resistor values was not hard to follow.

the theory is straight forward ... look at the longest path, divide by number of elements in a path and that;s it ... in general for X*Y matrix, on the X side use (X-1) R and on Y side (Y-1) R*(X) .. select R to be some arbitrary value .. (I used 10K) so in this case for R = 10K 3x4 keypad uses 2 10K resistors and 3 30K resistors ... if it was 4x4 keypad for example, with R=10 you would use 3 10K resistors and 3 40K resistors ..

There might be "smarter" way to do it, and 5% tolerance might work .. but this is what first came to my mind :) and as I have bunch of 1% resistors I used them and keypad works perfectly :D (I read correct key every time ... funny results with multiple key;s dough)
 
Hi arhi,

I don't care for ADC input method for many of the reasons already mentioned but I must say your keypad method is very clever and creative. Bravo Sir.

Mike
 
can u send me the 4x3 keypad header files for PIC 18F4620.....

for what compiler?


method is very clever and creative
Thanks Mike, the method is not new .. it's kind of "hot water" thing, but I need it for "testing purposes" .. (reducing number of switches going to breadboard :D ) ... and as I was unable to find any such project (and I know there is at least one on this forum, I know I saw it like a year ago...) I decided it is faster to make then to search :) and then added the project here with all the tag's and stuff so it can be easier to find :D
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top