Skip to main content

AC Voltmeter using Arduino

AC Voltmeter using ArduinoAC Voltmeter using Arduino
In this project, we are going to make an AC Voltage Measuring Device using Arduino, which will measure the voltage of Alternating Current Supply at our home.  We are going to print that voltage on serial monitor of Arduino IDE as well as show on the multimeter.
Making a Digital Voltmeter is a lot easy than making an analog one because in case of analog voltmeter you must have good knowledge of physical parameters like torque, friction losses etc. whereas in case of digital voltmeter you can just use a LCD or LED matrix or even your laptop (as in this case) to print the voltage values for you. Here are some Digital Voltmeter Projects:

Required Components:

  1. One 12-0-12 transformer   
  2. 1N4007 diode   
  3. 1uf capacitor   
  4. Resistors 10k; 4.7k.   
  5. Zener diode(5v)   
  6. Arduino UNO   
  7. Connecting wires

Arduino Voltmeter Circuit Diagram:

 AC voltmeter using Arduino circuit diagram
Circuit Diagram for this Arduino Voltmeter is shown above.
Connections:
  1. Connect high voltage side(220V) of transformer to the mains supply and low voltage(12v) to the voltage divider circuit.
  2. Connect 10k resistor in series with 4.7k resistor but make sure to take voltage as input across 4.7k resistor.
  3. Connect diode as shown.
  4. Connect capacitor and zener diode across 4.7k
  5. Connect a wire from n-terminal of diode to the analog pin A0 of Arduino.
** Note:  Do connect ground pin of Arduino to the point as shown in the figure or circuit will not work.
AC-voltmeter-using-Arduino Transformer for AC voltmeter using Arduino
measuring voltage with multimeter AC voltmeter using Arduino measuring voltage in serial monitor AC voltmeter using Arduino

Need of voltage divider circuit?
As we are using 220/12 v transformer, we get 12 v on l.v side. Since this voltage is not suitable as input for Arduino we need a voltage divider circuit which can give suitable voltage value as input to Arduino
.
Why diode and capacitor is connected?
Since Arduino do not take negative voltage values as input, we first need to remove negative cycle of step down AC so that only positive voltage value is taken by Arduino. Hence diode is connected to rectify the step down voltage. Check our Half wave rectifier and Full wave Rectifier circuit to learn more about rectification.
This rectified voltage is not smooth as it contains large ripples which cannot give us any exact analog value. Hence capacitor is connected to smooth out the a.c signal.

Purpose of zener diode?
Arduino can get damage if voltage greater than 5v is fed to it. Hence a 5v zener diode is connected to ensure safety of Arduino which breakdowns in case this voltage exceeded 5v.

Working of Arduino based AC Voltmeter:

1. Step down voltage is obtained on l.v side of transformer which is suitable to use across normal power rating resistors.
2. Then we get suitable voltage value across 4.7k resistor
Maximum voltage that can be measured is found by simulating this circuit on proteus (explained in simulation section).
3. Arduino takes this voltage as input from pin A0 in form of analog values between 0 to 1023. 0 being 0 volt and 1023 being 5v.
4. Arduino then converts this analog value into corresponding mains a.c. voltage by a formula. (Explained in code section).

Simulation:

AC-voltmeter-using-Arduino-simulation-311VSimulating AC 311 RMS voltage using AC Arduino Voltmeter
Exact circuit is made in proteus and then simulated. To find maximum voltage that this circuit can measure hit and trial method is used.
On making alternator’s peak voltage 440 (311 r.m.s), voltage on pin A0 was found to be 5 volts i.e. maximum. Hence this circuit can measure maximum 311 r.m.s voltage.
Simulation is performed for various voltages between 220 r.m.s to 440v.
Simulating AC 285 RMS voltage using AC Arduino VoltmeterSimulating AC 285 RMS voltage using AC Arduino Voltmeter

Code Explanation:

Complete ArduinoVoltmeter Code is given at the end of this project and it is well explained through the comments. Here we are explaining few part of it.

m is the input analog value received on pin A0 i.e.,
m=    pinMode (A0,INPUT) ;  // set pin a0 as input pin

To assign variable n to this formula n=(m*.304177),  first some sort of calculations is performed by using the data obtained in simulation section:
As seen in simulation photograph, 5v or 1023 analog value is obtained at pin A0 when input a.c voltage is 311volts. Hence:
1023 analog value corresponds to 311 volt mains supply
So any random analog value corresponds to (311/1023)*m where m is obtained analog                value.
Hence we arrive at this formula:
n=(311/1023)*m volts or n=(m*.304177)
Now this voltage value is printed on the serial monitor by using serial commands as explained below. And also shown on the multimeter as demonstrated in the Video below.

Values printed on the screen are:
Analog input value as specified in the code:
Serial.print("   analog input  ") ; // this gives name which is “analog input”  to the printed analog value 

Serial.print(m);// this simply prints the input analog value

Required a.c voltage as specified in the code:
 Serial.print("   ac voltage  ") ; // this gives name  “ac voltage”  to the printed analog value 

 Serial.print(n) ;  // this simply prints the ac voltage value
Code: 
int m;// initialise variable m
float n;//initialise variable n
void setup()
{
  pinMode(A0,INPUT); // set pin a0 as input pin
  Serial.begin(9600);// begin serial communication between arduino and pc
}
void loop()
{
  m=analogRead(A0);// read analog values from pin A0 across capacitor
   n=(m* .304177);// converts analog value(x) into input ac supply value using this formula ( explained in woeking section)
  
   Serial.print("   analaog input  " ) ; // specify name to the corresponding value to be printed
   Serial.print(m) ; // print input analog value on serial monitor
   Serial.print("   ac voltage  ") ; // specify name to the corresponding value to be printed
   Serial.print(n) ; // prints the ac value on Serial monitor
   Serial.println();
}
Video: 

Comments

Popular posts from this blog

Automatic Call answering Machine using Arduino and GSM Module

Automatic Call answering Machine using Arduino and GSM module In today’s modern world we all depend on mobile phones as our primary means of wireless communication. But, we all have faced situations during which we might not be able to answer to our calls, these calls might be an important personal call or a life changing business call and you could have just missed that opportunity since you were not able to answer that call at that particular time. This project aims to solve this problem by creating an  Automatic Call answering Machine by using Arduino and GSM module . Next time when you are changing to a new phone number or out for a long pilgrimage trip or enjoying a well deserved vacation just use this machine to record your voice stating the reason for absence and all your calls will be automatically answered by this machine and your recorded voice will be played to them. This can also be used for your business numbers to answer to your customer’s calls duri...