IotaWatt 4.0

Now that you mention it…I hadn’t noticed it yet that they were redundant (i hadn’t looked at the schematic since i changed it to trough-hole). That’s a nice backup-plan if it should’n arrive soon! (only problem is that it wider and a bit longer…so it’s sticking out about 5mm)

What I did to test the RC circuit on the old board was to remove the .1uf decoupling cap on the RTC and solder the 10uf cap and 1K resistor “tombstone” style to the two pads. Then I lifted the Vcc pin of the RTC and connected that to the tops of those two components. That way, there was no need to cut any traces, which never turns out like you want it to. I realize you are thru-hole, but the technique should work on that too.

The changes for the extra resistor next to the RTC is quite easy, i had something in mind you described :wink:
The changes for the introduction of the ACBIAS is more difficult since the trace with BIAS runs from the LM358 through my VT connections to the CT3-8 :thinking: . So i have to cut the portion between the VT’s and reconnect the CT line to the LM358.
Would this mean a great improvement?

Has nothing to do with accuracy. The issue is that the common bias can get pulled low when a CT is connected or disconnected, causing an interruption in the normal rhythm of the software and transient weirdness. It’s not much of a problem with the CT channels, but the basic heartbeat of the main loop is driven by the AC cycle. So since I had an extra unused channel on the LM358 dual op-amp anyway… I elected to dedicate it to the AC channel and insulate it from the CTs. In your case, with two additional VTs, you may elect to bias all three voltage channels separately, or none at all. As long as there is no plugging and unplugging while the device is running, there is no difference.

13 posts were merged into an existing topic: Homebrew IoTaWatt issues

3 posts were split to a new topic: Homebrew IoTaWatt issues

Hi Bob,

I have been recently looking for a power monitoring solution for my house after installing solar and came across IoTaWatt and I have to say this is by far the best solution I have seen. The work you have done on this is impressive, making it much more than most hacked solutions I have seen.

My use case is a little different than what IoTaWatt provides, and so I have been trying to understand the hardware so I can consider making my own board with some changes.

Do you mind if I ask a few questions about its design as I am trying to understand it as best I can but am a software engineer by trade and so a little slow with the hardware side of things?

I am basing these questions on the 4.3 schematic from github (revision c0bb95f096adf0cbdddb9c2e1ff9c784bcd33448).

The questions I have are:

  1. Why is the fixed voltage shunt/reference required (Attached to C0 of MCP3208-0)
    Also, the schematic labels it as 2V5 but from reading the spec of ADR510 I thought this should be 1V

  2. Did you try using the AC vref in as a power source for the circuit as well as sampling it?
    I was considering rectifying and regulating this AC source to power everything in addition to sampling its voltage, but not sure what impact this will have on the quality of the AC voltage reference and wonder if you have measured/quantified what impact this might have?
    The idea of needing two power sources is a slight deterrent for me

  3. Why is the RTC required?

  4. Why is the separate ACBIAS and CT BIAS required?

  5. Why are the LED’s connected to GPIO16 and GPI0 (ADCCS1)?
    I don’t understand this logic (compared to just GPIO16 + GND, assuming GPIO supports current to drive 2x LEDs) unless is is something ESP8266 specific or some trick I don’t know about.

Ultimately the change I would like to make for my usage is to be able to use the same board to monitor pulse sensing for LED pulses from smart meters, and reed switch pulses from gas and water mains and I don’t require quite so many CT sensors :slight_smile:

I figured I could still make use of the ADC for this job and just change how I provide the voltage ref for the ADC (an ADC is a little overkill for pulse monitoring but should work).

I was thinking of using a simple jumper on the board to configure the type of input sensor attached (unless I find a better solution). This would convert a given ADC input channel from measuring a CT sensor to measuring light using a phototransistor or output of a reed switch. I would then just rig up a 3.5mm plug to my appropriate sensor.

There are a few other changes I would consider as well but not as important to me (depending on what smart meter gets installed by my grid provider):

  • Look into using the single AC vref as a power supply
  • Expose one GPIO + SPI lines for a potential SPI colour sensor (not sure if this will work)
    Some meters use green/red LED to show import/export instead of two separate red LEDs
    Looking at the design it seems like you are out of GPIOs so would need to sacrifice something or add more complexity to do this. I really DONT want to do this if possible

I just want to say, thanks again for the amazing work you have done on this!

Hi Brendon, believe it or not I’m a software engineer as well. When I used to work for a computer manufacturer, I had a department full of hardware engineers that built everything for me. Now I had to come up to speed and do it myself. It’s not as hard as it looks, kinda like legos, just plug them together. What’s harder is manufacturing and regulatory compliance. Fortunately Glyn Hudson is very good at it.

I’ll try to answer some of your questions.

So you don’t have to calibrate things. It’s very accurate. With the shunt, the ADCs are calibrated so we know the supply voltage, the bias voltage, and can measure the CT output very accurately.

That’s a mistake. I use a 2.5V shunt, but someone else built their own and used the ADR510. You can specify the reference voltage in the config file, so he did that and it’s working fine with the 1V shunt. No impact on accuracy. I think the 2.5V cost less though.

There are electrical issues with trying to do that. It has to do with the the ground and being able create a DC bias for the reference voltage into the ADC. The Emon product that uses the AC for power has a half-wave bridge. That won’t provide enough power for the radio. Anyway, for the cost of building (or buy) a decent 9V AC to 5VDC power supply on board, you can get a good 5V wall pack. The more you move off to commodity the better off you are.

The thing is basically a datalogger. It stores data at regular intervals with a timestamp. It needs to know what time it is. The time is available from NTP severs, and IotaWatt sets the RTC from there and corrects the RTC periodically, but it needs to be able to run without WiFi.

