POWER FACTOR MEASUREMENT USING ARDUNO

Photo of author

By Jackson Taylor

CIRCUIT

ACS712 CURRENT SENSOR OUTPUT

CURRENT AND VOLTAGE WAVES AT THE OUTPUT OF COMPARATOR

CURRENT AND VOLTAGE WAVES AT THE OUTPUT OF COMPARATOR

OUTPUT OF HIGH PASS FILTER

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video

OUTPUT OF INSTRUMENATION AMPLIFIER INA122

VOLTAGE AND CURRENT INPUT

VOLTAGE AND XOR GATE OUT

VOLTAGE OR CURRENT INPUT AND OUTPUT

PROGRAM

int x,y,r=0;
float z;//time,angle,pf,radians,pf2 relay
#define echoPin 11 // Echo Pin
#define pf1 9
#define pf2 9
//#define overvoltrelay A3
#include <LiquidCrystal.h>
LiquidCrystal lcd(3, 4, 5, 6, 7, 8);//LCD RS-12,En-11,D4-5,D5- 4,D6-3,D7-2,
void setup()
{
  relayinit();
 // Serial.begin (9600);
 usinit();
 lcdstart();
 digitalWrite(pf1,LOW);
}
void loop()
{
uscheck();
//voltagecheck();
}
/*void voltagecheck(void)
{
  int f=analogRead(A0);
  if(f>480)digitalWrite(overvoltrelay,HIGH);
  else digitalWrite(overvoltrelay,LOW);
    lcd.setCursor(0, 0);
    lcd.print("volt=");
    int v=f/2;
    lcd.print(v);}
*/
void usinit(void)
{
pinMode(echoPin, INPUT);
}
void uscheck(void)
{
x = pulseIn(echoPin,LOW);//reads  duartion pulse in Microseconds
 y = (x*9)/1000;
z=cos(y*0.01745);
//if (y>10 && r==1)digitalWrite(pf2,HIGH);else digitalWrite(pf2,LOW);
if(y>10 && r==0){digitalWrite(pf1,HIGH);r=1;}
else if (r==1 && y>10){digitalWrite(pf1,LOW); r=0;}
if(x>500)
{
  delay(500);
  lcd.setCursor(0, 1);
  lcd.print("PF=");
  lcd.print(z);
  }
}
void relayinit(void)
{
 pinMode(pf1,OUTPUT);
 pinMode(pf2,OUTPUT);
 // pinMode(overvoltrelay,OUTPUT);
}
void lcdstart(void)
{
  lcd.begin(16, 2);// set up the LCD's number of columns and rows:
 //lcd.print("welcome");// Print a message to the LCD.
 //delay(500);
 lcd.clear();
}
See also
BOOST CONVERTER USING ARDUINO - SIMULATION IN PROTEUS

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works