# How do I measure watts without a CT clamp?

I'm trying to build an "IoT" project for home that will in effect create a smartplug. I'd like to add the capability to measure the watt usage of the plug (and whatever's connected to it). I'd like to not use a CT clamp for this purpose, and I was hoping someone here can help.

I have a 220 V mains connection and I'd like to measure the watts used by a connected appliance to the smart plug is a small as possible form. CT sensors are too big for this purpose.

Thanks.

• You don't need a clamp if you are building the plug. What's wrong with a Current Transformer? Mouser sells a 1000:1 CT for less than 6\$ that you could put in-line with one of your plug's leads. Nov 7, 2016 at 17:55
• I've seen a lot of people connect an Arduino to an existing power-meter, like e.g. a Kill-A-Watt meter. Nov 7, 2016 at 18:23

You can't use a CT sensor to measure power. CT sensors measure current. Measuring Watts is the correct unit if you want to know the rate of energy consumption (power) from an outlet.

Response to a Comment: There are consumer devices that cost only \$12.95 that might be ideal, if the only usage scenario is to compare various devices for steady state power draw and you are fine with 3% (1.5 digit) accuracy. For the 220 VAC (whether split phase or single phase) you would need to gang two of them together appropriately. These plug-outlet designs are nicely miniature, but will not support checking past values, providing feedback to a control system, or Wattage plotting against date, time of day, or tay of week.

Measuring of Wattage accurately (to two or three significant digits) is not trivial if the 220 Volt source is an AC power grid, thus the length of this answer.

The basic EE formula for power is P=IV for DC, meaning power is the product of current and voltage. But you can't just go with Watts = 220 X current and expect any more than one significant digit of accuracy. Grid Voltage may not be a clean sine wave and may vary five or ten Volts under normal conditions.

If you want more than one digit of accuracy, you'll need to calculate RMS (root mean square) power in Watts by sampling both Voltage and current and using the AC principles that extend the simple P=IV relation. I don't know if you have knowledge of what electrical engineers call RMS. In case you don't, the articles in the result set of This Search [1] may be helpful.

Let's hypothetically say you are considering doing the work necessary to get the two or three significant digits of accuracy in determining power consumption. To get a sense of what that would entail, here's some information on doing that properly. You will want to consider line voltage fluctuation, reduce your noise levels, protect your Arduino board from over-voltage, and follow electrical code reasonably well.

The below measurement fixture design is not small, but it could be miniaturized. Unfortunately the design of a miniaturized version is large project FAR outside of the scope of an answer in this forum. You may be one of those that likes the challenge, so I'll share a design for a larger version and leave it to you or other answering parties to think of a miniaturization that meets all these other reasonable goals.

Off the shelf parts to fabricate a full sized power measurement fixture to interface with an embedded board like the Arduino Due, for example:

1. Two electrical boxes
2. A length of electrical conduit at least 50 cm long
3. Electrical hardware to connect the two boxes and secure the AC cord leading to the plog and to the devices being powered.
4. Two lengths of 2-conductor 18 AWG shielded twisted pair cable with at least 500V rating
5. Code compliant AC cabling
6. Wire nuts
7. Box for the buffering circuit
8. A good quality digital Voltmeter with RMS AC as one of the options

Fabricate this way, but using proper code-compliant electrical practices in addition to these basic instructions for the main circuits:

1. Connect the plug to one of the boxes with properly rated AC cord.
2. Connect the two boxes with the conduit and properly rated power and return wires (white and black).
3. Connect the second box to the device
4. In each box, connect the 2 conductors of the shielded twisted pair in parallel to the AC circuit passing through the box with the wire nuts. You must leave the shields of the two twisted pair lengths isolated (not connected to the box or the ground wire in the AC circuit.
5. Bring both twisted shielded pairs into the buffering circuit box.

The buffering circuit would condition each of the two AC voltage in three stages.

1. Surge protector
2. Resistor divider (see other Arduino articles for this)
3. Zener diode to further protect the A-to-D converter on the board

The Zener diode and the resistor divider would drop the voltage from 400 V down to below the max voltage of the Arduino board, which any of the voltages might be relative to the ground potential on the Arduino board under certain conditions. The Arduino Due might be a good choice, because of multiple built in true A-to-D channels and the higher accuracy (digits resolution) than most other Arduino options.

The output of the box for each of the FOUR voltages would be connected to FOUR analog inputs.

• Vph = the hot (black) coming from the plug
• Vpr = the return (white) coming from the plug
• Vlh = the hot (black) going to the load (devices to be powered)
• Vlr = the return (white) going to the load

In the software you would probably want to measure the above four voltages in immediate succession (no delay between the four analogRead calls) every millisecond for a second, which will capture 60 cycles of data in 1,000 samples, enough to get three significant digits of accuracy in your power measurement. The 60 samples of 4 channels can be thought of as 1,000 vectors of 5-dimensional data. The fifth dimension is the time offset in milliseconds.

The software goal would be to calibrate the conversion of the 4 by 1,000 element array of analogRead integers to a 2 by 1,000 element array of doubles that represent instantaneous Voltage and current. Then power in Watts can be calculated from the Voltage-current data set.

When dealing with the 1,000 sample vectors, your loops will start with "for (int index = 0; index < 1000; ++ index) { ...".

You will need to convert your digital values representing the Voltages coming from your resistor divider to physical units. These are the operations you would do on each sample.

1. V = Cv * (Vph - Vpr)
2. I = (Cih * (Vph - Vlh) - Cir * (Vlr - Vpr)) / R

V and I are the doubles that represent instantaneous Voltage and current respectively.

Cv, Cih, Cir, and R are also doubles. They are the calibration constants to convert the analogRead values to line voltages and currents. A typical way to calibrate their values is to measure the RMS voltages across the three node pairs represented by each subtracted voltage pair in the inner parentheses above and the current, using some constant load. A good load option would be some non-digital device that is fully warmed up and in some steady state.

From the voltages and currents and the digital values acquired from the four analog channels in the Arduino, with some algebra skill, one can determine the scaling factor C for each of the three cases, by dividing: (V1 - V2) / V, where V1 and V2 are the RMS values measured with the digital Voltmeter and V is the calculated RMS voltage from the samples.

R can be calculated by dividing the Voltage and current values V/I in accordance with the principles discussed in the articles referenced above.

Once you have calibrated your measurements for V and I in your block of 60 samples, the articles above give you some direction as to how to calculate your power in Watts RMS in a loop.

[1]: Search for "calculating rms watts from samples of voltage and current" via Google.