/* Basic.ino - Read measurements from a VIP_MONOFASICO power monitor. Works unmodified on AVR boards (Uno, Mega, Nano) and on every ESP32 variant (ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6, ...). On ESP32 boards you can optionally pick custom I2C pins before calling begin() - see the commented-out Wire.begin(sda, scl) line below. */ #include #include VIP_MONOFASICO meter; // default I2C address 0x77 void setup() { Serial.begin(115200); // On ESP32 boards you can choose custom SDA/SCL pins, e.g. Wire.begin(); //If you need specifi your SDA/SCL you can do it with the next line code //Wire.begin(21,22); if (!meter.begin()) { Serial.println("VIP_MONOFASICO not found - check wiring/address."); while (true) delay(1000); } Serial.println("VIP_MONOFASICO connected."); } void loop() { if (meter.update()) { Serial.print("VRMS: "); Serial.println(meter.voltage(), 2); Serial.print("IRMS: "); Serial.println(meter.current(), 3); Serial.print("HZ: "); Serial.println(meter.frequency(), 2); Serial.print("KW: "); Serial.println(meter.activePower(), 3); Serial.print("KVA "); Serial.println(meter.apparentPower(),3); Serial.print("KVAR "); Serial.println(meter.reactivePower(),3); Serial.print("PF: "); if(meter.activePower() < 0.01){ Serial.print("NA - undefined, needs active power present"); Serial.println("");} else Serial.println(meter.powerFactor(), 3); Serial.println("============================================"); } else { Serial.print("Read error: "); Serial.println(meter.lastError()); } delay(1000); }