4 Potentiometers with Arduino?
If I hook up a pot (left 9v, middle A0, right GND), I get a varying voltage into pin A0 on Arduino. Then Arduino converts this into whatever.
Well when I hooked up 4 potentiometers parallel to the same battery, and had them on pins A0-A3, none of the pots worked. Whenever I turned one pot, it would change the value for all the others (i was using serial monitor).
How do I correctly hook up four pots to Arduino?






























Visit Our Store »
Go Pro Today »




I'm guessing since the values change when other pots move that you are reading disconnected pins (your code is reading from the wrong address)
It's probably also a bad idea to name a variable the same as a pin name (A1). You can skip saving the value of A1
int pot1 = analogRead(A0) * 10.0 / 1023.0;
pinMode(A0, INPUT);
??
I see, so once I changed the names I immediately got the expected results. Thanks!
You can scale external voltages down with fixed dividers, but a POT divider with 9 to 0V is asking for trouble.
Lastly, double check the code - see if the variables could be talking to each other...
something like
loop...
variable0 = analogRead(A0);
variable1 = analogRead(A1);
variable2 = analogRead(A2);
variable3 = analogRead(A3);
Serial.Println(variable0); //etc
delay(1000);
int A1 = analogRead(11);
int pot1 = A1 * (10.0 / 1023.0);
Look good?
int A1 = 0; //declare variable
int pot1 = 0;
then in loop
//pin: the number of the analog input pin to read from (0 to 5 on most //boards, 0 to 7 on the Mini and Nano, 0 to 15 on the Mega)
//are you using a mega? 11 isn't analog input on regular duino. A //floating (disconnected) pin will give a random number based on a lot of things
//check your pin numbers!
A1 = analogRead(pinnumber);
pot1 = A1 * (10.0 / 1023.0);
If your input is fixed at 9V max, "prescale" it by adding another resistor in series with the POT (on the V+ side of the POT).
If the POT is 100K, add a 100K resistor. Now the voltage range on the wiper will be 1/2 the total, or 4.5V to 0V.
(if you add the resistor on the GND side of the POT, the wiper V range will be 9V to 4.5V.)
BTW, what POT values are you using? Remember that four parallel POTs sum to make a load that can effect power supply performance (four 1K pots equal a 250 ohm load). The ADC pins are really high impedance, so there is no penalty for using higher resistance POTS (four 500K Pots make a 125K load).
Right now I just replaced my big pots with the smaller kind. They are each 10k, their markings say 103.
So what do you mean by they equal a less load? Load? ADC pins are really high independence?
Thanks!
Yeah, I know, I'm just too lazy to go upstairs and get a resistor :D
I was very surprised that they were still working!
Thanks to gmoon for telling me that I can't name them names of inputs, it works fine. So yes, this setup works! Thank you very much as well for helping me out!
Actually, when describing a load, it's the inverse of resistance. I.E., 10 ohms is a much larger load than 100K ohms. Why? Because 10 ohms passes much more current, loading down the power supply.
Resistance drops when multiple resistors (POTs) are placed in parallel. As that resistance drops, the load increases. It's not necessarily a problem for you, but I wasn't sure what your POT values were...
Input Impedance is somewhat difficult to get a handle on.
A high input impedance is generally seen a good thing. High impedance devices require very little current to "do their thing." And very little current is consumed by them. When connected, it's almost like they aren't there. The input pins on the Arduino are on the order of megaohms, maybe 10s of megaohms (10,000,000 ohms).
The less current it takes to "run" a device, the less current needs to be available (and wasted) by whatever is supplying it. The POTs, for instance, can be high resistance value, and there will still be plenty of current for the ADC.
Contrast that with a very LOW input impedance device--like an 8 ohm speaker. It takes a lot of current to make that speaker move, and 8 ohms is a large load on the circuit. It certainly effects the rest of the circuit...
Output impedance is related, but in some ways opposite (we won't go there now).
-----------------------------
At this point, I'd rip out every POT but one, and individually test each input pin...
Thank you very much for taking your time to explain all this to me!