Tuesday, April 16, 2013

JeeNode Kill-A-Watt: Hardware

In a prior post, I analyzed the Kill-A-Watt circuit, using a great schematic, by Kevin Timmerman. Armed with that knowledge, I created an accurate, true RMS, power factor corrected, watt meter.  Here's the gist of my design:

  • Use a JeeNode with RFM12B
  • Measure 50 samples during one AC line cycle
  • Compute calibrated Volts, Amps, Watts
  • Transmit those once per second
  • The receiver can calculate VA if desired

I chose the JeeNode because it fits (barely) into the KAW and has the RFM12B radio, and because for $22 (kit), it's a pretty good dealThe JeeNode is Arduino software compatible, but the IO lines are arranged as 4 "ports," each with one digital IO, one analog input, a common IRQ line, power and ground. There's a family of JeeLabs Plugs, arguably similar to the GROVE System, but they plug right into the JeeNode; no shield or cables required.

In my sketch, I used the Arduino standard pin numbers:

The JeeNode operates at 3.3V, so the KAW signals need to be attenuated, using simple resistor voltage dividersHere's the interface between KAW and JeeNode:

U3, the LM2902 quad op-amp, is on the bottom of the display board. I added three wires:

I used 30 AWG wire-wrap wire, and hot-glue to secure them. Pin 14 (white wire) is the voltage signal, pin 1 (yellow wire) is the high current range signal and pin 8 (blue wire) is the low current range signal.

Those three wires go to the JeeNode analog inputs. The 4.7K and 10K resistors are mounted on the JeeNode.

Q3 is near the center of the picture, folded over. A red wire-wrap wire is soldered to the collector. This is the 60 Hz square wave, connected via series 1K resistor to the JeeNode interrupt input.

Notice the 600V black electrical tape wrapped around the end of the JeeNode board. That's because it goes under the high voltage AC board:

The JeeNode is held in place with some heavy duty 3M mounting tape, on top of the piezo transducer:

Two transistors, Q2 and Q3 are folded over to make room for the JeeNode.

The power supply design was not trivial. The KAW has two regulated voltage supplies: +5V and +6.1V. Neither one has much current to spare, and any load greater than about 10 mA will prevent the KAW from powering up properly: the display will just flicker with all segments on.

So I went back to the unregulated +13.9V supply, and added a new dedicated supply for the JeeNode. I took advantage of D1, a 6.8V zener already in the KAW, and added Q100 (2N3904) to charge C100, 1000 uFd, providing plenty of reserve power for the once per second RF transmission. The average voltage is about 5.5 V, with about 0.5 volts ripple, at about 1 Hz. The JeeNode's onboard 3.3V regulator handles that ripple, no problem.

Q101 (2N3906) is there to quickly discharge C100 when the KAW is unplugged. Otherwise, after a quick power off-on cycle, the JeeNode's onboard regulator had a tendency to stall at about 2 volts, drawing too much current to allow C100 to charge. While troubleshooting, I discovered I could either power down for about 10 seconds to allow C100 to discharge, or short it myself with a wire jumper. Q101 simply automates that process. When the KAW is unplugged, C11 discharges quickly, bringing the base of Q101 close to ground, rapidly discharging C100.  R102 and R103 limit the charge and discharge current.

Although this extra power supply circuitry complicates the build somewhat, I think it's well worth it to have a robust circuit. Other hackers have reported problems getting their circuits to work reliably, and I felt their pain, so to speak. Here's how I built it up, with the charging circuit, Q100, on the left, and the discharge circuit, Q101 on the right:

First, I hot-glued C100 (1000 uFd) to the display board. C100 negative is connected to KAW neutral, the PCB wire jumper just below the green wire, which goes to JeeNode ground. R101 (100K) connects between Q101 base and collector. The right end of R101 connects to C100 negative. A red wire-wrap wire connects Q101 base to R100 (47K), over on the left. R103 (220) connects C100 positive to Q101 emitter and R102 (220). The red wire connects C100 positive to JeeNode power input.

Q100 is on the left, just above the 6 conductor ribbon cable. Q100 is piggy backed on Q1, with their collectors and bases connected together. The emitter of Q101 rises up and connects to R102 (220). The lower end of R100 (47K) connects to Q1 collector.

And finally, there's an activity LED, with 220 ohm series resistor, from JeeNode Port 2 DIO (Arduino D5) to ground. It flashes on briefly, right after the radio transmission, about once per second.

So that's it. In my next post, I'll present the sketch, explain the math and calibration process.