This library powers the CircuitSetup Split Single Phase Energy Meter and the 6 Channel Expandable Energy Meter.
#include <ATM90E32.h>
ATM90E32 energy_meter{};
void setup() {
energy_meter.begin(CS_pin, lineFreq, PGAGain, VoltageGain, CurrentGainCT1, CurrentGainCT2, CurrentGainCT3);
}
A loop to get basic power data:
void loop() {
voltage1 = energy_meter.GetLineVoltageA();
voltage2 = energy_meter.GetLineVoltageB();
voltage3 = energy_meter.GetLineVoltageC();
CT1 = energy_meter.GetLineCurrentA();
CT2 = energy_meter.GetLineCurrentB();
CT3 = energy_meter.GetLineCurrentC();
watts1 = energy_meter.GetActivePowerA();
watts2 = energy_meter.GetActivePowerB();
watts3 = energy_meter.GetActivePowerC();
totalWatts = energy_meter.GetTotalActivePower();
}
The following are other functions for other metering data that the ATM90E32 calculates.
- GetReactivePowerA()
- GetReactivePowerB()
- GetReactivePowerC()
- GetTotalReactivePower()
- GetApparentPowerA()
- GetApparentPowerB()
- GetApparentPowerC()
- GetTotalApparentPower()
- GetPowerFactorA()
- GetPowerFactorB()
- GetPowerFactorC()
- GetTotalPowerFactor()
- GetPhaseA() //phase angle
- GetPhaseB()
- GetPhaseC()
- GetTotalActiveFundPower()
- GetTotalActiveHarPower()
- GetFrequency() //voltage frequency
- GetTemperature() //chip temperature
The following functions get data from the ATM90E32 that is converted to kWh. The registers are cleared once they are read.
- GetImportEnergy() //forward active energy
- GetImportReactiveEnergy()
- GetImportApparentEnergy()
- GetExportEnergy() //reverse active energy
- GetExportReactiveEnergy()
These functions get the raw hex values from the system status registers
- GetSysStatus0()
- GetSysStatus1()
- GetMeterStatus0()
- GetMeterStatus1()
This function takes the name of any register (defined in ATM90E32.h) and outputs the value
- GetValueRegister(registerRead)