2 pot affecting each other

so say i have pot A, and pot B, When pot A increases in value pot B does so too, but not vice versa, and when in the code i ONLY read pot B it's FINE!
and pot A doesn't affect any other pots, just pot B,
on Arduino micro, Atmega32u4

i've tried double reading it but doesn't work
using delay(75); fixes the issue but has alot of noise, more delay is just unusable.

tried adding 0.1 uf and 0.01 uf capacitors to the input and gnd of pot B and doesn't work
every pot is 10k yet only these 2 are messed up
although they're different since they're the pots from the xbox 360 controller triggers.

codes :

  1. double read, don't work
void setup() {
  Serial.begin(9600);
}

void loop() {
  int RT = analogRead(A6);
  RT = analogRead(A6);
  Serial.print("RT:");
  Serial.print(RT);
  Serial.print(",");
  Serial.print("LT:");
  Serial.println(analogRead(A8));
}
  1. double read delay, 75 milliseconds, lowest i can get to it working
void setup() {
  Serial.begin(9600);
}

void loop() {
  int RT = analogRead(A6);
  delay(75);
  RT = analogRead(A6);
  Serial.print("RT:");
  Serial.print(RT);
  Serial.print(",");
  Serial.print("LT:");
  Serial.println(analogRead(A8));
}
  1. only pot B, works perfectly
void setup() {
  Serial.begin(9600);
}

void loop() {
  int RT = analogRead(A6);
  Serial.print("RT:");
  Serial.println(RT);
}
  1. nothing, as expected don't work
void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.print("RT:");
  Serial.print(analogRead(A6));
  Serial.print(",");
  Serial.print("LT:");
  Serial.println(analogRead(A8));
}

edit: forgot to add that the reason i can't use code 2 is my main code measures a lot of things so having a delay is just no.
using millis() libraries also didn't work.

Please post a schematic of your project

What values are the 2 pots ?

Make sure the value isn't too low. 10KΩ should be good.

Try this

void loop()
{
  analogRead(A6);
  delay(1);
  int a6 = analogRead(A6);

  analogRead(A8);
  delay(1);
  int a8 = analogRead(A8);
}

I vaguely recall that there was an issue with the analogRead not waiting long enough for the input to settle out after the multiplexer switched to a different channel so double reading with a delay on all channels should fix it.
But I took a look at some code I have that reads multiple ADC channels and I'm not having the problem, so perhaps my memory is foggy.

Untitled_Sketch_ANALOG_schem.pdf (1.3 MB)

U1 and U2 are the pots in question
U1 is LT and U2 is RT

didn't work, code 2 is still the only one that works, 75 milliseconds still being the lowest delay

edit: forgot to add that the reason i can't use code 2 is my main code measures a lot of things so having a delay is just no.
using millis() libraries also didn't work.

Oh DEAR.

This is an excellent example of the reason for my feelings towards Fritzy.

1: try disconnecting EVERYTHING else.
2: draw a schematic of how JUST the two pots are connected to the arduino.
3: Run this code, that does a dummy read after EACH change of input

void loop() {
  int RT = analogRead(A6);
  RT = analogRead(A6);
int LT = analogRead(A8);
  LT = analogRead(A8);
  Serial.print("RT:");
  Serial.print(RT);
  Serial.print(",");
  Serial.print("LT:");
  Serial.println(LT);
}

did not work

Very descriptive

I've already described the problem in full detail, it didn't fix it, got the same results. How is it not descriptive?

Read the post #7 and think about it

Look at the content of the post and compare to yours

1 Like


here's the schematic

solution :
buy new pots.
the affected pot was deffective and not 10k, but 10,5k

Well its a start; it doesnt show what the 11,12,19 & 23 are; I'd guess - but why should I have to?

.. Do I need to say you need to include your "SETUP" as well?

.. then copy what is printed to the monitor, and post it.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.