All ADCs reading 1023

Hi Community,

I'm using an ATMEG328P (the IC is programmed with the Pro Mini boot loader) ... and everything seems to be working fine ... except, all my ADCs are reading 1023 (A0, A1, A2, A3, A6 and A7). I'm using A4 and A5 for I2C.

A6 is the only one that is being used and the input voltage is about 2.5V, yet ... A6 reads 1023. All the others are floating and the read values for these are not even "dancing" around as one might expect if nothing is connected ... they simply read 1023 (all the time).

Can anyone think of anything that might give rise to that behavior?

The "AREF" pin is tied to ground via a 0.1uF cap.

Many thanks,
Tim.

Post your schematic.

A6 might read 1023 if you have accidentally chosen this code in your sketch: analogReference(INTERNAL);. If so, change it to: analogReference(DEFAULT); or delete it.

Try grounding the ADC inputs to see if they report 0. Then measure a known voltage.

Do not use pinMode with analog inputs, especially not INPUT_PULLUP.

@GolamMostafa
Thank you. I'm not using that line of code.

@jremington
Thank you. It doesn't matter what voltage level is on the Ax pins, the ADC reports 1023 (I'm using the serial monitor to observe that). I'm not using pinMode on any of the Ax pins.

Post the code, using code tags.

TimHo:
A6 is the only one that is being used and the input voltage is about 2.5V, yet ... A6 reads 1023. All the others are floating and the read values for these are not even "dancing" around as one might expect if nothing is connected ... they simply read 1023 (all the time).

The "AREF" pin is tied to ground via a 0.1uF cap.

Time to measure the voltage on the Aref pin with a DMM.

If Aref is less than the voltage on A6, then the A/D reports 1023.

Pointless to measure floating analogue pins.
They just follow the last measurement on A6 (internal muxer cross-talk).
Leo..

Please, post your complete codes.

Most likely, either your wiring is incorrect, or the microprocessor has been damaged.

@jremington, @GolamMostafa, @Wawa, @lakshmi123

Thank you for all of your responses ... I think it's my fault ... please see if you agree. I was harboring the belief that AREF was an input-only pin ... so I paid no attention to and failed to mention (until now) that before I connected a 0.1uF capacitor between AREF and GND ... I had connected a zero Ohm resistor between AREF and GND. Eventually (many minutes), I noticed my mistake and corrected the issue.

I make mention of this because of this thread;
https://forum.arduino.cc/index.php?topic=91256.15

... and from within it, the comment from @MiFi;

You ought to point out, that actually the AREF pin outputs the selected voltage with a pretty low impedance, as long as AREF=EXTERNAL is not selected.

.... hence, I figured that I burned out the ADC, to talk to your comment @jremington;

Most likely, either your wiring is incorrect, or the microprocessor has been damaged.

Does my initial error now explain things?

Many thanks,
Tim.

Thanks. Toss that chip, we've all made similar mistakes!

TimHo:
I was harboring the belief that AREF was an input-only pin ... so I paid no attention to and failed to mention (until now) that before I connected a 0.1uF capacitor between AREF and GND ... I had connected a zero Ohm resistor between AREF and GND.

The following diagram depicts the role of the AREF-pin of the MCU. This line/pin has two purposes:
(1) It is used to connect 100nF filter capacitor when 5V or Internal 1.1V is used for the VREF pin of the ADC.
(2) It is used to feed external voltage (1.1V - 5V) for the VREF pin of the ADC when 5V or Internal 1.1V is not used.
adc328p.png

adc328p.png

@jremington, thank you for your humility. I swapped out the chip and it worked fine.

Thanks @GolamMostafa

Tim.