Hi all,
im still testing my self made arduino board and wondered about the analog in pins. I followed the "AnalogReadSerial" Example but wondered that i wont get the same values on pins A3,A4,A5 (arround 0..2) then on the other three pins A0,A1,A2(arround 0..1024).
Is that a normal behaviour ?
I tested this with...
void setup() { Serial.begin(9600); }
void loop() {
int sensorValueA0 = analogRead(A0);delay(1);
int sensorValueA1 = analogRead(A1);delay(1);
int sensorValueA2 = analogRead(A2);delay(1);
int sensorValueA3 = analogRead(A3);delay(1);
int sensorValueA4 = analogRead(A4);delay(1);
int sensorValueA5 = analogRead(A5);delay(1);
Serial.print(sensorValueA0);Serial.print(" ");
Serial.print(sensorValueA1);Serial.print(" ");
Serial.print(sensorValueA2);Serial.print(" ");
Serial.print(sensorValueA3);Serial.print(" ");
Serial.print(sensorValueA4);Serial.print(" ");
Serial.println(sensorValueA5);
}
On the serial monitor runs...
(..)
240 295 400 1 0 0
(..)
Maybe the last three pins are broken or sth . However a decleration with pinMode( ..., OUTPUT); and digitalWrite on those pins (A0..A5) works fine.
Unless some valid signal is wired to a analog input pin, reading it's value is meaningless as all your measuring is pin noise and random capacitance coupled crosstalk voltages. Ground all the analog pins and then run your sketch, see if they differ.
MosFett:
With A0..A4 on GND and A5 on the poti i get zeros only, if i "open" or "close" the poti doesnt matter on pin A0 it works fine.
No idea how you've wired A5 - a diagram please.
The way to test analog inputs is to connect each input to GND, it should read 0,
then connect it to 3V3 rail and it should read about 670. Repeat for each input.
If an analog isn't connected the voltage read on it is essentially meaningless, ignore it.
Like i said, i followed this example ( http://arduino.cc/en/Tutorial/ReadAnalogVoltage ), but changed it in that way, that now the poti is connected to pin A5 and all the other pins (A0..A4) are connected to GND.
I fear majenko is right :S
MosFett:
Like i said, i followed this example ( http://arduino.cc/en/Tutorial/ReadAnalogVoltage ), but changed it in that way, that now the poti is connected to pin A5 and all the other pins (A0..A4) are connected to GND.
I fear majenko is right :S
Majenko is always right ]
You got a spare? You should always have a spare... At last count I had 19 of different makes and styles, not counting my own...
Thats why i checked the connection with those A0..A5 pins in OUTPUT mode with digitalWrite, with LEDs they are all on.That says at least that the connection is ok :. .
Try checking them as a digital input as well, see if that works. If it does, but you're still not getting analogRead() working on just some pins then I would suspect the ADC front-end MUX.
MosFett:
Hmm... digitalRead works on A0..A3, A4 and A5 dont answer.
Check for resistance between pins and ground. It could be a partial short that isn't low enough resistance to stop digitalWrite but low enough to pull the pin down when in input mode.
Just a wild stab in the dark, which if a direct connection to 5V or 3.3v doesn't yeild a positive result is highly unlikely to be the case.
I suspect, since the output works, but neither digital nor analog inputs work, that the IO ports may have been blown (maybe by excess heat?) at point A on this block diagram. That is the only point common to both inputs but not the output. I was hoping the ADC feed would be connected to the other side of the SLEEP block, as that would be an active part that could be crippled in many ways, but alas not.