How can I use the Arduino uno to measure a variable AC voltage? The range would be 0-5 VAC.
i want to show 0VAC= 0 to display (on 7 segment) and 5 VAC = 250 to display (on 7 segment)
(I don't want to convert 0 - 5 VAC to 0 - 5 VDC)
Hi,
I have the following suggestion but I do not know how good it may work. Use a diode to remove the negative side of the sine wave. Read the analog input for maybe 1 second and take the highest reading and multiply it by 2. It should give you ball park value. Compare it the voltmeter reading. Possible you may scan the analog input if you do not get a good reading.
(deleted)
Use a bridge rectifier with a small filter cap (1uf ?) and a resistor in parallel (1k). The bridge rectifier will charge the capacitor to the peak value of the incoming AC. The resistor in parallel is needed to drain off the charge on the cap so that it follows the voltage input if it decreases. Values are just a suggestion, if you need RMS multiply by 0.707.
Somebody else may have some scaling tips for you, but the rectifier and filter will give a dc voltage to measure with a analog input pin.
-
Vdc is proportional to Vrms.
-
For: Vac=0 ; Vdc = 0
Vac=5 ; Vdc = (2x1.414x5)/3.141 = 4.50 -
Make the precision full-wave rectifier:
0 - 5 VRMS ----> Full-wave rectifier -----> Filter 100 uF/16v in parallel with 2.2K resistor. -
Connect Vdc with A0-pin of ArduinoUNO.
-
Connect 4-digit multiplexed 7-seg cc-type display with Arduino.
(a) Drive the segments using PORTD (DPin-0 to 7).
(b) rive the cc-pins using PB0-PB3 (DPin-8 to 11). -
Calibrate your input device:
==> A(Vdc1, y1), B(Vdc2, y2), Q(Vdc, y)
==> (A(0, 0), B(4.5, 250), Q(Vdc, y)
==> A(0, 0), (4.5, 250), Q(Vdc, y)
==>(250-0)/(4.5-0) = (y-0)/(Vdc - 0)
==> 250/4.5 = y/Vdc
==> y = 250/4.5 * Vdc = 55.55* Vdc = 55.55*(5/1023)*ADC ; ADC = (1023/5)*Vdc
==> y = 0.2715*ADC
==> y*10[sup]4[/sup] = 2715*ADC = 0A9Bh*ADC = 0A9Bh*analogRead(A0)
-
The Program:
L1: Initialize everything as needed
L2: Acquire Vdc
L3: Compute y = 0A9Bh*analogRead(A0) ; 000000h - 261D08h = 00000000 - 02497800
L4: Convert 24-bit Binary of L3 into BCD
L5: Keep upper 4-digit and convert them into 4-byte cc-codes
L6: suppress the leading zero; send the cc-code into 7-seg display
L7: Insert 2-sec delay; Goto L2 -
Convert the Text Codes of Step-7 into C codes and place them in the
void setup() {}, void loop() {} structures of Arduino IDE. -
The DVM is now ready.