A volt-meter is an electrical device/instrument that use to measure the electrical potential difference between two points, a voltmeter can be digital voltmeter or analogue voltmeter, A voltmeter mainly uses to measure two types of voltage either they can be ac(alternating voltages) or it can be DC(Direct current) in dc voltage magnitude of voltage remain constant while in ac voltage it fluctuates time to time.
Types of Volt-meter
- DC Voltmeter.
- AC Voltmeter.
How can Arduino help us measuring voltages
The most interesting thing about Arduino is there ADC(analogue to digital converter) it helps us a lot in many real-time problems so here in term of measuring voltage using Arduino we are taking the help of ADC, “An ADC works by sampling the value of the input at discrete intervals in time. The sampling rate must be according to Nyquist rate, defined as twice the highest frequency of interest, then all frequencies in the signal can be reconstructed” so how we are going to use this ADC to measure ac voltages using Arduino let me explain it briefly so first we need a step-down voltage like not higher than 12v of so to achieve this we need a step-down transformer so that we can step down 220v to 12v, as we know that our Arduino support only 5v either they can be as input or output it does not support more than 5v, so our next goal is to step it down further below or equal to 5v so that our Arduino can measure/process it without any damage to achieve it we can use most famous method voltages divider rule this can be done practically by using two resistors or using a potential meter it’s up to use how you achieve it, now we have achieved low voltage and now Arduino can read them perfectly so our next goal is to measure is to send stable voltage so that our arudino can measure them accurately without any fluctuation,to achieve this we need a filter and that job only capacitor can do perfectly if we connect it with our parallel of output circuit that goes to arduino then ardunio will receive a smooth voltages in result our arduino will measure contact real time perfect volatege with minimum error. Our last objective is to the protection of Arduino due to any fault if our input voltage increase they can burn our Arduino so for Arduino protection purpose we will use 5v Zener diode whenever input voltage will exceed more than 4.99v it will work as short circuit so that our Arduino remain safe.
Mathematical Calculation for ADC
Here the most important part is to make an assumption that setting a maximum voltage limit that our wapda voltages will not exceed more than that like here in Asia wapda supply is 220v so i took assumption of 330v that our wapda will not exceed more than that so that we can give our full instruction to Arduino within 5v.
5V input at A0 pin refers to 1023 bit value of arduino
So, 220V AC (r.m.s.)= 330V(peak) corresponds to
1bit correspond to = 330/1023 , Thus we have taken,
x=analogRead(A0) and ac voltage=a=(x*330/1023)
x = 220v at output serial monitor .
Arduino Sketch / Code
Here is arduino sketch for measuring ac voltages using arduino
<span class="has-inline-color has-vivid-cyan-blue-color">int x;// initializing variables
pinMode(A0,INPUT); // pin A0 as input pin for input voltages
Serial.begin(9600);// serial communication between Arduino andlaptop
x=analogRead(A0);// assigning analog values from pin A0 to variable x
y=(x* .304177);// analog value(x) into corresponding input ac supply value using this formula ( see working section)
Serial.print(" analog input " ) ; //
Serial.print(x) ; // print input analog value on serial monitor
Serial.print(" ac voltage ") ; //
Serial.print(y) ; // prints the ac output value on Serial monitor
<span class="has-inline-color has-vivid-cyan-blue-color">delay(200);//200ms delay so that we can read it easily