Hello!
When I select **analogReference(INTERNAL2V5);**: how can I measure this voltage to check its error?
For example, when select **analogReference(INTERNAL);** on Arduino UNO, you can measure this voltage in pin AREF. In my case, this voltage is 1.069V, not ideal 1.1V, and knowing this value I can get more accurate analog measurements.
I would like to check the same in Nano Every. Is it posible?
Thank you very much.
If you use the internal reference to measure & calculate a known external voltage, you can calculate the percentage error/difference from the known-actual external voltage.
According to the schematic diagram of ADC, I understand that the Internal Vref is not posible to connect to any pin, like the UNO. This Internal Reference is an input of a multiplexer, and the Vref goes directly to ADC.
The ATmega4809 on the Nano Every does not output anything at AREF (see post #5).
The ATmega328 on the UNO does under certain circumstances, and that allows you to blow up that circuit.
I changed it, compiled it, I had used a newer toolchain with a newer header file.
Now you can use it to measure AREF with DMM.
The only thing I had also written is that the megaAVR0 cannot measure its own Ub.
Here now 2 different things came together.
One more thing. You don't post code as a picture. Never!
You always measure 0.3V with 10k/1k at 3.3V.
The 0.33V is always below the smallest VREF.
That's okay with all VREFs.
Did you expect something else?
You can also make life easier for yourself with analogReference()
That was just my own test code with direct access, because I wanted to test something else at the time.
The standard calibration method would be to feed-in a known voltage and make a calibration/correction. You don't need to know what's happening inside the chip.
A basic straight-line calibration is an offset, which is a value added/subtracted from the readings. Usually the offset is measured at (or near) zero. If no zero calibration is needed the offset is zero. (The Arduino probably will read zero and won't need an offset correction).
Then while applying the offset correction, a 2nd measurement is made at, or near, the maximum, or at the most-likely or most important value, and a slope (multiplication factor) correction is made. If the reading is perfect, the slope is 1.0.
Since multiplying by zero equals zero, the slope correction doesn't mess-up the offset correction.
means AREF is an input and you’re going to apply a voltage to it.
This time around I did measure voltages at the AREF pin. According to the schematics in post #5 this shouldn’t be possible. Apparently the circuitry used is not a ‘clean’ analog switch.
There’s a piece of text in the datasheet I never understood, but it’s making slightly more sense now.
everything it describes is correct. Your measured values also match what you have done.
The AREF pin is the reference voltage for the ADC. At the same time, the selected VREF voltage specifies the maximum input voltage that can be measured by the ADC on its channels. The selected VREF, which can be measured at the AREF pin using a DMM, is only the reference voltage for the ADC. There are several internal VREFs to choose from and you can also connect your own to the AREF pin. Note Ub! But not all at the same time. Either an internal VREF which is then applied to AREF or an external one. Only 2 capacitors are connected to the AREF pin on the Every Board to stabilize the selected reference voltage.
The ADC measures everything that is applied to its channels only in relation to the selected VREF.
Have the ADC output the raw values in the code shown in the picture.
They must be less in this order.
I’ve been thinking about this. The more I think about it, the less likely it seems that this is an oversight of the chipmaker. If it is deliberate it is either to mimic some properties of the 328 or to enable testing in the factory. The latter makes more sense.
This doesn't seem to be quite correct (post 8). I have a DMM connected to the AREF pin and can clearly see voltage steps when executing a slightly tweaked version of Doc_Arduino's code: