How-to: Accurate Voltage Measurements with Arduino

  Рет қаралды 37,186

Elektor TV

Elektor TV

Күн бұрын

In this video, we show how to configure an Arduino UNO board for precise voltage measurements. A good-quality power supply is required for this. Also, you must know the exact value of the reference voltage the AD converter is using. Do not simply assume that it is 5 V or so, measure it. If you follow the instructions carefully then you too can take accurate measurements with an Arduino board.
#Arduino ‪@Arduino‬
Contents
========
0:00 intro
0:15 Analog-to-digital converters
1:12 analogRead()
1:57 Convert to volts
2:49 Floating-point calculations
3:36 A practical application
5:15 Better resistors
6:38 Measure the reference
7:41 Use a good power supply
8:52 analogReference()
10:00 Interference
10:59 Summarizing
Resources
=========
* Arduino UNO Rev3: www.elektor.com/arduino-uno-rev3
* A good multimeter: www.elektor.com/hioki-dt4256-...
* A good power supply: www.elektor.com/peaktech-6225...
Check out our KZbin offers: www.elektor.com/youtube
Subscribe to our Newsletter: www.elektormagazine.com/elekt...
Join this channel to get access to perks:
/ @elektortv

Пікірлер: 57
@R_W_G
@R_W_G 15 күн бұрын
Thank you for a very good and technically convincing explanation of the connections between the knife and an Arduino and the special features. That was a great help to me!
@edinfific2576
@edinfific2576 Жыл бұрын
This is the clearest and shortest explanation about Arduino ADC. Subscribed!
@ElektorTV
@ElektorTV Жыл бұрын
Glad it was helpful!
@Murmuz077
@Murmuz077 7 ай бұрын
highly appreciated. logical progressive and methodical teaching. 👌
@ElektorTV
@ElektorTV 7 ай бұрын
Glad it was helpful!
@f3l1p3Pratic
@f3l1p3Pratic 5 ай бұрын
perfect! I didn't know about the resolution of the ADC, and I also hadn't thought about the reference voltage. Thank you very much! The video was very useful.
@ElektorTV
@ElektorTV 5 ай бұрын
Glad it was helpful!
@emilalmberg1096
@emilalmberg1096 Жыл бұрын
Excellent start! As a continuation, you can show how to amplify a weaker signal, and how to adapt a voltage of maybe 2-4V to use all the bits in the AD converter.
@edinfific2576
@edinfific2576 Жыл бұрын
I would add that the reason why we divide by 1023 instead of 1024 is because the 0 (zero) is included as one of the values, so we still have 1024 values but zero is one of them; in other words, we're counting from 0 instead of counting from 1, so that's why it ends at 1023.
@ElektorTV
@ElektorTV 9 ай бұрын
We don't divide by 1023, because the datasheet says that you must divide by 1024 (section "ADC Conversion Result"). 1023 equals to Vref minus one LSB. So, if Vref=5V, then 1024 = 0x400 = 5V; 1023 = 0x3ff = 4.995V. Unfortunately, 1024 doesn't fit in 12 bits.
@Guishan_Lingyou
@Guishan_Lingyou 7 ай бұрын
Very helpful. Clear and, as far as can tell, all the relevant information needed to get the job done. Also happy to see the comment below that filtering the external voltage supply will improve stability.
@ElektorTV
@ElektorTV 7 ай бұрын
Glad you enjoyed it!
@HL65536
@HL65536 10 ай бұрын
external interference performance can be improved by adding a capacitor between ground and the analog input (as close to the ADC pin as possible). 1nF should be a good compromise between speed and filtering quality. Less accurate power supplies can be used if a large value low ESR capacitor is used across the 5V rail and the 1.1V reference is selected.
@unglaubichuberlieber8048
@unglaubichuberlieber8048 7 ай бұрын
thanks for your detailed demo+explanation, now i know what to do with these current sense, again thanks
@orveahava
@orveahava Жыл бұрын
Very good video. Thank you for your work.❤
@ElektorTV
@ElektorTV Жыл бұрын
Our pleasure!
@keen2461
@keen2461 4 ай бұрын
The bandgap reference on the Atmega328 can vary a bit from unit to unit. In order to have the highest accuracy, you can measure such value and make your calculations with the real value, not the one mentioned on the datasheet. I got great results doing that.
@mirjalolbahodirov4579
@mirjalolbahodirov4579 3 ай бұрын
Thanks for the detailed explanation 🙏
@ElektorTV
@ElektorTV 3 ай бұрын
Glad it was helpful!
@mixme8655
@mixme8655 3 ай бұрын
New subscriber always watching your videos very interesting❤
@ElektorTV
@ElektorTV 3 ай бұрын
Awesome! Thank you!
@UserName-cb6jz
@UserName-cb6jz 9 ай бұрын
At 7:25 you measured ONE value (4.834V) but inputted a slightly different value in the sketch (4.863V).
@y2ksw1
@y2ksw1 Жыл бұрын
Very nice!
@aflahalhajri4613
@aflahalhajri4613 2 ай бұрын
amazing
@hbuzdbuzdh9723
@hbuzdbuzdh9723 27 күн бұрын
National Instruments says a high speed ADC can be more accurate than a high resolution one. You take 4 or more samples and mediate them ! High resolution ADC measures, with precision !, spikes !
@RogerTannous
@RogerTannous Жыл бұрын
@2:49 additionally to floating-point calculation, isn't it more appropriate to multiply by 5 first, then do the dividing by 1024 as the last step ? Or does the compiler already do this optimization automatically ?
@ElektorTV
@ElektorTV Жыл бұрын
The compiler does not do calculation quality optimizations, only code optimizations. Multiplying by 5 works for integer maths but it remains integer so the output will be between 0 and 4. Floating point has enough precision that multiplying by 5 first doesn't improve much. larger factors like 100 or 1000, yes.
@sporniket
@sporniket Жыл бұрын
Since the max value of the ADC is 1023, I would divide by 1023 instead of 1024.
@sporniket
@sporniket Жыл бұрын
other than that, very interesting video
@ElektorTV
@ElektorTV Жыл бұрын
Yes, but no. The ADC's maximum theoretical value is 1024. 1024/1024=1. But 1024 = 0x400 which requires 13 bits whereas the registers are only 12 bit. Therefore, the maximum *register* value is 0x3ff, which is 1023. So the maximum value in practice is 1023/1024 = 0.999. See also the MCU's datasheet.
@sporniket
@sporniket Жыл бұрын
​@@ElektorTV Indeed, there is a catch... from the datasheet : "and the maximum value represents the voltage on the AREF pin minus 1 LSB."
@heikoindenbirken819
@heikoindenbirken819 Жыл бұрын
@@ElektorTV Yes, the MCU is not able to measure 5V. Now it depends on you how to overcome this problem. You can use 1024 to show the error only on 5V or use 1023 to spread out the error over the full range.
@heikoindenbirken819
@heikoindenbirken819 Жыл бұрын
@@ElektorTV PS.: The real problem is not the question 1023/1024, it is the multiplication with 5. It should be the 5-1 LSB instead.
@BugCrush3r
@BugCrush3r 8 ай бұрын
Very informative, Now how can we measure voltage and current and the phase angle (power factor) with an Arduino?
@ElektorTV
@ElektorTV 8 ай бұрын
Search the internet, e.g. solarduino.com/how-to-measure-power-factor-and-phase-angle-with-arduino/
@xuzm
@xuzm 11 ай бұрын
is there possible to read data from 20 batteries/cells from 1 adruino ?
@3D_Printing
@3D_Printing Жыл бұрын
What about a higher voltage inputs 0 to 500 volts maybe
@ElektorTV
@ElektorTV Жыл бұрын
The same principles apply, but the voltage divider needs more attention to support high voltages (use several resistors in series for instance).
@programmer1111x
@programmer1111x Жыл бұрын
I did it up to 600v. No problem. You will have a step of about 0.6v with the 1024 bit of th arduino uno.
@3D_Printing
@3D_Printing Жыл бұрын
@@programmer1111x great
@kalajulesraymond4968
@kalajulesraymond4968 Жыл бұрын
Can you please help me connect the following sensor to arduino: SUI-101a
@0124akash
@0124akash Жыл бұрын
Sir I will try to make dc volt meter using ESP32 and I2C 16*2 LCD. Am facing some critical condition Actual voltage 12.7V LCD display 12.7V But Actual voltage 7.4V LCD display 6.9V This problem only for ESP32, Arduino UNO is perfect work in range. How to solve this problem sir ?
@ultralaggerREV1
@ultralaggerREV1 3 ай бұрын
I need to make an arduino voltmeter to read from -20V to 20V
@mdmostafashahid948
@mdmostafashahid948 Жыл бұрын
can you make Ac voltage meter 0-400v with 0-20mA output or Rs485 Modbus RTU
@ElektorTV
@ElektorTV Жыл бұрын
Of course, you can. Just be careful with the high voltages.
@N.g.Chanal
@N.g.Chanal Жыл бұрын
can use esp32 12bit mcu is more prisesion?
@ElektorTV
@ElektorTV Жыл бұрын
In theory, yes, but keep in mind that more bits doesn't always mean more precision. The input circuitry must be up to the job too.
@incxxxx
@incxxxx 9 ай бұрын
Why you divide by 1024 when you have between 0 and 1023 only 1023 intervals of length 1.
@ElektorTV
@ElektorTV 9 ай бұрын
Because there are 1024 intervals. Please refer to the section entitled "ADC Conversion Result" of the ATmega328 datasheet. 1023 corresponds to VCC minus one LSB.
@0124akash
@0124akash 25 күн бұрын
You have no answer of my question ❓
@incxxxx
@incxxxx 9 ай бұрын
Good job, but 1.1/16 = (R1+R2)/R1 is never true.
@ElektorTV
@ElektorTV 9 ай бұрын
You are right, well spotted. It should read 1.1/16 = R1/(R1+R2). Sorry for any confusion caused.
Measure DC Voltage and Current with Arduino
37:29
DroneBot Workshop
Рет қаралды 197 М.
Different Ways for Measuring Current With Arduino
13:32
Electronoobs
Рет қаралды 73 М.
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 202 МЛН
Ouch.. 🤕
00:30
Celine & Michiel
Рет қаралды 21 МЛН
#10 Tutorial: Make the Arduino Analog Readings more precise
5:02
Andreas Spiess
Рет қаралды 81 М.
How to Make a Shunt Current Sense Resistor
11:17
ElectroBOOM
Рет қаралды 2,3 МЛН
12-bit DAC Arduino MCP4725 How To Use It - Stable Voltage Reffrence
11:21
Top Fifteen Mistakes People Make When Designing Prototype PCBs
12:26
Cosplay Light and Sound
Рет қаралды 141 М.
What does "impedance matching" actually look like? (electricity waves)
17:08
Arduino - Analogue Outputs
12:25
The Machine Shop
Рет қаралды 10 М.
Какой ноутбук взять для учёбы? #msi #rtx4090 #laptop #юмор #игровой #apple #shorts
0:18
Новые iPhone 16 и 16 Pro Max
0:42
Romancev768
Рет қаралды 2,3 МЛН
Сколько реально стоит ПК Величайшего?
0:37