0% found this document useful (0 votes)
7 views2 pages

PZEM004T Power Factor Calculation Code

This document contains an Arduino sketch that uses a PZEM004T v30 energy monitor and a LiquidCrystal display to calculate and display power factor (PF). It welcomes the user, calculates the PF, and if the PF is below 0.95, it sequentially adds capacitors while recalculating and displaying the new PF. The program includes delays for user readability and updates the LCD with the current status and PF values.

Uploaded by

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

PZEM004T Power Factor Calculation Code

This document contains an Arduino sketch that uses a PZEM004T v30 energy monitor and a LiquidCrystal display to calculate and display power factor (PF). It welcomes the user, calculates the PF, and if the PF is below 0.95, it sequentially adds capacitors while recalculating and displaying the new PF. The program includes delays for user readability and updates the LCD with the current status and PF values.

Uploaded by

Abhi J
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

#include <PZEM004Tv30.

h>
#include <LiquidCrystal.h>
const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

PZEM004Tv30 pzem(11, 12);

void setup() {
[Link](16, 2);

float pf = [Link]();
[Link](4, 0);
[Link]("WELCOME!");
delay(5000);

[Link]();
[Link]("calculating...");
delay(3000);

[Link]();
[Link]("without cap");
[Link](0, 1);
[Link]("PF: "); [Link](pf);
delay(5000);

if (pf < 0.95)


{
digitalWrite(8, HIGH);
pf = [Link]();

[Link]();
[Link]("calculating...");
delay(3000);

[Link]();
[Link]("adding 1 cap");
[Link](0, 1);
[Link]("PF: "); [Link](pf);
delay(3000);
}
if (pf < 0.95)
{
digitalWrite(9, HIGH);
pf = [Link]();

[Link]();
[Link]("calculating...");
delay(3000);

[Link]();
[Link]("adding 2 cap");
[Link](0, 1);
[Link]("PF: "); [Link](pf);
delay(3000);
}
if (pf < 0.95)
{
digitalWrite(10, HIGH);
pf = [Link]();

[Link]();
[Link]("calculating...");
delay(3000);

[Link]();
[Link]("adding 3 cap");
[Link](0, 1);
[Link]("PF: "); [Link](pf);
delay(3000);
}

You might also like