Use a multiplexer if you need to separate the pots, look for a chip like the 4051. But as Rob said you'll need a digital pin to control it, so unless for some reason you have a spare digital pin and no spare analog pins you gain nothing.
What are you trying to achieve, coarse/fine adjustment, two totally separate functions...?
IIRC there used to be analog adders and multipliers that used battery, pots and meters. An Arduino could sub for the meter. Not saying it'd be just that simple and accurate too, if the 5V fluctuates you'd have to compensate somehow.
If you have two digital outputs available, then you can connect the bottom of the potentiometers to ground, and connect the top of each pot to its own IO pin. Then you connect the wiper of each potentiometer to the analog input through a diode. Both pots must have their own diodes, that point from the wiper to the IO pin.
Now when you want to read pot A, set the io pin at the top of it high, and set the other one low or tristate.
The diodes will cause the analog input to receive the highest of the two voltages,taking the underpowered pot(which will be at 0 no matter what the wiper position) totally out of the equation.
You may need to put a 100K to 1M resistor from the analog pin to ground, because the diodes only put voltage into the pin and the ADC input and leakage might not be enough to bring the voltage back down when you turn down the pot.
The diodes are important, otherwise it won't work and there is a configuration of pot settings that would make a short.
Keep in mind you will drop a small amount of voltage through the diodes,and so any potentiometer setting below the diode Vf will look like 0.
If you have 4 IO pins, you can connect both sides of each pot to digital IO and switch them and skip the diode, but if your software fails and powers both something might blow.
There is another advantage to switching pots on and off in battery powered things: you save about half a milliamp in a 10k pot by turning it off when you aren't reading it.
Hi, do not connect two potentiometers to the one analog input.
If both pots are connected across the 5V to gnd and the wipers connected together at the analog input, if one wiper is at grn and the other at 5V then you will have a short circuit 5v to gnd.
Why do you need to use only one analog input?
Hi friends, many thanks for your replies!! I'll try to take your advices to get a solution to my question.
My goal is to develop a midi controller, to control Ableton Live. It will have around 20 potentiometers and 5 switches.
Because the analog and digital inputs in arduino are limited to a fixed number - a less quantity that my requirements - I'm thinking to group the components in small systems.
The number of groups will be the same to the number of available inputs in the arduino board.
For that reason I need to know how send different signals using only one input.
I'm newbie, I have many doubts about how to get my goal... but I must start to investigate, ask and try by some way!
if you have digi pins available i guess connecting boths vcc to arduino pins works ! if you need more analogpins i guess you can use ADC but with cost of digitalpins!!
Your project sounds similar to other midi projects. If the voltage out of the pot wiper is greater than 5v, then you may have other issues to deal with.
MickyMike:
Hi friends, I'm newbie and I'm looking for some tutorial that help me.
I need to connect two potentiometers, using only one arduino input ... it's posible?
If it is: How can I detect from the programming side which potentiometer is rotating?
Many thanks!
There are ways to actually do what you want, but they are complex.
For instance you can route each pot to a voltage->frequency converter chip
set to two separate frequency ranges and XOR the outputs together and send
to a digital pin. Then you analyse the timing of the transitions on that pin to
determine the two independent frequencies. Complex, ugly even, but not impossible.
The most sensible way other than multiplexing is to interface to a multi-channel
external ADC chip, such as MCP3208. However the multiplexer method is probably
cheaper.
This project http://www.thebox.myzen.co.uk/Hardware/MIDI_Footsteps.html
Will do what you want, just replace the foot sensors with your pots. There is code too.
Using a multiplexer you can get 8 pots on each analogue input, the project only uses two multiplexers but you can see how to make it six.
TomGeorge:
Hi, do not connect two potentiometers to the one analog input.
If both pots are connected across the 5V to gnd and the wipers connected together at the analog input, if one wiper is at grn and the other at 5V then you will have a short circuit 5v to gnd.
Why do you need to use only one analog input?
How could the short circuit current get through the diodes? The wiper at 5v would put 5v out through its diode but it would be block by the diode on the wiper at 0v. Seems like a pretty basic ORing circuit to me unless I missed something, which I probably did.
In any case the multiplexer is probably the better way to because of the voltage drop/inaccuracy issues.
How could the short circuit current get through the diodes? The wiper at 5v would put 5v out through its diode but it would be block by the diode on the wiper at 0v. Seems like a pretty basic ORing circuit to me unless I missed something, which I probably did.
There are no diodes involved at all so I think that is what you are missing.
If you did put diodes in series, then you would not be able to get a measurable voltage into the analogue input. ( no impedance to ground)
The other thing is there is no way to tell what pot is being turned, which is what the OP was not understanding.
Hi, Mike, just a practice I would not do when looking at analog voltage levels, putting diodes in their path.
Just personal choice. Not all diodes are the same, even same part number.
Tom, I never suggested putting diodes in, it was the previous poster. As I said it would not work because ther is no path to ground therefore you would always measure 1023 no matter what the position of each pot was.