Go Down

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

larryd May 15, 2018, 12:41 amLast Edit: May 15, 2018, 12:45 am by 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

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 need clarification, ask for help.

larryd #1
May 15, 2018, 12:41 amLast Edit: May 15, 2018, 12:43 am by larryd
In case I need this.
No technical PMs.
If you are asked a question, please respond with an answer.
If you need clarification, ask for help. #2
May 15, 2018, 01:59 am
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 #3
May 15, 2018, 07:30 am
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 need clarification, ask for help. 