Go Down

Topic: Making accurate analog measurements and detecting power fails (Read 1 time) previous topic - next topic

larryd

This tutorial covers:
- measuring the internal 1.1V reference voltage
- measuring the microcontrollers 5-volt power supply
- demonstrating a method of reacting to a power failure
- making accurate analog input measurements

We can calculate the voltage of an analog input with:
Vinput = reading  *  Vcc / 1024
Let's say our analog reading was 512 and Vcc was 5000mv
Vinput = 512 * 5000mv / 1024 = 2500mv

The accuracy of analog i/p readings is dependent on the correct value for Vcc.
The problem is, Vcc may change slightly.
If we measure Vcc prior to calculating our analog input voltage, we can be more accurate in our calculations.  
We can use the controller's internal 1.1V voltage reference to calculate Vcc.
However, we must first know the true value of the 1.1V reference.

Attached are:
A2DRead_1.1VBG.ino      (calculate the actual value for the 1.1V reference)
A2DSecretvoltmeter.ino  (measure the UNO's Vcc)
Power_fail.ino          (Vcc is monitored to see if there is a power fail, if so, save some stuff to EEPROM)
A2DaccurateReadings.ino (Make an accurate calculation of the voltage on the A0 pin)




No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

larryd

In case I need this.
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

Coding Badly

However, we must first know the true value of the 1.1V reference.
Some processors under some conditions have the 1.1 V reference present on the AREF pin where it can be directly measured.


larryd

Some processors under some conditions have the 1.1 V reference present on the AREF pin where it can be directly measured.
As in your sketch:
https://forum.arduino.cc/index.php?topic=38119.msg282514#msg282514


No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

Coding Badly


Exactly!

Another hint: only a single byte of EEPROM is needed to store a value for the internal reference voltage (0 to 200).


Go Up