Still getting problems with reading pots

I keep getting problems reading analogue pots. these problems include noise (both large amounts and small), shortened value ranges (eg. the reading will only go up to 830 instead of 1023 or down as far as 42 as opposed to 0), seemingly stable connections becoming unstable upon any small amount of movement of the cables, sometimes when i turn one pot all of the others send data but then when i stop they all stop as well and sometimes pots just literally not reading at all. Bascially they are ALL OVER THE PLACE.

I’m currently using 1k pots to ensure that the overall resistance is kept right down but have had the same issues with 10’s, 50’s and 100’s as well. My cables are generally quite short (say an average of 4 inches). I am also using pin headers for my connections to the arduino and I’m reading each pin twice and discarding the first reading to allow time for the ADC’s successive approximation to complete.

I’m currently trying to power it with an external 12 volt DC supply from a mains adapter via the onboard power jack. This is to ensure that the supply voltage is regular as I have read that USB supply voltage can be unreliable. However, this has not made a difference. I really dont know what else to try.

The only thing i keep thinking is that it’s the hookup wire that im using which is this: -

http://www.maplin.co.uk/p/bell-cable-single-core-priced-per-metre-xs92a

Does anyone know if this could be the problem? Or perhaps have any other suggestions.

Here’s my code: -

int pot0 = 0;
int pot1 = 0;
int pot2 = 0;

int lastPot0 = 0;
int lastPot1 = 0;
int lastPot2 = 0;

void setup() {

Serial.begin(9600);
}

void loop() {

pot0 = analogRead(A0);
pot0 = analogRead(A0);

  if(abs(pot0 - lastPot0) > 12){
    Serial.print("pot0 = ");
    Serial.println(pot0);
  lastPot0 = pot0;  
}
pot1 = analogRead(A1);
pot1 = analogRead(A1);

  if(abs(pot1 - lastPot1) > 12){
    Serial.print("pot1 = ");
    Serial.println(pot1 / 8);
  lastPot1 = pot1;
}
pot2 = analogRead(A2);
pot2 = analogRead(A2);
  if(abs(pot2 - lastPot2) > 12){
    Serial.print("pot2 = ");
    Serial.println(pot2);
  lastPot2 = pot2;  
}
delay(40);
}

I have attached a schematic below

I have also noticed on the Q&A section of the Maplin website that the hookup wire that i have used only allows for up to 200mA at 12 volts. Could this be causing a problem?

You seem to have some cheap and nasty (noisy) pots. Wire size is irrelevant. Your pot wipers are obviously are not reaching the end terminations and this could be a symptom of the pot quality.

Have you used a test meter on the pot to establish if what the arduino is reading is actually what the pot is providing.

This confuses me then because A: when i plug them directly into a breadboard they work fine (Full readings from 0 - 1023) with little noise and B: why do they sometimes work in my circuit just fine as well but then when i move the cables (generally when im shutting the plastic enclosure) do they stop working? Also... as i said above, i've tried many different types of pots with the same problems.

why do they sometimes work in my circuit just fine as well but then when i move the cables (generally when im shutting the plastic enclosure) do they stop working?

Because you have something loose. This could be a wiring problem or a pot problem. It could even be a mounting problem. That anti rotation lug, have you ignored it and just tightened up the pot? That can put a strain on the shaft and cause intermittent wiper contact.

liamorourke: I have also noticed on the Q&A section of the Maplin website that the hookup wire that i have used only allows for up to 200mA at 12 volts. Could this be causing a problem?

I am tempted to say that this is rubbish. But even if it were true then each pot only draws 5mA anyway, and the wiper current is almost zero because of the high impedance of the analogue inputs.

Have you tried decoupling caps from analog pins to GND? Start at 0.1uF and work your way up to about 3.3uF. Also, try resistors between wiper and analog pin, start at 10k and work down, you'll probably find a "sweet spot".

Did you say if the wires are soldered to the pots?

Did you say if you have a multimeter? With a meter, you can measure the voltage on each pot, you can measure the ground (to confirm zero-volts) and you can measure the "output" voltage from the wiper. You can also measure resistance to make help find the flaky connections.

Or, try carefully wiggling one connection at a time, maybe with tweezers, to figure-out which wires/connections are causing the readings to jump around.

You've obviously got one or more bad connections. And, it's pretty-much impossible for anyone to find the bad connections remotely, so you'll have to track them down yourself or find someone local with some electronics/electrical experience to help you.

I'm currently trying to power it with an external 12 volt DC supply from a mains adapter via the onboard power jack. This is to ensure that the supply voltage is regular as I have read that USB supply voltage can be unreliable. However, this has not made a difference. I really dont know what else to try.

... and then connect the wiper to the analog input? (not a good idea).

Must be very poor quality pots. Could try something like this ...

But the schematic he posted did show the pots going between the 5V line and ground so that is fine no matter how the board is powered.

Ahh, OK. For some reason I thought he meant connecting the pot to 12V and testing it.