Homebrew IoTaWatt

Indeed, it’s better to create a separate thread, not to pollute this thread any further since it’s homebrew and modified.
I’ll check up on your last reply since all of the CT’s (12) are currently linked to the VT in channel 0 and none to the others.
I’ll try some more tests :wink:

That math works. 30ms per channel sample. 14 channels (12CT,2VT) = 420ms between channel 1 samples and 30 ms between chan 0. So two missed chan 1 samples. The difference in voltage drop is about 14:1. It’s altogether possible that the problem is much more frequent than you are reporting and that it only shows up significantly when it happens during the relatively infrequent channel 1 sample. 30ms of zero on channel zero is a blip.

Also, it’s different code to sample just a voltage channel vs a CT/VT pair. It’s possible there is something there.

One last comment here :wink: : just confirmed it: evenly spaced the CT over the VT’s (6 each). Now the difference is only found when looking for it : (channel 0: 223.4V and channel 1 221.6). So i’m guessing your on the right track!! (for the record: they both have 1 active CT on them, the rest is configured but not connected)

edit: when looking at the graph when only the VT on channel 0 was active i can see the small ‘dips’ also. Here they seem to be also at random intervals (one time 15min, others 5, sometimes 2…) and the dops vary from 1 to 3V

I don’t know if it’s a known bug or a problem with mine, but i started the IotaWatt with the VT not plugged in (still connected to Iotawatt). The feedback stayed on 0 and the AC cycles sampled/second also.
When i plugged the VT in it stayed like this.
After hard reboot (unplugg usb) it worked again.
I was able to reproduce the error.
Another strange thing was the Hz, normally it’s 49.9 or 50.0, but after connecting the VT is stayed on 55.0

Disconnecting the VT from the mains when IotaWatt is running gives the same problem: it falls back to 0, but after reconnecting the VT to the mains it doesn’t start reading again. So i’m guessing that when the main fails and the IotaWatt keeps running (ex on ups) it cannot restart it reading?

Thought I had that fixed, but I’ll take another look at it.

With AC adapter and DC power on the same circuit, its a self correcting system. Not sure why you might want to run it on a UPS, the RTC has battery backup (V4.3) and there’s not much to do while the power is off.

In my garage i have a ups powering all the network gear (cable modem, router, switch,…) and the Rpi’s. It also powers the usb hub that feeds most of my arduino/Rpi.
So i would just plug it in there also. I could power it without the UPS, but i just came across this problem by accident :wink: by forgetting to plugin the VT.

Took a quick look at this and I was able to reproduce, unfortunately only occasionally. Most of the time it worked OK. That’s harder to find than a solid failure, so I’ll have to stick in some diagnostics to get to the bottom of it. Not a high priority right now.

It would be helpful if you could determine if its solid for you, cite the version of firmware you are using, and post the problem under issues on Github. IotaWatt will be getting more exposure in the months to come and I need to start using the github problem management system to keep track of everything and manage multiple incidences of the same problem.


For me, it seems to be a solid failure (12 tests, 12 fails). I’m using the latest (2.02.15 - compiled from source).
I opened a issue on Github so you can keep track.

Any ideas where the problem could originate? I’m willing to have a look through the measuring code myself, but i’m not such an expert as you are :wink:

Did a little bit of digging and i noticed that the function readADC first gives 0 after disonnecting the VT, but then the Serial.println(ADC_in[1]); i placed on line 384 (just before the return of that function) starts giving junk like on the screenshot


Edit - moved screenshot from 3rd party site to OEM. BT - Moderator

Hi Jan,

Please attach your image to your post as opposed to putting it on a third party site.

If, for some reason the image becomes inaccessible, your post loses it’s value.


That looks like a buffer overflow, or more likely in this case, an overflow of the sample array. I’ll take a look at it when I get a chance. Thanks.

Came across another strange thing:
I connected my second VT, but i connected it to the same phase as the first (here at my desk i used the same outlet).
During calibration i noticed that the reading from both sensors went all over the place. (should be around 230V but dropped to 180 and than restoring.)
Now after putting in the calibration value i monitored the “input channel status” page.
It seems that frequently the voltage reading of the second VT (channel 1) would go wrong for a second or so (ex dropping to 139V of 217V where the other one shows 229V)
After 1 to 3 seconds it restores back to a correct reading.

I added a sreenshot of the graph since that’s more clear

I tried switching the VT’s but the “problem” stays the same.
The 2 VT’s are 2 euro plug versions from the OEM webstore (so should be the same)

