DIY Real time mains power meter

From DIYWiki
Revision as of 14:46, 25 November 2022 by John Rumm (talk | contribs) (WIP)
Jump to navigation Jump to search

If you have rather fancied the nifty "in house" real time power use monitors that come with some "smart" meters, but don't fancy the rest of the smart meter, this simple project will get you some of the same functionality.

Rough and ready

A basic clamp meter that can measure the current passing through a wire that is passing through the jaws of the meter. (the probes are not required for AC current measurements using the clamp).

A quick "rough and ready" estimate of your power use can be obtained with a digital "clamp" meter. This will make a "non contact" reading of the current passing through a wire. So if you clamp it round of the "tails" that connect your electricity meter to your Consumer Unit (CU), you will get a reading of the current flowing at that moment. Multiple that number by your mains voltage (typically 240V), and you will have a an indication of the total power in watts being used.

Now this may be all you need, however there are a couple of sources of inaccuracy in this approach. To assess the actual power being used, you need to know the actual voltage as well as the current, so ideally we need to measure this rather than just assume it is 240V since not only will each property likely vary a little from the "normal" voltage anyway, it will fluctuate throughout the day as the load on the supply changes.

The second source of error is that the multiple of volts and amps when dealing with AC rather than DC, does not actually get you Watts, but "Volt Amps" or "VA". The VA reading is the total "apparent power" being used. This may be different from the real power being actually consumed because some part of the electrical load may be "reactive" - i.e. it stores some energy on part of the mains cycle, but then releases it later. This means not all of the current you can measure amounts to energy you need to pay for. See the article on power factor for a fuller explanation of this.

Depending on what you need to know, this may or may not matter. For knowing what size cables are required for a given load or what size UPS is required to keep your computer running during a power cut, the VA is the more useful number, since you need to know how many amps you need to allow for. For working out your energy use or costs, you will need the real power consumption in Watts and not the VA, since domestic electricity meters only charge for the real power consumed.

Design

This project was a simple "proof of concept" to see how well the monitor would work. (It may be followed by a multi channel mains power consumption meter with data logging, but that is for later!). So we need a way to measure the real time mains voltage, and the real time current consumption. This needs to be done in a safe and easy way that does not require wiring into the electrical system.

Using a 9V or 12V AC/AC mains power adaptor (basically a small transformer, in a box with a plug on it, and if we are lucky a thermal fuse), allows gives a low voltage supply that we can measure the voltage of. Power supplies with an AC output are less common than the typical DC ones, but were commonly used with many "dial up" modems, so there is a fair chance there is one stuffed in a drawer somewhere. We need a clip on current transformer to act as our clamp meter, and let us measure the current in the meter tail feeding the CU. Lastly we need a small amount of computing power to collect the voltage and current readings, do some number crunching, and send out the information we need to a local display. For this I used a Aruino "nano" clone, and a 16x2 line LCD display with back light.

Circuit and theory of operation

Circuit diagram for the basic energy monitor

Reading the mains voltage

The AC adaptor will give us a low voltage supply that we can measure. To do this we need to first capture the output from it with an Analogue to Digital Converter (ADC). The ADC channels on the Arduino can measure any analogue voltage between 0V and the supply voltage (typically 5V), and digitize with 10 bits of resolution.

So we can't use the output from the adaptor directly, because the peak voltage will exceed the maximum the ADC can read, and there is also a negative component of the waveform which will be below the minimum level for the ADC. So we need to do some conditioning first. There are two parts to this. Compressing the voltage to a smaller range, and adding a constant DC bias to it so that we never see a negative going component to it.

First we need to scale down the voltage range. A 9V AC transformer will give 9V RMS when under some load. Without any load the voltage will tend to rise a bit. So to be on the safe side we shall assume it could be 20% more than the nominal 9V. We also need to allow for the mains voltage to be higher than the nominal 240V. The upper limit is normally taken as 230V + 10%. Lastly the specified voltage is the RMS (DC equivalent) voltage, we need to know the full range of values that our ADC will see. This will be the "peak to peak" voltage. So to find the max output due to a high mains input:

Allow for 20% voltage rise on unloaded transformer:

Now convert that to its peak value:

Then just to be on the safe side we should assume that the Arduino may be running at the lower end of its typical supply voltage of 4.8V, restricting the total range of the ADC a bit. So R6 and R7 act as a potential divider that will scale the voltage so that the peak voltage is:

C2 will create an AC path to the Arduino's ground reference. R4 and R5 form a second potential divider, that will add a bias of half the Arduino's supply voltage to the ground referenced side of the transformer's output. So the ADC should see a voltage waveform that can swing between