Go Down

Topic: LCD panel switches as analog voltages (Read 967 times) previous topic - next topic

JimboZA

Jun 10, 2012, 07:20 am Last Edit: Jun 10, 2012, 08:10 am by JimboZA Reason: 1
Note to mods... feel free to move this thread, which is to do with switches on an LCD panel, not the LCD itself.

I was surprised when I looked at LCD code the first time and found that determining which switch is pressed is done by measuring an analog pin and decoding the 0-1023 reading into a pin identification. Good idea I guess, since that way one could in theory have 1023 switches read on one pin, or more likely say 50-100 if one allowed a reading range of 20-10 per switch to separate them.

I'm curious to know how the wiring would work... I'm ignorant of such things but envisage a unique resistor in series with each switch, a bit like measuring a pot at the junction of the pot and a pull down, where the reading depends on the position of the pot. Does each switch have a resistor of its own and depending on which switch is pressed, that's the resistor in play, and hence a unique reading for that switch?

If that's so, then if the resistors were cunningly chosen I guess this could be used to tell which unique combination of switches was pressed too?

What would be a practical maximum number of switches one could decode on a 0-1023 analog pin?

(It's far too early on a wintry (southern hemisphere) Sunday morning for this.... what am I thinking?)

Ciao,

Jim
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

robtillaart

- http://forums.trossenrobotics.com/showthread.php?1284-Turning-analog-inputs-into-multi-switch-digital-inputs - post #6
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

JimboZA

#2
Jun 10, 2012, 12:51 pm Last Edit: Jun 10, 2012, 03:34 pm by JimboZA Reason: 1
Exactly what I was thinking thanks Rob, except for the part where it goes BOOM

I breadboarded it just like that, with whatever resistors I had handy. Did a quick calc to see what portion of the 5v and thus of 1023 should appear on the pin and it worked as expected, identifying the switch that was pressed.

Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

Go Up