Vrms prints correctly ONCE, then incorrect

Running into issues with my Ardiuno Leonardo and a ZMPT101B. Currently using the demo sketch for voltage and current with current disabled as I only need voltage. When I upload the sketch it prints roughly the correct voltage (need to calibrate some more) ONCE and then drops down and prints similar random numbers.

Here is the code:

// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3

#include “EmonLib.h” // Include Emon Library
EnergyMonitor emon1; // Create an instance

void setup()
{
Serial.begin(9600);

emon1.voltage(3, 150.7, 1.7); // Voltage: input pin, calibration, phase_shift
// emon1.current(1, 111.1); // Current: input pin, calibration.
}

void loop()
{
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 realPower = emon1.realPower; //extract Real Power into variable
float apparentPower = emon1.apparentPower; //extract Apparent Power into variable
float powerFActor = emon1.powerFactor; //extract Power Factor into Variable
float supplyVoltage = emon1.Vrms; //extract Vrms into Variable
float Irms = emon1.Irms; //extract Irms into Variable
}

This text will be hidden

For discussions related to emonPi, emonTx, emonBase and emonGLCD hardware and Arduino firmware

How have you connected that module? I cannot find a meaningful data sheet for it, it is not something we recommend, and I’m not aware that many users have tried to use it, but I did find some references when I searched. I did look at it some years ago and I had concerns about safety and the isolation between the mains and low voltage sides.

EmonLib has been in use by very many people for many years, so I do not believe there is a problem with the library.

Note that as you are not using the current input, only the voltage is valid, the power etc readings are meaningless.
Nevertheless, you should probably include emon1.current(1, 111.1); so that you do read from a real input pin. It would be safe (but meaningless) to have emon1.current(3, 111.1);