Long story. Basically they are not required. There can be issues with noise on the CT bias line and since the LM358 is a dual op-amp, I elected to fire up the other one and dedicate it to the AC reference.

As you point out later, I’m out of pins. The LED is a bicolor LED and unlike some that have two inputs and a ground, this one works by being red with forward current and green with reverse current. So High/Low and Low/High. Ground won’t do it.

That’s a different thing. You could use the ADCs, but it would require some changes in the software to sample each of those channels once between each current sample cycle. So you could check them 30 or so times per second in a 60Hz world, and 20 or so in a 50Hz world.

In an early version of IotaWatt, I had an SPI 16 channel GPIO chip. It not only would do this job, but can be setup to capture state changes and interrupt. To add something like that, you would need a pin. It’s possible to get another pin by switching to an SPI RTC. It’s doable, but not in the short term.

offhand I think you could probably do it with ADCs as is. on/off definitely. Measuring light intensity (as opposed to light/dark) I would think you need an ADC somewhere anyway.

The GPIO is a problem, but the SPI can support plenty of slaves.

I’ve had great success measuring usage/import/export of PV systems. Accuracy has been less than +/- 1% of the reported generation of Solar Edge inverters and requires only one CT on the inverter output. Depending on your power system you need one or two more CTs on the panel mains - voila. The sum of the 7 days reported bythe inverter is exactly the same - 293.1.


This house is also measuring their HeatPump, AirHandler with Electric Backup, HotTub (I know), HeatPump Water Heater, Refrigerator, an dthere are still three CT inputs unused.

About the gpio’s: i read that you could use gpio10, but only as an input. (gpio9 is unusable)
Maybe you could also use the ADC0 pin?

For an SPI CS pin it has to be dedicated output. My understanding is that GPIO 9 & 10 are also data pins for the flash memory, which is active all the time. I tried to use 10 awhile ago and ran into trouble. Don’t know if there’s a GPIO capability for the ADC pin.

I had worked out a scheme to be able to address an unlimited number of SPI devices virtually using the SPI GPIO expansion chip and some binary decoders. Basically you use one GPIO to CS the expansion chip, and using outputs from that (16 pin) chip, set the state of the decoder to direct two other ESP pins to specific SPI slaves. It’s just a handful of chips and would allow the high speed chip select needed for IotaWatt sample rates of more than 14 channels.

I stopped thinking about it back when things were moving more toward the ESP32. I might possibly build a prototype board with the hardware to do it as a proof of concept. It’s less than half a dozen relatively inexpensive chips and I think there’s room.

Thanks for the very quick and detailed response!

I agree in general with this, my reasoning wasn’t about price but that I have a single power socket in the meter box and don’t really want to use adapters and multiple supplies. More about the look of the final product than the price. Plus it is fun to try and do some part of this project myself :slight_smile:

Do you know of any resources describing these “electrical issues” a bit more?

I am trying to understand it, looking around and haven’t found anything that would describe what the problem is yet. The only thing I am thinking is there may be some kind of “feedback” created with the BIAS and the AC input through the voltage regulator+rectifier, though a friend of mine that does a bit of electronic work suggested it should be possible.

Yeah that is the plan, I don’t need intensity just on/off. I haven’t looked at the code yet, but I think I should be fine with making changes to it to handle this.

Just realized I should probably use I2C instead of SPI, you already have a I2C bus in the design, it is probably perfect for this.

This looks amazing! I still want to try the pulse counting for gas usage (right next to electrical meter box too) and might as well do the light pulse counting anyway.

I think my next step is to order the parts and get a breadboard going.

Thanks again. I really appreciate what you have done on this.

The problem that I see is that the AC reference voltage is +/- with respect to the ground of any DC power supply that you would create from that same AC voltage. so I don’t know of any way to add the AC and DC to get a the biased undulating DC input needed for the ADC. Don’t you have power strips there?

If your friend has a solution, please share.

The real limit to the current you can draw is the effective impedance of the transformer, because it’s the component that distorts the voltage waveform.

There’s not a lot of iron in those transformers and the wave shape will be distorted because of that too.

Even a transformer with two secondary windings doesn’t help much - the variable loading of the DC supply portion affects the magnitude and shape of the voltage waveform, effectively putting a “dent” in it.

OK folks, this is a thread about IotaWatt. There’s another thread called Homebrew Iotawatt issues for those intrepid hobbyists that want to build their own IotaWatt hardware. I’m happy to answer any technical questions as best I can there, and good luck to all. Most of the questions are reruns of issues that I have worked and experimented with. I believe IotaWatt represents the most practical solutions to most of them.

IotaWatt 4.0 is a tested production unit that is being manufactured and will be available soon. It does not use the AC supply for reference, primarily for the reason stated above in my last post.

By way of update on the production effort for IotaWatt:

  1. Prototype units are waiting CE testing.
  2. An initial run of devices is in manufacturing, due out in a few weeks.
  3. Firmware in the pipe and working prototype includes a new secure protocol for posting data to Emoncms and an OTA update system with digitally signed firmware and app updates.
  4. Have several ongoing efforts in place to develop proof of concept installations for three phase capability.
3 Likes

Hi, I’m new here, I think it’s an impressive project, I’ve been looking for something like this for several months.

Could you tell me where to buy? how to build

thank you very much

Sorry for he delay. I had asked the OEM folks to respond to this, but they have not. At this point, I have very little in the way of information about their plans to resell IotaWatt. I am looking into alternatives and will probably have some boxes available in a month or so. I’ll PM you when I have more information.

thank you very much, please, when you know something, tell me

Hi Bob, I’ve been following your development of IotaWatt and would like to set one up at my location in New York when they become available. Let me know when they are ready and how much you need for one.
Thanks much,

OK, should be within next couple weeks. What’s your application?