SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By ruddog
As mentioned my board is the NodeMCU and I am writing sketches for it using the Arduino IDE. Currently, the board is set up to read 115 Volt AC current via the SCT-013-30 current sensor. All works well except when the device is first booted up or reset is enacted there is a brief display of current values. This can be seen via the port monitor and they appear to be anomalies for about 10 seconds before they settle down to near zero. I would like to allow a settling time before starting to take current readings. BTW the code is copied from searches via google. Also, I am not a programmer just a hobbyist.

How do I allow the settling time to pass before taking and displaying a reading via port monitor?

#include "EmonLib.h"
// Include Emon Library
EnergyMonitor emon1;

// Create an instance

void setup()


emon1.current(A0, 111.1); // Current: input pin, calibration.


void loop()

double Irms = emon1.calcIrms(1480); // Calculate Irms only

Serial.print("Apparent Power ");
Serial.print(Irms*230.0); // Apparent power
Serial.print(" ");
Serial.print("Irms ");
Serial.println(Irms); // Irms