Arduino Projects

Arduino AC voltage Monitoring “Over voltage, Normal voltage and Under-voltage

AC Voltage Monitoring Project Description:

 

AC voltage Monitoring using Arduino- This tutorial is about the AC voltage monitoring and Protection against Overvoltage and Under voltage. This is part 1 and we will be displaying the voltage on a 16×2 LCD. While in part 2 we will design a SCADA application for monitoring voltage, frequency, load, and disconnection. I will be using the same circuit in part2 as well. In this, we will cover:

  1. Voltage sensor calculation for monitoring voltages up to 310 volts.
  2. Complete circuit diagram explanation.
  3. Programming and finally
  4. Testing


Amazon Links:

12v Adaptor:

Arduino Uno

Arduino Nano

Mega 2560:

Voltage sensor 0-25v:

Potentiometer:

16X2 LCD

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

DISCLAIMER:

Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

This project is basically based on my previous two tutorials.

This tutorial covers the basics of 16×2 LCD and I have explained everything from soldering to interfacing, so I will be using the same LCD connections. You should watch this tutorial for the best understanding.


While in this tutorial I explained everything about the voltage sensor and how to modify this sensor for monitoring higher voltages. You should watch this tutorial.

As explained in my previous tutorial, this voltage sensor simply consists of two resistors connected in series. the maximum input voltage of this voltage sensor is 25volts. So for 25v we get exactly 5 volts.

voltage Monitoring

Vin = 25v

R1 = 30k ohm

r2 = 7.5k ohm

We can find out the Output voltage, by using the voltage divider formula which is

Vout = ( r2  x  vin ) / ( r1 + r2)

vout = (7.5 x 1000 x 25)  /  (30k + 7.5k)

vout  = 187500 / 37500

vout = 5 Volts


voltage Monitoring

If we increase the input voltage the output voltage will also increase above 5v which can damage the analog pin of the controller. So for this we need to add another resistor in series. Let’s say we want to monitor voltages up to 310 volts.  Let’s first of all find the current of the voltage sensor.

Using v = ir

v = IR we can find the current

I =  V / R

I = 25 / ( 30k + 7.5K)

I = 25 / 37.5K

I = .000666 amps

I = 666 micro amps.

Now lets calculate the value of the resistor, which can be used in series with this voltage sensor to monitor 310volts.

Vx = 310 which is the input voltage

Rx = (Vx – 25 ) / 666 micro amps

Rx = 310 – 25 / 666 micro amps

Rx = .427 x 1000000

Rx = 428k ohm

Using this value of the resistor we can monitor voltages up to 310 volts.


Circuit Diagram of the AC voltage monitoring:

voltage Monitoring

Ac voltage is fed to the bridge rectifier through a fan regulator. This fan regulator will be used for varying the ac voltage, to check if we can successfully detect the over-voltage, normal voltage and under-voltage. This is a full-wave bridge rectifier. The +ve leg of the bridge rectifier is connected with the VCC of the voltage sensor through a 428K ohm resistor, this is the resistor that we just calculated and the ground of the bridge rectifier is connected with the ground of the voltage sensor. A 10uf capacitor is connected with the voltage sensor to get stable values. The s pin of the sensor is connected with the A1 pin of the Arduino and – the pin is connected with the ground.


As you can see ground is connected with pin number 1, 5 and pin number 16…5v from Arduino is connected with pin number 2 and pin number 15…the middle pin of the variable resistor or potentiometer is connected with pin number 3 of the LCD, using this potentiometer we can control the LCD contrast.…while the other two pins are connected with the ground and 5v. Pin’s 4 to 7 of the Arduino are connected with pins D7 to D4 of the LCD.

Pin number 8 of the Arduino is connected with the enable pin of the LCD….pin number 9 of the Arduino is connected with the RS pin of LCD…

Interfacing:

For the interfacing watch video Tutorial given at the End.

AC Voltage Monitoring Arduino Programming:

For the program explanation watch video tutorial given at the end.

#include <LiquidCrystal.h>

#define rs 9 
#define en 8 
#define d4 7 
#define d5 6  
#define d6 5 
#define d7 4 
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);



String TextForSms ;

// FOR THE VOLTAGE SENSOR
  float correctionfactor = 26; // 77
int analogInput = A1; 
float vout = 0; 
int vin = 0; 

// if we add 428k ohm resistor in series with the module 
// we can monitor the line voltage upto 310.048 

float R1 = 30000 + 428000;  // these are the 30k and 428k resistors   
float R2 = 7500; // 7.5 k 
int value = 0; 

void setup() {
  Serial.begin(9600); 
    // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("Voltage:");
  pinMode(analogInput, INPUT);

}

void loop() {
 
 
Voltage(); 

}

void Voltage()
{
   // read the value at analog input 
   value = analogRead(analogInput); 
   vout = (value * 5.0) / 1023.0; // see text 
   vin = vout / (R2/(R1+R2));

    vin = vin + correctionfactor; 
    
//Serial.print("INPUT V= "); 
//Serial.println(vin); 
delay(500); 
lcd.setCursor(10,0); 
lcd.print(vin);

if ( (vin > 0)  &&  (vin < 150) ) 
{
 lcd.setCursor(0,1);
lcd.print("Under Voltage"); 
}

if ( (vin >= 150)  &&  (vin <= 190) ) 
{
 lcd.setCursor(0,1);
lcd.print("Normal Voltage "); 
}

if ( vin > 190 ) 
{
 lcd.setCursor(0,1);
lcd.print("Over Voltage   "); 
}
}

Watch Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

3 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button