Kicad is used to create the schematic and layout.
The Power PCB monitors the voltage and current of a (North American's) home energy lines. It is the bottom PCB of three PCBs that when combined provide Watt readings and send them over wireless to an mqtt broker. The other PCBs include:
- The meter PCB. The meter PCB includes two atm90e26 energy monitor ICs that takes in the analog readings from the power PCB and converts them into DC measurements a microcontroller can read.
- The microcontroller PCB. The microcontroller PCB mounts a microcontroller with wifi - like a Feather RFM95 or a wemos D1 (a bit up in the air as of this date - 4/5/2019). The microcontroller gets the voltage and current readings from the atm90e26's over SPI and then sends them via mqtt.
The three connect together to become the FitHome hardware.
Thanks to Those That Went Before
This project extends Tisham Dhar's work on building energy monitors using an atm90e26. In particular, the DIN Rail energy monitor. Besides his open source projects, Tisham has been exceptionally helpful and supportive. Tisham continues to inspire me. THANK YOU.
Before I took Chris Gammell's Contextual Electronics course, I had absolutely no experience with electronics or building PCBs. Chris is exceptional in so many ways. THANK YOU.
There is an exceptional community behind the OpenEnergyMonitor project. They not only provide energy monitoring solutions, but are a wealth of knowledge. THANK YOU. In particular, thanks to the kindly delivered advice and help from Robert Wall. THANK YOU, THANK YOU.
Electricity Coming Into Our Homes
In our North American homes, 120V of electricity comes in through two power lines (L0 and L1). A third line (N) acts as the reference point (analog ground) for voltage/current measurements. Image from here
See the section in the schematic labelled Incoming 120V.
The MOVs(Metal Oxide Varistors - RV1, RV2, and RV3 on the schematic) clamp down on the voltage coming in when there are power surges. Most of the time, voltage in North American homes oscillates from 0 to a peak voltage of 169 volts. Sometimes this oscillation is disturbed by a spike in voltage caused by a lightning strike or switching in the power grid:
The Open Energy Monitor project has great info on the how and the what of voltage sampling. See the Voltage Sampling section of the schematic.
Four resistors are run in series to ensure if any one of the resistors breaks down, the full 120V won’t be sent to the rest of the circuit. Also, the resistors are rated to handle the incoming voltage (in my case 120V…but to be safe probably 240V rated resistors are a better thing to use).
Noted in the atm90e26's datasheet: The pins that are for voltage sampling (15 and 16): …are differential inputs for voltage. Input range is 120μVrms~600mVrms…
R1 = 220K * 4 = 880K R2 = 1K Vin = 120V Vout = 120(1/881)= 136mV.
The atm90e26's and the microcontrollers need 3.3V DC power to work. Since we have 120V coming in, we can transform it to provide the 3.3V DC power. See the 120VAC -> 5 and 3.3VDC section in the schematic. There are three pieces to the conversion:
- The 120VAC -> 5VDC SMPS.
- The two LDOs. The signal coming out of the SMPS is too noisy. The LDOs clean up the signal.
- The DC-DC isolator. This isolates the power for the atm90e26s from the power for the microcontroller.
See the Current Sampling section of the Kicad schematic.
- The diameter of the clamp opening - 13 mm
- The I(OUT) - 50 mA
As Robert Wall of the Open Energy Monitor project noted to me ...the manufacturer will tweak the number of secondary turns to give the best accuracy overall. The ratio of a c.t. is ALWAYS specified as a ratio of two currents, the rated primary current to the corresponding secondary current. So your SCT-013-000 is 100 A : 50 mA.
TRS 3.5 Jack
Also note the zener diode. This is great to have in the circuit to prevent deadly voltage when the CT is clamped to a live line but the jack is not plugged into the rest of the circuit containing the burden resistor.
Tea Kettle Example
PLEASE NOTE: Most people would advise against do this. The clamp exposes an open current source. Thanks to the zener diode, this is not as dangerous as it seems. That is assuming there really IS a zener diode and it is working...
To clarify the workings of this CT, I measured the current used by our tea kettle.
I plugged the kettle into my power cord extender that I made to separate out the live line of the power cord so that I could clamp on the CT. The black probe of the DMM is touching the sleeve of the CT's jack. The red probe is touching the tip. Setting the DMM to measure AC mA, I get a reading of 5.9mA.
V = 120V I = 5.9mA * 100A / 50mA = .0059*100/.05 = 11.8A P = IV = 11.8 * 120 = 1,416w
Ah! The power of the tea kettle! More like it takes alot of energy to boil water for tea.
Characteristics of the CT
The characteristics of a CT to be considered when sourcing include:
- The amount of Amp Service. From this article Understanding Your Home's Electrical Load Different homes need different amp services. A 60-amp service is probably inadequate for a modern home. A 100-amp service is good for a home of less than 3,000 square feet that does not have central air-conditioning or electric heat. A home larger than 2,000 square feet that has central air-conditioning or electric heat probably needs a 200-amp service. According to Bill Thompson of the Open Energy Monitor Project, US homes built before the late 60s were wired with Copper and typically had 100 Amp service, which used AWG 0 copper...Sometime in the late 60s to early 70s, Copper Service Entrance Wires were replaced by Aluminum. Since Aluminum has more resistance per foot than Copper, the equivalent Aluminum wire is two gauges larger than its Copper counterpart. About that same time, 200 Amp service became the norm.
- The wire gauge. The Outside Diameter of the wire gauge determines how large the diameter of the CT clamp must be. As Bill noted, wires could be copper or aluminum, or copper-clad aluminum. More aluminum, more current - the wider the diameter.
- Whether the burden resistor is included. This design assumes the CT does not include the burden resistor. I.e.: it's output is a current and not a voltage.
- The ratio of I(in) : I(out)
- The inclusion of a zener diode. This is a terrific safety measure to make sure when the CT is clamped on, there is on open current source.
The YHD SCT-013-000 can't be used on 200 Amp houses. The clamp diameter of at least 16.04 mm. And most likely it is better to have a different coil ratio for the secondary coils.
Taking a Current Reading
I first learned how the current reading circuit worked by reading this excellent article on the OpenEnergyMonitor's site. If you (like myself) are new to this stuff, it is worth a read.
The CT used in this design outputs current. A "burden resistor" is to convert into a Voltage that can be read by the microcontroller. To accomodate readings using the ADC of the Arduino as discussed in the project, a DC bias circuit of AREF/2 (2.5V) lifts ADC readings to be between 0 and AREF (5V).
The atm90e26 does not need a DC bias circuit.
Tisham's design uses a 12R burden resistor. This is to accomodate the atm90e26's 600mV Vrms input limit. The OpenEnergyMonitor's article noted the current output's Amplitude is .0707A. Vpp = 0.0707 x 12 = 848mV. The amplitude is then 424mV. The Vrms = 424*sqrt(2) = 600mV.
As Tisham noted: In recent designs I have been splitting the 12R into 6R-6R and grounding the middle for signal symmetry. This is why two 5.8R resistors are used. I ran an LTSpice with:
- a sine wave set at 60Hz with an amplitude of 0.0707A (from the OpenEnergyMonitor's Arduino article)
- .tran 0 .1 0 .1
Getting connectors right has always been difficult for me. The connectors used in the Power PCB include:
This is a plug in Terminal Block. It connects the 120V power lines to the power PCB.
The ones made by Phoenix Connect:
The male contact - PN 1759059 is soldered to the power PCB. The female contact - PN 1757051 plugs into the male contact and screws the wires into one of the 6 positions.
The prices for one of these connectors was WAY TOO HIGH. It appears there is a "clone" version that costs far less but is basically the same thing as the ones made by Phoenix Connect. From an Alibaba quote:
This is the 6 position male piece. The pins are at a right angle to the rest of the connection. I noticed some vendors used MX2EDGRC (i.e.: added a C to the end).
This is the female part that connects into the male part. It has the screw downs for the power lines (like those in a power cord). I noticed the quote used different part numbers:
These say they meet an Amp amount of 15A. I ended up ordering 10 for a female/male at about $1.60 each. Clearly this can come down significantly. Right now, in prototype, we're fine with the ones ordered on newegg.
OOPS! The male pieces are not at right angles. I need to be more careful and order by part number. TBD: Not ordering any more at this point. Query Alibaba.com for MX2EDGR.
U1 and U2
These are the female 3.5 TRS audio part (SJ-3523-SMT-TR). The male audio jack on the end of each current clamp is inserted.
The pin out for the 36 position female PCI Express connector that connects the meter PCB to the power PCB.