hello forum. i want to mesure some voltages, with as much accuracy as possible.
i am using an Atmega328 stand alone chip..
i use this to extract voltage from the value the arduino reads :
float sensorValue = analogRead();
float voltage = sensorValue * (5.0 / 1023.0);
the problem is, that, if the VCC fluctuates, then my readings will fluctuate too. correct? (if the vcc is 5.12 , then i should had 5.12 on the code as well)
is there any way to get around this? how can i use the AREF pin to solve this??
You put a precise voltage into Vref and switch to external referance. However you can not measure any voltage greater than the referance voltage.
There are lots of voltage referance chips about.
so, i hook a precice votlage reference, of 5.0 volt, to AREF pin, and then throw :
somwhere in the code ? (setup() ? )
Normally you need a voltage higher than 5V to drive a 5V referance but yes basically that is it.
There is a built-in
1.25V 1.1V reference, and you could use a voltage divider to place the measured voltage in that range.
Most models of Arduino have a 3.3V voltage regulator that you could also use as a reference, if the Vcc is above 4.1V or so. Again, you might need a voltage divider to put the measured voltage in range.
Either of these is a more accurate and stable reference than the 5V regulator, but not as good as a precision voltage reference.
Edit: corrected value for internal voltage ref.
Most of the chips used in most of the official Arduinos have a 1.1V internal reference, a couple have a 2.56V reference, and the Mega has both and so must be selected accordingly.
Yes, if you have an external power supply greater than 5V, you can use an external 5V supply on Aref. Make sure it is bypassed well, no matter where the reference comes from.
As has been said, there are better voltage references than the internal, but the internal is miles ahead of using Vcc.
it’s ok, i have exteranl voltage 12v (noisy as @#$ tho…) so i can use a precice 5v external reference !!
Make sure it is bypassed well, no matter where the reference comes from.
what do you mean by that ?
Put a capacitor across it.