I am trying to see if I can read 5, or moreswitches off of one pin on an arduino uno.
My thinking is to creat a "volt meter"of sorts, off of the botom side of the 50k ohm resistor.
So each time a different switch is pressed it will return a paticular voltage to the MCU, it will read it off of a adc pin, and I can haveit put out a result.
I.E. 2 volts +/- .1 means key x is pressed, do this.......Y....
Some Liquid Crystal Displays, such as this one, use that technique to read the state of 5 buttons.
One disadvantage of using this technique, is that when several buttons are pressed at the same time, only one will be detected. The one highest up the ladder will take priority.
One disadvantage of using this technique, is that when several buttons are pressed at the same time, only one will be detected. The one highest up the ladder will take priority.
Very nice.
Thank you.
I will not have speed issues, nor debounce issues.
There shouldn't be a problem with hitting multiple buttons at once.
I'm planning on pushing small relays or servos with this.
BillHo, and JohnLincoln, Thank you for your posts, I may change my circuit up to one of the ones you have posted.
I am looking to create "base pedals" for a keyboard, that will activate servos on a real keyboard setup to press real keys on a keyboard.
But, I am looking to use a standard phone line chord for the wired connection.
So I am limited to 4 very thin wires to work with.
That is why I am looking to do Ll I can with very few pins. I think I will need to have 12 switches powering 6 servos.
(Each servo will press 2 keys on the keyboard).
I know this can be done through a PC, and Midi, and numerous other ways, but just work with me here.
And as far as the phone wire I am using the phone wire because it is very flexible and durable, and common in case it breaks. I am going to use the curly type.
I HATE to see analog used for something that's inherently digital! But, if you've got only 4 wires and no power on the switch-end, that might be the best solution for you.
I'd rather see a serial or [u]multiplex[/u] solution. (BTW - The Arduino's ATmega chip has only one analog-to-digital converter along with an internal analog-multiplexer so it can read multiple analog inputs.)
I am looking to create "base pedals" for a keyboard, that will activate servos on a real keyboard setup to press real keys on a keyboard...
...I know this can be done through a PC, and Midi, and numerous other ways, but just work with me here.
I also HATE to see something done mechanically that's inherently digital-electronic.
But, it's YOUR PROJECT and YOU are in charge!
P.S.
A servo might be too slow, and since your switches are digital (on/off) you probably don't need a servo. Have you tried that part of the project? ...I thinking solenoid. But, a solenoid would require a driver circuit, and a servo has the driver built-in.