AC Voltage Measurement using Microcontroller with Proteus Simulation

Hello friends! In today’s topic we will study AC Voltage Measurement using Microcontroller. So let us start out topic.

AC Voltage Measurement using Microcontroller with Proteus Simulation

 
[otw_is sidebar=otw-sidebar-1]         To measure AC voltage, you require to step down this voltage. Because microcontroller can not evaluate voltage larger than 5V. If you offer voltage above 5V to microcontroller, it will get harm forever. To satisfy shelter of microcontroller, you will require to step down 220v AC whose peak value must be low than 5V. For example, 220V AC means root mean square and its peak value is uniform to 311v. Precisely you have to step down high AC voltage so that its peak value need not be above than 5 volt.AC Voltage Measurement using Microcontroller with Proteus Simulation

pcbway

 

 

#include <LiquidCrystal.h>
//                BS  E  D4 D5  D6 D7
//LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

LiquidCrystal lcd(7, 6, 5, 4, 3, 2); 
const int rly1 =  32;      // 
const int rly2 =  30;      // 

int v11 = A1;
int c11 = A0;

 char d1 = '0';
  char d2 = '0';
  char d3 = '0';
  char d4 = '0';


long tempReading ;
long tempVolts;
long  z;

 long tempReading1;
 long tempReading2;
 long  tempb;
 long  temps;
 long  tempc;///cuerr
 long  tempc1;///cuerr
 long  power;
 
long   v1,v2,v3,i1,i2,i3,p1,p2,p3,t1 ;
long voltage,current,power2; 
 
void setup()
{
 

  Serial.begin(9600);    	//initialize serial
   lcd.begin(16,2);
    pinMode(rly1, OUTPUT);
    pinMode(rly2, OUTPUT);
 
 
digitalWrite(rly1, LOW);//  
digitalWrite(rly2, HIGH);//  
   lcd.setCursor(0,0);
     delay(200);
  lcd.clear();
 }
 
void loop()
{
   lcd.begin(16,2);
  lcd.clear();
getad();///read data and send from plc 
    delay(1000);
getad();///read data and send from plc 
    delay(1000);
getad();///read data and send from plc 
 
if(i1>1000){
digitalWrite(rly2, LOW);//  
}else{
digitalWrite(rly2, HIGH);//  
  }



if(i1>1700){
digitalWrite(rly1, HIGH);//  
  lcd.begin(16,2);
  lcd.clear();

  lcd.setCursor(0, 0);  lcd.print("OVER LOAD");
    delay(4000);

} 

  
}

void getad(){ /// measure current and display on lcd 
///////////////////////////////////////
Serial.print("CURRENT =");
tempReading1 = analogRead(c11);
   tempc = tempReading1 * 5000 / 1024;
 i1=tempc;
  lcd.setCursor(0, 0);  lcd.print("I1=");
  lcd.setCursor(3, 0);
    d1=tempc/1000;
  d2=(tempc/100)%10;
  d3=(tempc/10)%10;
   lcd.write(d1+48);
   lcd.write('.');
   lcd.write(d2+48);
  lcd.write(d3+48);

d1=d1+48; d2=d2+48; d3=d3+48;
Serial.write(d1);Serial.write(d2);Serial.write(d3);


////////////////////////////////////////
tempReading1 = analogRead(v11);
   tempc = tempReading1 * 5000 / 1024;
 v1=tempc;
 lcd.setCursor(8, 0);  lcd.print("V1=");
  lcd.setCursor(11, 0);
    d1=tempc/1000;
  d2=(tempc/100)%10;
  d3=(tempc/10)%10;
   lcd.write(d1+48);

Serial.print("Voltage =");
     lcd.write(d2+48);
   lcd.write(d3+48);
d1=d1+48; d2=d2+48; d3=d3+48;
Serial.write(d1);Serial.write(d2);Serial.write(d3);


////////////////////////////////////////
/*
p1=v1*i1;p1=p1/1000;
tempc=p1;
 lcd.setCursor(0, 3);  lcd.print("P1=");
    d1=tempc/1000;  d2=(tempc/100)%10;d3=(tempc/10)%10;
  lcd.setCursor(3, 3); lcd.write(d1+48);   lcd.write(d2+48);lcd.write(d3+48);
Serial.print("Power =");

d1=d1+48; d2=d2+48; d3=d3+48;
Serial.write(d1);Serial.write(d2);Serial.write(d3);
 /////////////////////////////////////////////////

*/




}

Main Components:

Resistor

Capacitor

Amplifier

VSine

LED

 

Capacitor:

A capacitor is a two end stage electrical device. Through with resistors and inductors, they are the most basic submissive components we work on. Capacitor is a unique component which has the ability to stock energy in it.  They are similar with electric battery. Capacitor as we normally mention to have all type of censorious request in circuits. Usual applications embrace local energy storage and complex signal filtering.

Resistor:

The resistor is an electronic element has the capacity to pass the electron. Resistor is utilizing to brick the current and also turn upon the resistance merit. The symbol of resistance is. It is denoting as RN. The formula is

         V=IR   I=V/R   R=V/I 

LED:

        LED is a light emitting diode. This led is a special semiconductor diode which control the flow of current. Light is cause inside the solid semiconductor matter. LED called as solid-state devices. These idioms of solid-state lighting which surrounded with organic LED differentiate this lighting technique from other origin that is use for heated fiber.

Amplifier:

        The LM386 is a kind of operational amplifier. Operational amplifiers have a fundamental duty. They grasp an input potential and produce an output potential that is thousands of times the immensity of the input potential. In an amplifier circuit grasp an audio signal and grow its possible wherever 200 times. That amplification is called as the voltage gain.

V Sine:

        The periodic time or the frequency of the alternating quantity, different parameter of the AC waveform is amplifier called as Maximum or Peak value represented.

The peak value is the larger value of each voltage or current that the waveform extends during half cycle uniform from the zero baselines. DC voltage which has a fixed state that can be uniform or measured using Ohm law, an alternating amount is always changing its value above time.

    

AC Voltage Measurement using Microcontroller with Proteus Simulation

   

So guys this is it. I hope we had a great experience with us. Stay connected to get this useful and interested topic.