-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmulti-energy-monitor.ino
57 lines (41 loc) · 2.36 KB
/
multi-energy-monitor.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <EmonLib.h>
EnergyMonitor emon1; // Create an instance
EnergyMonitor emon2;
EnergyMonitor emon3;
void setup()
{
Serial.begin(115200);
emon1.current(0, 30); // Current: input pin, calibration.
emon2.current(1, 30);
emon3.current(2, 30);
emon1.voltage(3, 234.26, 1.7);
emon2.voltage(3, 234.26, 1.7);
emon3.voltage(3, 234.26, 1.7);
}
void loop()
{
Serial.println("Sensore1");
emon1.calcVI(20,2000); // Calculate all. No.of half wavelengths (crossings), time-out
emon1.serialprint(); // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
float realPower1 = emon1.realPower; //extract Real Power into variable
float apparentPower1 = emon1.apparentPower; //extract Apparent Power into variable
float powerFActor1 = emon1.powerFactor; //extract Power Factor into Variable
float supplyVoltage1 = emon1.Vrms; //extract Vrms into Variable
float Irms1 = emon1.Irms; //extract Irms into Variable
Serial.println("Sensore2");
emon2.calcVI(20,2000); // Calculate all. No.of half wavelengths (crossings), time-out
emon2.serialprint(); // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
float realPower2 = emon2.realPower; //extract Real Power into variable
float apparentPower2 = emon2.apparentPower; //extract Apparent Power into variable
float powerFActor2 = emon2.powerFactor; //extract Power Factor into Variable
float supplyVoltage2 = emon2.Vrms; //extract Vrms into Variable
float Irms2 = emon2.Irms; //extract Irms into Variable
Serial.println("Sensore3");
emon3.calcVI(20,2000); // Calculate all. No.of half wavelengths (crossings), time-out
emon3.serialprint(); // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
float realPower3 = emon3.realPower; //extract Real Power into variable
float apparentPower3 = emon3.apparentPower; //extract Apparent Power into variable
float powerFActor3 = emon3.powerFactor; //extract Power Factor into Variable
float supplyVoltage3 = emon3.Vrms; //extract Vrms into Variable
float Irms3 = emon3.Irms; //extract Irms into Variable
}