Aref and voltmeter

Hi, i have connected arduino mega and zmpt101b according to attach image.
I get the adc accurate and smooth reading(only 2 to 3 points difference) most of the time. But sometimes adc reading seem 5 to 20points off from real voltage and fluctuation a lot.
Any help, pls!
Should i add any cap anywhere?

Do not connect AREF to VCC.

analogReference: https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/

The DEFAULT setting is AREF being connected internally to VCC. The Arduino will measure voltages relative to VCC. That is not good. If the 5V is from a good voltage regulator, then it can still vary 5% (normal voltage regulator) or 2% (better voltage regulator).

The Arduino Uno has an INTERNAL voltage reference. If the VCC and the temperature does not change a lot, then it is okay to measure voltages.

Suppose you connect AREF to VCC and select INTERNAL, then there will be a shortcut inside the ATmega chip.

I guess i am using good regulator because everytime i measure with m.meter it show always 4.99 or 5.0v. I am using mega and if i use default internal reference, adc reading is really bad. My Mega board 5v pin voltage used to vary from 4.9 to 4.7

@Koepel bang on- connecting Aref to +Vcc is a recoipe for disaster.

USB voltage is not suitable as a reference
https://www.usb3.com/whitepapers/USB%203%200%20(11132008)-final.pdf

if your 5V supply is accurate and stable then you can simply use the "DEFAULT" as your reference.

you havent shown your code; I suggest you have a look at my page here to learn how to improve your readings

Default reference is based on arduino supply or arduino 5v pin.
Even though i supply regulated 5v suppply to arduino board, arduino 5v in voltage vary 4.8x to 4.7x.

1: How do you know this?
2: Can you show some scope traces that show how much ripple & noise there is on your 5Vdc supply?
3: What kind of 5V power supply are we talking about?
4: Have you considered using a different reference such as the in-built 1.1V reference or alternatively an external reference such as TL431 etc. - if not, why not?

Here you will find the schematic for a Mega board

Centre you will see the USB connector. The USB "5V" connects through a fuse to USBVCC
below that you will see USBVCC connects to "5V" through a FDN340P FET.

The drop in voltage must be due to varying current through those components and your external connections. Which you havent shown. Can you post a picture of your layout?

The polyfuse on the 5V line has enough resistance to explain the drop from 5.0V to 4.7V or whatever - polyfuses are not perfect by any means and their resistance when cold is not zero (if it were they could not function in fact).

All fuses operate based on some degree of resistance. Obviously! :roll_eyes:

In theory you can use a superconducting coil in a circuit breaker and have a truly zero resistance fuse :slight_smile: