Hello i am just trying to figure out if i can use a resistance based multi position button with only 2 leads to control multiple things on the output side of an arduino.
The buttons are on the back of my steering wheel and have an up down and center push feature with a static resistance when not pushed. Each position on each button has its own unique resistance and each button has the same resistance when they are not pressed.
The picture below is the output of each position of each button.
Bassicly trying to make it so i can adjust my aftermarket radio with them again or shift my transmission when in sport mode
I didn't look too hard, but this will point you in the right direction
Yes you can. There are a few options to investigate and choose between.
Connect each button module to a separate Arduino analog input and ground. You need to choose an appropriate value fixed resistor to form a voltage divider, e.g. 1K~10K, and connect one between 5V and each analog pin.
Connect the two button modules as a voltage divider, one connected to 5V, the other to ground and the other two terminals connected together and to the analog pin.
Connect the two button modules in series between the analog pin and ground and choose a fixed resistor to form a voltage divider, between 5V and the analog pin.
As 3 but with the two button modules connected in parallel with each other.
The reason you need to explore the options is to find a configuration where each button, when pressed, gives a voltage which is not too similar to the voltage of any other button, so that they won't be confused with each other, ideally at least 0.1V apart from each other.
What I would do is create a spreadsheet with 7 rows. Each row of the sheet can calculate the expected voltage and analogRead() value for one button, plus a row for no button pressed. Then you can sort the sheet by the calculated expected voltage and calculate the differences between each value and the next to see if any two are too close together. If they are not, great, you found a solution. You can then calculate the values half way between each expected value. You can then transfer those half way values to your Arduino sketch.
That technique suggested by lastchancename, and PaulRB is used in this LCD Keypad Shield
The 5 pushbuttons at the left hand side are all connected to one analogue input.
The schematic and example sketch are shown on the page that I linked to.
You just need one extra resistor to form a potential divider with the resistor selected by the pushbutton.
You guys are freakin awesome!!! I still have to learn how to program in arduino and buy some. But i just needed to see if this would be a viable option.
Thank you all so much!!