0% found this document useful (0 votes)
5 views3 pages

Code

The document contains an Arduino sketch for an automatic power factor correction system using a LiquidCrystal display. It measures the power factor based on the input signal and adjusts the output accordingly for inductive or resistive loads. The system displays the load type and power factor on the LCD while also printing the values to the serial monitor.

Uploaded by

bekelebate00
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Code

The document contains an Arduino sketch for an automatic power factor correction system using a LiquidCrystal display. It measures the power factor based on the input signal and adjusts the output accordingly for inductive or resistive loads. The system displays the load type and power factor on the LCD while also printing the values to the serial monitor.

Uploaded by

bekelebate00
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

0336267001591025168_pfc_calibrated.

txt
1#include <LiquidCrystal.h>
2LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
3
4int input=13;
5int output=7;
6int led=6;
7
8float rads = 57.29577951;
9float degree = 360;
10float frequency = 50;
11float micro = 1 * pow (10,-6);
12
13float angle;
14float powerfactor;
15
16void setup()
17{
18 Serial.begin(9600);
19 pinMode(input,INPUT);
20 pinMode(output,OUTPUT);
21 pinMode(led,OUTPUT);
22 lcd.begin(16, 2);
23 lcd.setCursor(0,0);
24 lcd.print("Automatic Power");
25 lcd.setCursor(0,1);
26 lcd.println(" Factor Correct ");
27 delay(500);
28 Serial.begin(9600);
29}
30
31void loop()
32{
33 angle = ((((pulseIn(input, HIGH)) * micro)* degree)* frequency);
34 powerfactor = cos(angle / rads);
35
36 Serial.println(angle);
37 Serial.println(powerfactor);
38
39 if (powerfactor < 1)
40 {
41 digitalWrite(output,HIGH);
42 digitalWrite(led,HIGH);
43 Serial.println(powerfactor);
44 lcd.clear();
45 lcd.setCursor(0,0);
46 lcd.print(" Inductive Load ");
47 lcd.setCursor(4,1);
48 lcd.println("PF = ");
49 lcd.setCursor(9,1);
50 lcd.println(powerfactor);
51 delay(500);
52 }
53 else
54 {
55 digitalWrite(output,LOW);
56 digitalWrite(led,LOW);
57 Serial.println(powerfactor);
58 lcd.clear();
59 lcd.setCursor(0,0);
60 lcd.print(" Resistive Load ");
61 lcd.setCursor(4,1);
62 lcd.println("PF = ");
63 lcd.setCursor(9,1);
64 lcd.println(powerfactor);
65 delay(500);
66 }
67}
}

You might also like