Wednesday, April 24, 2013

Moteino Kill-A-Watt: Hardware

Midway through my JeeNode Kill-A-Watt project, I came across the Moteino, and boy, I wish I'd found it sooner.  It's small, complete with RFM12B (or without if you prefer) and even has a two more Analog inputs than the Arduino Uno.  Here's a size comparison:

The Moteino on the left has the RFM12B on the back side; the JeeNode in the center has the radio to left of the Atmel micro; the Arduino Uno on the right has a custom custom proto-shield, with RFM12B.  

While the JeeNode just barely fits inside the KAW, the Moteino has room to spare:

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:

  • Uses a Moteino, with built-in RFM12B
  • Measures 50 samples during one AC line cycle
  • Computes calibrated Volts, Amps, Watts
  • Transmits those values once per second

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

U3, the LM2902 quad op-amp, is on the bottom of the KAW 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 Moteino analog inputs.  The 4.7K and 10K resistors are mounted on the Moteino.  The bus wire across the top of the Moteino is connected to the two ground pads.

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

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

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 Moteino.  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 Moteino's onboard 3.3V regulator handles that ripple, no problem.
Q101 (2N3906) is there to quickly discharge C100 when the KAW is unplugged, to ensure a full reset on the Moteino.  While characterizing the circuit, I discovered I had to 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 Moteino 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 Moteino Vin.

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 Moteino D5 to ground.  It flashes on briefly, right after the radio transmission, about once per second.

So that's it.  If you're thinking about an Arduino compatible Kill-A-Watt hack, a.k.a. Tweet-A-Watt, I highly recommend the Moteino.  In my next post, I'll present the sketch, explain the math and calibration process.