analog pin issues

today i was using analog input pin using arduino mega.
i was checking the voltage on voltage divider rule
what i found is that using pin 0 giving other value pin 1 giving another and pin 5 something other
can somebody tell me is there any faulte or a reason ?
applied voltage and risestace was same

They should read the same* with the same voltage (maybe +/- 1 count**).

The ADC needs some "settling time", so sometimes it helps to read each input twice in a row, ignoring the 1st reading.

You can get noise (unstable readings) depending on the resistance of your voltage divider and the length of the wires.

How far off are the readings? ...What are you expecting to read and what readings are you getting?

Are these 3 pins connected together, so you know they all have the same voltage? Or, do you have 3 separate voltage dividers?

Do you have a multimeter to check the voltages?

Are you reading any other analog inputs?

  • There is only one multiplexed (shared) analog-to-digital converter inside the ATmega chip.

** The analog value can be on the "hairy edge" between two readings so it's not unusual for the readings to jump around by one count, even when everything is working perfectly.


Also note that open analog inputs will read close to the previous analog input.

If you connect 1V to the A0 pin you should expect approximately 1V on A1, A2 …

This is because the sampling capacitor will retain approx the value of the previous analog channel unless it is forced to another value.

I suspect your voltage divider wasn't a voltage divider. You will get identical readings +/- 1 count if
things are setup correctly (and the 5V supply is clean). Your voltage divider needs to have a 10k or lower
impedance, so for instance two 10k resistors in series between Vcc and GND will be fine with any number of
analog pins. Use 1M resistors and you'll see issues.