I recently took apart an old broken LCD TV, and on the bottom was the volume, channel and power buttons, but instead of separate buttons, it was a single SP5T tactile button on a breakout board with the IR receiver and an LED. It intrigued me, so I took a look at it and the breakout board has a connector with 10 pins, labeled IR, GND, 3.3V, SCL, SDA, KEY1, KEY2, LED, NC, NC. The cable connected to this only uses 6 of these pins though, SCL, SDA, and the two NC (obviously) have no wires. Obviously IR is connected to the IR receiver and the LED is connected there (I guess the LED needs more than 3.3V? It's a red surface mount.) What confuses me is that it appears that the switch only has 2 connections at most, I'm wondering how this is done. I know a fair share about electronics, but to me, a 5-position switch should need 5 outputs, right? Can someone explain to me how 5 different buttons states can be read by just one or two pins? My thinking is various resistors making voltage dividers, and reading the button's signal as an analog input, allowing for all 5 states (and more, if necessary) to be read with just one output pin. Am I close?
HaLo2FrEeEk:
My thinking is various resistors making voltage dividers, and reading the button's signal as an analog input, allowing for all 5 states (and more, if necessary) to be read with just one output pin. Am I close?
You have a theory. Why not test it?
Not sure what the TV is doing, but the resistor ladder method (or what I call basically a buttonified potentiometer), is one way it's done.
PaulRB:
You have a theory. Why not test it?
Because my ability to replace parts if I somehow ruin something, right now, is quite limited. I like to check my math before I turn it into the teacher.
That said, INTP mentioned resistor ladder, which is how I sorta envisioned it. I can just make a chain of resistors and put one button output between each, with the end of the chain going into an analog pin?
Power rail
| | | | | | resistors of different values
| | | | | | buttons
Single Input
Or GND rail instead of power rail for input with pullup.
No point in trying to 'chain' the resistors together in series and buttons in between.
Regardless though, it would go to an analog input, from which I would read the different signal and determine which button had been pressed. My idea of chaining them in series should still work, right? I just happen to have a lot of one type of resistor (220 ohm) that I wanted to use. It would effectively make each button's output have a different position on a voltage regulator, right?
You should definitely have more resistors and for what they cost there's no reason not to have an assortment of values.
In theory the bunch of them in series would work, but with such small value changes, it is highly dependent on the stability of your power source.
HaLo2FrEeEk:
Because my ability to replace parts if I somehow ruin something, right now, is quite limited.
How much damage do you imagine your multimeter could do, to the switch or itself? Set it to 20K-ohm range, hook it up, play around.
PaulRB:
How much damage do you imagine your multimeter could do, to the switch or itself? Set it to 20K-ohm range, hook it up, play around.
It's not that. The meter was free, one of those piece of crap harbor freight ones, and the switch isn't that valuable, really, I could easily emulate it with 5 individual switches. It's because I'd be testing it with my arduino, and I can't replace that right now. I've recently moved across the country, and my current living situation isn't totally guaranteed at the moment, so money is tight. That means that I can't really justify even the small amount of money that it would be to buy a set of resistors or other components. For now, I sorta rely on salvaged components from stuff that I take apart.
And INTP, I would be using either the Arduino itself as the power source, or a PC power supply, which should be pretty stable, considering what it's for. Regardless, I get what you're saying. Thanks for the help y'all!