Power monitor

excuse me i want to try make power monitor using emonlib in my arduino IDE. I use only nodeMCU to send the data but i have a problem that the nodeMCU have watchdog timer. I try only current and it works to send the data. Now i need to calculate the voltage. Is there any tips about using emonlib to calculate voltage without calcVI ( because the problem the nodeMCU reset by itself is this part)

Is your question about emonLib and an Arduino, or Iotawatt? These are two completely different things. If it is about Iotawatt, Bob Lemaire can now be found at https://community.iotawatt.com, he has set up a dedicated forum for IotaWatt, if you post your question there I’m sure he will get back to you quickly.

If your question is about emonLib, then I’m afraid there is no method to only read voltage. However, there is nothing to prevent you from modifying emonLib to do what you want. But first, you must understand why the watchdog timer is giving you a problem. Is it because the time set in the NodeMCU is too short to allow emonLib to make a reading? If it is, then you can maybe lengthen the watchdog timer, or shorten the sampling period that you use in emonLib.

sorry for the late response. I try to use emonlib on nodemcu to calculate the power of household equipment and suddenly got soft wdt reset there. I try to change the calcVI to calcVI(20,400) and it works. Now I want to know how it gets 20,400 ? and can i change the first number or the second number to the lowest as possible? Sorry for my bad english

If you look at the file EmonLib.cpp, you can see exactly what calcVI( ) does.

// emon_calc procedure
// Calculates realPower, apparentPower, powerFactor,Vrms, Irms, kWh increment
// From a sample window of the mains AC voltage and current.
// The Sample window length is defined by the number of half wavelengths or crossings we choose to measure.
void EnergyMonitor::calcVI(unsigned int crossings, unsigned int timeout)

“crossings” is the number of half wavelengths over which it measures the power. (One half-wavelength = 10 ms for me - you have not said your country so I don’t know what it is for you.)

“timeout” is the time it waits in ms for the mains voltage to cross through zero. It should do this every 10 ms. If it does not detect a voltage, then it gives up.

Your problem was, it was waiting too long and the watchdog in the nodeMCU thought it had stopped working.

You should make the first number as large as possible without the watchdog firing. Making it big gives you a better average for your readings.

The second should be big enough so that you are always sure of seeing a full mains cycle, so it should be more than 40 (ms), if you make it too small, it might never start making a reading. Ideally, it should be as big as possible without triggering your watchdog.

The correct solution is to make the watchdog timer longer, so that you can average the readings for whatever length of time you want. I do not know about nodeMCU so I cannot tell you how to do that.

Im sorry for late response. My Country is Indonesia and the reason I change it to 400 because of this. EmonLib.h with ESP8266 - #2 by Robert.Wall
I find that change watchdog timer still hard for me so i try to change the second number

Please add Indonesia in your “Country of Residence” in your Profile. Then, if you have any more questions about your mains electricity, or timezone, etc, we will know where you are.

As it happens, your mains frequency is 50 Hz, therefore the times I gave you are correct. Had you been in a 60 Hz country, they would have been wrong.

ok thanks for the help Robert.