ESP8266 WiFi power monitor

Bob,

It would be a great shame if you did take this somewhere else. I’m sure I’m not alone in reading this thread with great interest.

If you do, then please let us know where you will continue to document things.

Also I’ve been meaning to mention this for a while but would anyone else be interested in a version with say only 4 inputs? And if so can anyone do the work to enable others to order such a board? Something sadly that I’m not equipped to do.

Simon

1 Like

Myself @TrystanLea and @Gwil run the online store and handle manufacturing and sale of OEM units via the shop via our company https://megni.co.uk.

I have been following this thread with interest, please don’t take your discussion elsewhere. This would be a great shame. Combining an ESP with an SPI ADC is a good idea.

We have been working on the software side of ESP, as Serial > WiFi connection > Emoncms / MQTT gateway GitHub - openenergymonitor/EmonESP: ESP8266 WIFI serial to emoncms link with future plans to integrate an ESP onto an emonTx.

1 Like

Project is on GitHub under IoTaWatt. This is the link.
I’ll reference a new blog for discussion there.

Seems Like the source code is not there. Are you planning on sharing it?
Impressive work BTW.

It’s there now.

Thanks for sharing! looking forward to learn from your code!
for the “IoTaMCP23S17”: you could just put a subfolder “libraries” on github with subfolder “IoTaMCP23S17” in it and put the IoTaMCP23S17.h and IoTaMCP23S17.cpp in there.

Been developing a lot of calibration data and thought I’d share this phase-lead info for the SCT013-000 with various burdens in case you might be wanting to fine tune. Don’t forget to subtract the phase lead of the Voltage Transformer to get a net correction. Some of the high indicated lead at very low currents is suspect, but the trend seems reliable. At 5A and above, I can correct out about 80% of the indicated lead by shifting the CT data the indicated number of degrees.

1 Like

I think you’ll find rather more information in the report for the said CT, in Resources.

I agree. That’s an excellent report with regard to the eMonTX. Consider this information supplemental and supportive of that report’s findings. What I found to be useful here was the idea that the phase shift can actually be estimated as a pretty straightforward function of current. That’s implied in the report’s logarithmic plot, but not in sufficient detail to actually develop the function. This data does that.

Here’s some more details to support the linearity findings. Note that the trend line equations are the calibration values for the particular CT-burden combination.

I put this data out there because it’s the product of an effort to make an automated calibration device based on an unaltered (except for software) IoTaWatt and a low voltage test device inspired by Mr. Wall’s description of his sound card test apparatus.


Note that the apparatus collects about 150 data points in about a minute. The results are copied into spreadsheets for graphing. So while this may be “rather” less information than the original report, it provides a basis to generate quick and accurate data on virtually all of the available CTs out there. I can tell you that there are some pretty expensive CT’s that test identically to much less expensive brand-X CT’s on eBay.

While we’re somewhat on the subject of phase shift, I have some limited observations on the other end of the problem - the voltage sensing VT. I’ve got another test apparatus and procedure, again using the IoTaWatt as a platform, to measure the phase shift of voltage transformers. I’ve got three different brands. One labelled “Global Village” with no idea how I came to have it. The others are current products of Jameco and Digikey(CUI inc.).

I had measured the Jameco with an oscilloscope and a much maligned (in this forum) technique and found it to be "around 4deg lead. Now I have a much more accurate approach, but I cannot reveal the details because the safety police may stomp on my post again.

Nevertheless, I am quite confident of the results. I had assumed that all of these wall plug transformers would test out about the same. Nothing I have read (I could easily have missed something) indicates that there is much variation. But of the three, the phase lead measured was 2.75, 4.5 and 1.1. Quite a range.

So on this limited sampling, I have an observation that may or may not hold up as I acquire and test others: The phase lead is inversely proportional to the weight of the transformer.

Jameco: 4.5 deg, 202 grams
Global Village 2.75 deg, 273 grams
Digikey 1.1 deg, 307 grams

Buy 'em by the pound. More on this story as it develops.

(12/24 edited to correct weights. Eyesight getting poor in my old age)

The IoTaWatt has come a long way. It now has a built in web server that supports a configuration application. The configuration app, as well as the configuration Json file and supporting table file are on the SDcard and served up by the device file server. The server also responds to various xmlHTTP requests from the configuration app. I’ll be uploading the new software version to GitHub in a couple of weeks. The IoTaWatt board hasn’t changed much, except that I’m now using MCP3208 ADCs (12 bit) instead of the 3008 (10 bit) chips. They have identical packaging and the new software will detect which ADC is used.

The file server is pretty much the ESP8266WebServer, available on GitHub by Hristo Gochkov. I adapted it and added some services, but it’s pretty slick right out of the box. A big bonus is the editor that is packaged in that uses the Ace editor. A very nice HTML and JavaScript editor. You can edit the application right on the SD while the IoTaWatt is monitoring your energy use. It does file web service during the half cycles between power sampling.

I slapped the application on the future IoTaWatt web site so you can get the look and feel. Because it’s not on the local server, the commit and restart doesn’t do anything, and the Device Status doesn’t work because the hosting service doesn’t know how to respond to the query requests.

IoTaWatt configuration teaser

