DIY mains power consumption meter

Nov 25, 2022 Last reply: 3 years ago 36 Replies

Since it was mentioned in another thread, and I had the spare parts to hand, I built one. The project is here:



formatting link


Edited to add comment that the single-insulated wires at the current transformer need to be within an enclosure!

Owain

Yup good call - the particular one I used would be ok (i.e. double insulated wire, and internal voltage limiting device) but that will probably not apply to many.

Thanks John, I have been musing about building something like this; your work may well be the spur (arf...) I need.

Regards, J^n

PS: typo on the web page, first reference to "Aruino "nano" clone'

What did you use for the 5V supply, BTW?

Nothing to do with this power monitor but for a 5V supply I've previously bought a mains to 5V USB converter and removed the small PCB from the plug and un-soldered the USB connector.

Example - 1 port version of

formatting link

Sorry I forgot to mention that in the write up. I have added something now.

It was just a bog standard left over phone charger type PSU with a type A socket on it, and then a USB type A to Mini USB plug to match what was on the end of that Arduino.

(I tend to buy them with micro USB sockets on them these days, since I have way more of those leads!)

Thanks very much - been on my TTD list for a while. OOI where do you get the Arduino clone?

Right, thanks. I was thinking it might be better with battery power, is all. or ... you could power it of the 'voltage detector' input... I had to read the page a bit carefully to se that was what was going on.

I like USB-C much more than micro USB - I don't know if you can get the Arduino's with that fitted.

Thanks for a nice little project idea...

This will over-read by a large amount on many devices in standby because they present highly reactive loads. So it will suggest that you can save money by turning the TV off rather than leave it in standby when in fact, if its a modern TV the max standby power is less than 0.5W (EU law and all our TVs are still CE marked so conform) so < 4.3Kw hours per year so around 12p/month even at present rates.

Get a smart meter that correctly compensates for the power factor.

Dave

If you use a washing machine or dryer more than most, then certainly. But a TV in standby mode (or anything else in standby mode) presenting a highly-reactive load? I don't get that.

Easy enough to do, the nano has a Vin pin that you can feed from a fairly wide voltage range, and it has an onboard regulator.

I have not measured the current draw, nor have I optimised it for low power use. The obvious ones would be things like optimising voltage divider resistors to be higher values for less ongoing current. Blanking the display backlight, and adding a "wake up" button on it, then making the scheduling a bit more clever to enter a proper low power state when waiting etc. You could probably go for a lower power cpu as well.

Something else to keep in mind is that the thing boots to working in a second or two. So it is easy enough to only turn it on when you want to look at it.

You can, but you have to take some care to properly buffer the supply you derive from that, or else it is quite easy to end up with a bunch of unexpected side effects, that will mess up your ability to capture the voltage waveform correctly.

You can - at least in the clones - I have not checked on real Arduinos. Most vendors on Aliexpress etc will offer them with a choice of connectors. (and a choice of colours, and actual Atmel AVR chip used etc)

That particular one was bought long ago from CPC if memory serves.

However I normally order them from places like AliExpress these days since I can get half a dozen at under £2.50 a pop... If you order £15 worth you can normally get 15 day shipping for a under a fiver.

How does it cope with dirty mains? eg if you had a few really dirty lamp dimmers or an arc welder on the same phase

<panto-mode>

Oh no it won't

</panto-mode>

It won't suggest anything of the sort... several things to consider:

It has no knowledge of what is being powered - it just tells you numbers, and leaves any interpretation to you.

It using a 10 bit ADC to capture the output from a CT spanning a 100A input range - you will not get low mA resolution out of it in that configuration since the best it can see is units of 100mA per ADC count. So at best it will only be accurate to 10W on aggregate loads.

Now for my use cases (things like assessing total load, working out what spare capacity is available if running from a generator, or working out what size UPS to specify for a particular IT setup), this is fine.

If you want more accuracy and detail - say for assessing the load of an individual appliance, then it can be done, but something configured for a 100A input range is not the place to start. The design could be adapted for 10A input range relatively easily for example.

If I wanted super fine accuracy, then I would put in a bit more effort with things like a more accurate voltage reference, a higher bit count external ADC. I expect one could also to some extent make the device "auto ranging", with software switching of burden and offset resistors to target only a part of the CT input range more closely.

Ultimately, if you care about measuring very low power draw (say when optimising a design of ultra low power kit designed to run from batteries), then there are far better and more appropriate techniques available.

The Daily Express comments section is that way ------->

(or put it another way - you are preaching to the wrong choir!)

Might I suggest you have a look through the code in EmonLib.cpp?

In particular, read through the member function calcVI in the EnergyMonitor class.

TL;DR it digitizes both voltage and current waveforms in real time, and then sums the instantaneous sample readings. It collects data for the specified number of zero crossings, and then does its sums. It will not be fooled by conventional phase shifted reactive loads, or peaky SMPSU style loads with high harmonic content. (from my experiments, it will probably get about 100 samples per mains cycle).

TBH the hardware here is good, but the software is rather pants.

To do a proper job you ant in interrupt service running at at least 10 times main,m preferaby20, and you should be taking the instantaneous voltage and multiply that by an instantaneous voltage and put that in an accumulator, and after say 5 seconds divide that by the time and output the true power.

You can also average RMS volts and current likewise, to display VA and perform a simple calc and do power factor,

All provided you have an A to D converter that runs at 1khz or better.

Short duration spikes probably wont show up, but arc welder voltage drops would. If you want to see mains quality, buy a scope...:-)

It will make a reasonable stab at it since the method used (sampling current and voltage waveforms in real time, so it doing multiple instantaneous measurements per cycle), will give a better result than simply multiplying the average magnitude of volts and amps, assuming they are both perfectly sinusoidal.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required