Saturday, March 23, 2013

Kill-A-Watt Circuit Analysis

The Kill-A-Watt P4400 has been hacked many times, and there are a few schematics online. I'll use this one from Kevin Timmerman because I think it's the best of the lot, and it matches up perfectly with my KAW.  Note, there have been various versions of the KAW, so be sure to double check how this info compares to your own KAW.  My version is fairly recent.  My serial number is YCJ12965, if that helps.

Well, let's see how this thing works.  There are two circuit boards in the KAW.  The high voltage board has the AC plug and socket:

J1 is a 6 wire ribbon cable that connects to the display board.  Caution, ground is not connected to the KAW circuitry.  J1 pin 2 is connected to Neutral, which should be the lowest voltage in the KAW.  I say should be, because the KAW could be plugged into a miswired outlet, with Hot and Neutral swapped.  So "Neutral" could be 120Vac-rms, which is 340Vpp!

And even AC Neutral is not the same as earth ground, and is potentially dangerous.  Be safe, and never connect anything inside the KAW to the outside world.  If you decide to hack the KAW, decide right up front to use some kind of radio signal to transmit the data.

F1 is a 0.2A fuse between AC Hot and the rest of the KAW.  Note that J1 pin 1 connects AC Hot directly to the display board, via J1 pin 1.  The KAW measures the AC line voltage across J1 pins 1 and 2.

C1, R1, D2, D1 provide a half-wave rectified voltage of about 13.5Vdc to J1 pin 4.  This is the unregulated DC supply for the display board, and J1 pin 3 is the return path.

R2 is the load current shunt resistor, 0.0021 ohms.  It looks like a piece of coat-hanger wire, about an inch long.  The load current creates a voltage drop, that the KAW measures across J1 pins 5 and 6.  For the max rated load, 15A, the voltage drop is 15A * 0.0021 ohms = 0.0315Vac-rms. 

The display board is a mix of analog and digital, but for hacking, we're only interested in the analog circuits.


J1 is the 6 wire ribbon cable from the high voltage board.

J1 pin 3 is the DC power supply return path.  I'll call it "ground" for the display board, but in quotes as a reminder that it's floating and not safe to touch, or connect to any external circuitry, including a grounded scope probe! 

On the schematic there are three "ground" rails: one rail below Q2 and Q3; one rail below Q1 and going across to U1 pin 24; and one rail at the very bottom, for the push button switches and U4.

J1 pin 4 is the unregulated DC supply, about 13.5Vdc, with C11 to filter the ripple.  U5 is the familiar 78L05, three terminal voltage regulator, with 5Vdc, 100mA max output.  D1 is a 1N5235B, 6.8V zener, and Q1 is the ubiquitous 2N3904, wired as an emitter follower, providing about 6.1Vdc power for U3, an LM2902 quad opamp.

Both the 5V and 6.1V supplies are designed to support the KAW circuitry.  Neither has more than a few mA to spare, without compromising the KAW's own performance and accuracy.  So if you want to add a microcontroller and radio, plan on going back to the 13.5V unregulated supply and building out from there.  One easy way to do this is to "piggyback" another 2N3904 onto Q1.  Connect the new transistor base and collector to Q1's base and collector.  Use the new transistor's emitter as your own 6.1V supply.  Don't forget to add a bypass cap, and maybe a ferrite bead for high frequency isolation.

R27 and R12 form a voltage divider providing a reference voltage at about 2.33V.  U3B is a unity gain voltage follower, providing a buffered reference voltage on pin 7 for the remaining opamps.  This provides a DC offset to keep the signals in the 0 to 5 volt analog input range of the microcontroller U1.

U3D senses the 120Vac-rms, 340Vpp AC line voltage across J1 pins 1 and 2, and attenuates it by a factor of 100.  So U3D pin 14 is about 3.4Vpp, riding on a DC offset of 2.33V.

U3A amplifies the current shunt voltage across J1 pins 5 and 6, with a gain of 40.  At the max load current of 15A, the current shunt voltage is about 0.0315Vac rms or 0.089Vpp.  40x gain makes the output on pin 1 about 3.56Vpp, on a 2.33V offset.

When the load current is less than about 1A, the output on U3A pin 1 is too small for accurate measurements.  So U3C provides another 10x gain stage.  For a load current of 1A-rms,  the current shunt voltage is 1A * 0.0021 ohms = 0.0021Vac-rms, or about .00594Vpp.  The net gain of the two stages is 400, so U3C pin 8 will be about 2.38Vpp, on a 2.33V offset. 

So for best accuracy in measuring load current, digitize both U3A pin 1 and U3C pin 8, and use whichever one is appropriate based on the load current.  For load current greater than 2A, use pin 1.  For load current less than 1A, use pin 8.  Between 1A and 2A you can use either and they should agree fairly closely, assuming you have good calibration factors.

Recall that J1 pin 1 is AC Hot, 120VAC rms.  D2, Q2 and Q3 convert that to a 5 V logic level square wave, used by the KAW to measure the AC line frequency, nominally 60 Hz. 

Note that Arduino clock frequency is not very accurate, so you might want to use this signal, on Q3's collector, to accurately measure across an integer number of AC line cycles, to ensure a "true rms" reading.

So that's it, I hope it's useful.  Feel free to leave comments or questions.