There could actually be some substance in that. Most isolating transformers (aka adapters) are designed and built for one purpose, to provide just adequate performance at a minimum price. So the less materials inside, the better (= more competitive, more profit). But that inevitable means that the iron is working close to saturation, and linearity and phase shift suffer - but neither matter if the load is a bridge rectifier. Losses suffer too, but that’s the users problem.

I can outdo you on phase shift: I have an ex-equipment one that I think was specially made to generate the phase reference in a (analogue) thyristor drive. That shows a phase lag of between 0.3° and zero. Size-wise, the frame is about 54 × 45 × 23 mm, it weighs 400g but it’s rated at 1.7 VA.

Is that a pun? Yea, the plastic doesn’t weigh much - it’s gotta be the iron and copper. Anyway, while I’d prefer a small shift, knowing accurately what it is is half the battle. I think there was a discussion awhile back, and the upshot was that the VT lead is pretty much a constant, so if I know what it is, I can deal with it pretty srtaightforward. There was someone as I recall that was seeing changes because his 240 volt supply was all over the place. We generally don’t have that problem in the US on 120V.

Only if the voltage is constant! You look at the curve for the Ideal adapter (I tested the UK variant, I haven’t got a 60 Hz supply, which incidentally means your CT results are invalid for the rest of the world). The EU voltage is 230 ± 10%, the UK used to be 240 ± 6%, but got widened to encompass the EU range as well, so my voltage could go from 207 V to 254.4 V.

I think that’s what I said. In any event, the discussion concerned the relative consistency of the VT vs the CT.

The point was that they are not my results. With this device and an off-the-shelf IoTaWatt, the calibrations can be performed quickly and accurately in your part of the world and entered into the tables associated with the configuration utility. You could easily replicate this. I don’t know how much longer you guys are going to keep answering the same forum questions about calibration factors and CTs. It doesn’t work for me. Ordinary people with other fields of interest are just not going to warm up to reinventing the wheel over and over. If there is going to be an open solution to this problem, somebody has to move past the calibration issues.

BTW/ Do you really think there would be a huge difference at 50Hz? My numbers seem to be pretty close to your findings for the SCT013-000. I think invalid is a harsh word. They may be off a bit, but given the alternative of begging for answers on this forum, people might be inclined to just go American. After all, there is Brexit.

So this is an attempt to associate an easy to use table of CTs to easily deploy the device. See the configuration utility in my last post.

1 Like

I can provide a little data there, although from memory since I’m away from base. I calibrate my energy monitor at 50Hz and 60Hz and then choose the appropriate calibration coefficients at run time based on the observed line frequency. With the 333mV 20A CTs I use, I vaguely recall at 50Hz the phase error was a little over 2 degrees over most of the current range, and a little under 1 degree at 60Hz. In both cases, anything under 1A and the phase errors get much larger, as you found.

Thanks for that information. I’ve been considering going with 333mv input for some time now. The 3.2V (or 5V) reference I’ve been using is just an artifact of starting out with the Arduino ADCs.

I’m really impressed by what Bob has done here and his approach to the detail while removing the complexity of the whole thing.

I’ve been looking at the .pcb file with the ExpressPCB customised PCB Layout Software. I’ve never designed a PCB but the board labels seem to be rotated all over the place and the layout needs to be rotated to align with the photos in this post. I’d also like to see a photo of the reverse side of the board.

The .sch file generates the following component list for the board:

IoTaWatt 14 Channel Energy Monitor
Bob Lemaire Rev 2.1 21 Oct 2016

Item Count Notes
1 14 470k
2 14 (opt)
3 2 10K
4 18 10uF
5 4 1K
6 1 1K8
7 1 3K3
8 28 4.7K
9 2 4K7
10 1 ADR5041 Digikey ADR5041BKSZ
11 1 Connector 2x8
12 1 ESP8266 NodeMCU
13 1 MCP23S17 Digikey MCP23S17T-E/SOCT-ND
14 2 MCP3008 Digikey MCP3008T-I/SL
15 1 MIC5232-3.3 Digikey 576-2774-1-ND
16 1 MicroSD 114-00841-68-1-ND
17 14 Stereo Jack (3.5mm)

I note that there seems to be 2 x 2x15 connectors missing for the NodeMCU, the k was missing off the 470k resistor and I’m not sure what the opt resistor specification is.

Additionally

  • 1 9V AC-AC plug pack
  • up to 14 suitable CTs for the circuits to be monitored.
  • Suitable enclosure box
  • Tools

What changes to implement at 240V for Australia?

The only change required for Australia should be the transformer and voltage multiplier in code to get you to 240V rms. I will be relaying out the PCB in Eagle soon, unless someone lese beats me to it.

The calibration factor is either specified in the configuration app on your phone or tablet, or, in my latest version, using an AC calibration cord that also measures the phase shift of your transformer. The next version will also support 12, 16 and 24 volt VTs in addition to the conventional 9V, which are getting hard to find.

I believe that is the only change needed. It has been stated that the phase calibrations for the CTs are “invalid” in 50Hz countries. I have no way to test that out. In any event, you can specify different phase shift through the configuration app as well. More on the whole phase shift issue in January.