Hello,
I've noticed that the values of my analogRead()s seem to be influencing each other on the Arduino Due. For example, given a small sketch like this:
uint16_t a;
uint16_t b;
uint16_t c;
void setup()
{
analogReadResolution(12);
Serial.begin(9600);
Serial.println("Starting..");
}
void loop()
{
a = analogRead(0);
b = analogRead(1);
c = analogRead(5);
Serial.print(a);
Serial.print(", ");
Serial.print(b);
Serial.print(", ");
Serial.println(c);
}
Adjusting input "a" affects the value read at input "b". Adjusting the input "b" affects input "c". And so on...
Here's some example output. I'm only changing the voltage at input "a". I'm not adjusting the voltage at input "b", but you can see that it is affected by input "a"'s value:
1865, 37, 392
1853, 37, 392
1840, 37, 392
1806, 38, 392
1709, 39, 392
1634, 40, 392
1554, 41, 392
1472, 42, 392
1369, 43, 393
1260, 44, 392
1129, 45, 392
982, 46, 393
875, 47, 392
723, 48, 392
624, 49, 392
534, 49, 393
486, 50, 392
439, 49, 391
392, 50, 392
353, 50, 392
Here are column #1 and column #2 graphed:
(sorry, my images aren't showing up. Please see attachment ec_adacs.png)
I don't believe that this is a side effect of my circuitry. I believe it's something specific to the Arduino Due. Besides my own Due product, I tested the analog inputs to the nw2s:b, which is a Due based project with an open architecture and got the same results.
In my experiment using the nw2s::b, I left analog input #1 and #3 untouched as I adjusted analog input #2. Here are my findings:
(sorry, my images aren't showing up. Please see attachment nws2_adacs.png)
Analog input #1: Stays relatively constant. It's got some noise, but it's staying between 1425 and 1430.
Analog input #2: This is the input which I'm adjusting using the knob.
Analog input #3: This input is not being modified. But it's being influenced by analog input #2. The extremity of the influence seems to be related to the input voltages.
I have noticed that if I read an analog input three times in succession, I can get a clean reading. For example:
a = analogRead(0);
b = analogRead(1); <== influenced by the previous analogRead
b = analogRead(1); <== less influenced
b = analogRead(1); <== not influenced. Nice, independent reading.
These experiments are very easy to replicate. Adding delay() instructions doesn't seem to help. Is this some sort of ADC settling issue?
Thanks,
Bret