I have let it run for an hour and it seems that the problem gets ‘lesser’, and occurs approx every 8 to 9 minutes

Edit, uploaded the images as well

I’ve run IotaWatt with two VTs with no apparent problems. I’ve had them on the same circuit, 180 apart (reverse the plug) and on different circuits (two sides of US split-phase service) I have not had any problems. Not to say there isn’t something, but are you sure it isn’t your hardware?

You have said there are two additional VT circuits, have you tried both?

I have tried connecting a vt to input 0 + 1 and 0 + 2, both with the same “problem”.
Strangely when i connect the vt to input 1 + 2 i seem to lose the measurements after 10 seconds or so, they drop to 0.

Maybe thats’s connected to the other problem when VT on input 0 was disconnected while the IotaWatt is running?

Maybe, is input 0 still configured as a VT?

Here’s an hour and a half of a production IotaWatt with two VTs:

I deliberately calibrated voltage_2 low so they would not overlap. Voltage 2 is on input 1.

All readings, whether voltage, power, or energy, are the average over the measurement period. In the case of the graphs shown, that period is 5 seconds. So any intermittent problem that causes zero will not necessarily show up as zero unless it is zero for the entire measurement period. The readings of about 190 suggest a zero reading for about 800ms or so during the interval, either as a single outage or a series of smaller ones. If you are sampling say 4 channels, the sample interval for one channel should be around 120ms - so zero for 5 or six of those.

To further complicate the problem, voltage channels are implicitly sampled when an associated power channel (CT) is sampled. So if channel zero is reference for say 4 power channels, but channel 1 (or 2) is not a reference voltage for any power channel, Channel zero will have a much greater frequency of measurement and will be affected much less by any brief duration lapse of say, the bias voltage.

I point this out because these graphs do indicate that channel 0 is affected, just not as much, which is what I would expect it is also a reference for power channels and channel 1 not so much.

To continue this discussion, could you start a new thread titled something like HomeBrew IotaWatt issues or something that distinguishes your project from discussions relating to the production hardware?

I did some more tests but i could not find what’s going wrong when unplugging the VT.
However i found some strange things when using 2 VT (channel 0 and 1, both have 6 CT):

  • unplug channel 0 and keeping channel 1 plugged in ==> everything falls to 0 (replugging without restart does nothing)
  • unplug channel 1 and keep channel 0 plugged in ==> no problem BU when replugging channel 1 everything falls to 0
  • unplugging both ==> everything falls to 0

Another question that i have is about “sharing” VT’s between multiple IotaWatts.
Can i just use a splitter to connect one VT to 2 inputs of different IotaWatt boards or will they create some kind of interference?

I’ve never tried to share a VT, although I think others have done it. Couple of caveats:

Be sure the polarity of all the plugs is the same. In barrel side of the jack sees ground through a 10uf cap (the cap on the bias net), so if the devices were to become connected to a common ground, the AC would short through the caps if different polarity.

I haven’t seen your schematic or board, but since you wired two additional voltage inputs, make sure the polarity of all the plugs is the same.

On my home IotaWatt, with a second VT on channel 14. Configured one of the CT channels to reference the second CT.

  1. Unplug channel zero VT and keep channel 14 plugged in. Channel zero and all of the power channels that reference it go to zero. Channel 14 and the power channel that references it are unaffected. Plug channel zero back in and everything comes back to normal levels. Did this several times.

  2. Unplug channel 14 and leave channel zero plugged in. Channel 14 voltage and the associated power channel go to zero, everything else in normal. Plug channel 14 back in and it reads normal and the associated power channel reads normal. Did this several times.

  3. unplugged both VTs. Everything goes to zero. Plug them back in and everything comes back.

There is something weird going on as either VT comes back (takes a few display cycles because the display has damping), the other seems to dip and increases back to its normal level - sort of in sympathy with it’s IotaMate. I plan to investigate this phenomena, but its not anything like what you are experiencing.

I added the second VT channel, configured some CTs to reference it. Did all of these experiments, and the thing is still running, and has been for ten days straight. No restart has been needed.

Thanks for your reply. A few questions since it seems only to affect my Iota :thinking:
Is your testboard version 4.3 with the seperated bias for the VT’s? (i use 4.1)
How did you connect the second VT?
Could it have something to do with bridging the 10uF caps (C9 on your design)

My schematic i identical to your 4.1 version, only with the part for the VT duplicated 2 more times (and removed 2 CT’s that were connected tot ADC11 and ADC12). Nothing else was changed.