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.

multiple buttons on analog pin.

Status
Not open for further replies.

rk396

New Member
Ok maybe i''m going about this all wrong but here's my issue.

I have a 12 button keypad where the outputs are in an array. I'm trying to sense each individual button by hooking up a series of resistors and reading the voltage on an analog in (pic18f4550). The problem i'm running into is that the +5v varies and this affects the final out voltage.

is there a way to sense the input voltage with out using another analog pin? i'm using all the remaining pins for data logging.

any help or insight would be greatly appreciated.

thanks
 
Hi.

The normal way to read a grid keyboard (at least when I was young) was to input a sequense on the row where one bit is always high.
Then reading the coloumn and compare it (in time) with the active bit position on the row.
 
The problem i'm running into is that the +5v varies and this affects the final out voltage. Is there a way to sense the input voltage with out using another analog pin? i'm using all the remaining pins for data logging.

any help or insight would be greatly appreciated.

thanks
I power the keyboard from the same supply as the micro (ADC) so supply changes do not show.
 
Thanks for the replies. As it turns out i had enough pins left so i could use Grossel's suggestion. And it seems to be working.

I will give the other method a try to and use which ever one seems more reliable.

Thanks Again!
 
Thanks for the replies. As it turns out i had enough pins left so i could use Grossel's suggestion. And it seems to be working.

I will give the other method a try to and use which ever one seems more reliable.

Thanks Again!
Hi. I'm not familiar using reistor grid for kayboard purposes. If you get it work, it would be nice if you tell how it's workin :)
 
Hi. I'm not familiar using reistor grid for kayboard purposes. If you get it work, it would be nice if you tell how it's workin :)

See tip #7 of attached.

Mike.
 

Attachments

  • Tips and Tricks 01146B.pdf
    5.8 MB · Views: 217
Thanks Pommie. I'd like the solution described with figure 7-1.

Only doubt I have is that pushing two buttons at the same time can ever be correct detected this way.
 
Only doubt I have is that pushing two buttons at the same time can ever be correct detected this way.

You are completely correct which is why I never use this method. I prefer the row/column scan technique. I posted a thread on it a while ago. Clicky.

Edit, the two key rollover bit is really important.

Mike.
 
Last edited:
Hi. I'm not familiar using reistor grid for kayboard purposes. If you get it work, it would be nice if you tell how it's workin :)

I basically used a combo of the scan and resistor technique. I don't need to sense multiple keys so it's not an issue. My Grid was 3 x 4, so i have three DO's that i scan, and sense the single input of resistors to an A/D pin. I can space the resistor values far enough apart to eliminate the "error" problem i was encountering earlier. It's been working well. I can post schematic or code if anyone is interested.
 
I can post schematic or code if anyone is interested.
Thanks, but I've read the pdf and technique is clear to mee. What is a little unclear yet is how to make the resistor grid make correct output and some hints about it.

I mean - having just a bounch of R/2R resistor ladder with push buttons is easy enough. But by having a grid, you must have a system to ensure that two buttons doesn't output same voltage. That's the hard part to get.

Thanks
 
You use binary values, 64k, 32k, 16k, 8k on rows and 4k, 2k, 1k, 500R on columns with 500R to ground. You end up with 16 voltages that are easily discernible.

Mike.
 
Last edited:
Thanks Atom, yeah there were lots of tricks from the old days of using RC time testing to get a crude ADC value. Most of the early PICs did not have ADC modules back then, until the 16C71 I think and even then the ADC pics were expensive.

People did cool tricks like comparing the RC time difference of a ST input against a TTL input, to test the 5v or battery voltage. Or testing the WDT timeout to get a temperature value as it changes with temp more than the xtal does. :)
 
Status
Not open for further replies.
Back
Top