Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
danpeig committed Dec 26, 2022
1 parent f9db2b8 commit afa9a12
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions calibrate-vi/calibrate-vi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,14 @@ void setup()
// Phase 3
// emon3.voltage(V3, CV3, 1.732); // Voltage: input pin, calibration, phase_shift
// emon3.current(I3, CI3); // Current: input pin, calibration.

}

void loop()
{

Serial.println("------------");

// Phase 1
emon1.calcVI(120, 2000); // Calculate all. No.of half wavelengths (crossings), time-out
// emon1.serialprint(); // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
Expand Down
12 changes: 6 additions & 6 deletions esphome-esp32emon/esp32emon.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@
#define I3 33

// Calibration for voltage sensors CV and current sensors CI
#define CV1 540
#define CV2 540 //Set to CV1 if using only one voltage meter
#define CV3 540 //Set to CV1 if using only one voltage meter
#define CV1 545
#define CV2 545 //Set to CV1 if using only one voltage meter
#define CV3 545 //Set to CV1 if using only one voltage meter

#define CI1 94.97
#define CI2 94.06
#define CI1 96.72
#define CI2 94.93
#define CI3 1

class MyPowerSensor : public PollingComponent, public Sensor
{
public:
MyPowerSensor() : PollingComponent(POLLING_INTERVAL) {}

float get_setup_priority() const override { return esphome::setup_priority::AFTER_WIFI; }
float get_setup_priority() const override { return esphome::setup_priority::LATE; }

EnergyMonitor emon1; // Phase 1
EnergyMonitor emon2; // Phase 2
Expand Down

0 comments on commit afa9a12

Please sign in to comment.