Arduino home energy monitor shield - Amazon Web ServicesArduino home energy monitor shield Although...

Post on 16-May-2020

9 views 1 download

Transcript of Arduino home energy monitor shield - Amazon Web ServicesArduino home energy monitor shield Although...

Arduino home energy monitor shieldAlthough products are becoming more and more available for monitoring your home power usage,I'm one of those idiots who can't leave well enough alone and who would rather shell out $100 and

hours of my time in order to save $20 and learn something in the

Written By: Feitan

Arduino home energy monitor shield

© 2017 www.botsbits.org Page 1 of 12

TOOLS:Pliers (1)

Soldering tools (1)

PARTS:30A split core clamp on current

transformer (1)Part Value Device Package (1)

B1 HD04-RECTIFIER HD04-RECTIFIERMINIDIP-4 (1)

C1 10u C-USC0805 C0805 (1)

C2 10u C-USC0805 C0805 (1)

C3 10u C-USC0805 C0805 (1)

C4 10u C-USC0805 C0805 (1)

C5 10u C-USC0805 C0805 (1)

C6 10u C-USC0805 C0805 (1)

C7 330u CPOL-USE3.5-8 E3,5-8 (1)

C9 2200u CPOL-USE5-13 E5-13 (1)

D1 SCHOTTKY-DIODE SOD123FL (1)

JP1 PINHD-1X2 1X02 (1)

JP2 PINHD-1X2 1X02 (1)

JP3 PINHD-1X25MM_TERMINAL5MM_TERMINAL (1)

JP4 PINHD-1X2 1X02 (1)

JP5 PINHD-1X2 1X02 (1)

L1 330u L-US6000-XXX-RC 6000-XXXX-RC (1)

R1 10k R-US_M0805 M0805 (1)

R2 10k R-US_M0805 M0805 (1)

R3 10k R-US_M0805 M0805 (1)

R4 10k R-US_M0805 M0805 (1)

R5 100 R-US_M0805 M0805 (1)

R6 10k R-US_M0805 M0805 (1)

R7 10k R-US_M0805 M0805 (1)

R8 100 R-US_M0805 M0805 (1)

R9 10k R-US_M0805 M0805 (1)

R10 10k R-US_M0805 M0805 (1)

R11 100 R-US_M0805 M0805 (1)

R12 10k R-US_M0805 M0805 (1)

R13 10k R-US_M0805 M0805 (1)

R14 100 R-US_M0805 M0805 (1)

Arduino home energy monitor shield

© 2017 www.botsbits.org Page 2 of 12

R14 100 R-US_M0805 M0805 (1)

R15 10k R-US_M0805 M0805 (1)

R16 10k R-US_M0805 M0805 (1)

R17 100 R-US_M0805 M0805 (1)

R18 10k R-US_M0805 M0805 (1)

R19 10k R-US_M0805 M0805 (1)

R20 100 R-US_M0805 M0805 (1)

R21 100 R-US_M0805 M0805 (1)

R22 100 R-US_M0805 M0805 (1)

TR1 EI30-1 EI30-1 (1)

U$2 LM2575 LM2575 TO263-5 (1)

U$3 AUDIO-JACKSMT SJ-3523-SMT-JACK (1)

U$4 AUDIO-JACKSMT SJ-3523-SMT-JACK (1)

U$5 AUDIO-JACKSMT SJ-3523-SMT-JACK (1)

U$6 AUDIO-JACKSMT SJ-3523-SMT-JACK (1)

U$7 AUDIO-JACKSMT SJ-3523-SMT-JACK (1)

U$8 AUDIO-JACKSMT SJ-3523-SMT-JACK (1)

U$9 AUDIO-JACKSMT SJ-3523-SMT-JACK (1)

U$10 AUDIO-JACKSMT SJ-3523-SMT-JACK (1)

Arduino home energy monitor shield

© 2017 www.botsbits.org Page 3 of 12

Step 1 — Arduino home energy monitor shield

http://www.instructables.com/files/orig/...

Attached to this step are the EAGLE schematics and board layouts for the Arduino energy monitorshield as well as PDFs for printing and using the toner method for etching your own PCB. You canuse the EAGLE files to get a professional board made or you can email me and see if I have any onhand for sale.

Note that if etching your own board, the through hole parts will be a bear to solder since the viasaren't plated and the traces are on the same side of the PCB as the components which is notstandard through-hole practice.

With a professionally made board with plated vias this will not be an issue. If you care to you canredesign the EAGLE board file to run the through-hole traces on the bottom to ease soldering andassembly from a hand-made PCB.

http://www.instructables.com/files/orig/...

http://www.instructables.com/files/orig/...

http://www.instructables.com/files/orig/...

Arduino home energy monitor shield

© 2017 www.botsbits.org Page 4 of 12

Step 2

The presented code is aconglomeration of a variety of opensourced, non-commercial code fromthe Arduino libraries, myself,Trystan Lea, Eric Sandeen, andothers. It is attached below. It issomewhat commented, but if youhave questions please ask.

Follow thisLink:http://www.instructables.com/files/orig/...

Arduino home energy monitor shield

© 2017 www.botsbits.org Page 5 of 12

Step 3

As presented, using the older (05 or v5) Ethernet shield and Arduino, you need to perform a fewmods on the store-bought hardware to get the power monitor shield to work.

First, on the Ethernet Shield you need to cut the traces from the A0 and A1 analog input pins totheir pullup resistors for the SD card. You can do this with a dremel cutoff wheel, a knife, orsimilar. The newer official ethernet shields (06 or v6 and newer) don't appear to require this mod,so look at your board before cutting it up willy-nilly.

A good resource is this atlas of Ethernet Shields. In the attached pictures you can see that for the05 or v5 Ethernet Shield board you need to cut the traces from A0 on the bottom of the PCB and A1on the top of the PCB.

Arduino home energy monitor shield

© 2017 www.botsbits.org Page 6 of 12

Step 4

Secondly, I implemented a software reset of the Ethernet Shield using D9 on the Arduino since Iwas having trouble with the Ethernet Shield locking up and failing to update the Pachube/Cosmfeed. The fix presented increased the interval between lock-ups but didn't really fix the problem soyou can skip it if you like.

The newer Ethernet Shields may not have this problem or it may be the code has a memory leak. Idon't know, as I am much more used to a real embedded development platform that has truedebugging tools and I just couldn't be bothered with trying to munge with the lightweight Arduinoenvironment.

It works as is but you have to power cycle the whole thing every month or two. The fix requires thatyou bend the reset pin on the Ethernet Shield so that it does not mate with the Arduino connector.See pic.

Then solder a wire from the bent reset pin to the D9 pin on the other side of the Ethernet Shield.You also need to cut the "RESET" pin on the Ethernet Shield ICSP header as pictured to allow theEthernet Shield to be reset separately from the Arduino using D9.

Arduino home energy monitor shield

© 2017 www.botsbits.org Page 7 of 12

Step 5

Depending on your installation needs, you may need to change the configuration of the PowerMonitor Shield.

The two main configuration options on the Power Monitor Shield are the burden resistor, which isused to set the scaling factor for the current to voltage conversion, and the single or double branchjumper which selects a single or double pole (120VAC or 240VAC in the USA) configuration.

When measuring current from a double pole breaker (main supply, AC, electric range, etc) you willneed a current transformer on each branch wire and need to use two of the 1/8" jacks on the PowerShield PCB.

For example, 1a and 1b in the picture below. Placing a jumper on the two-pin headers between the1/8" jacks on the Power Monitor Shield will combine the signal from the two current transformers inseries to allow power measurements for a 2-pole breaker. The jumpers are highlighted with arrowsin the image below.

If only using a single current transformer then leave the pins open (unjumpered) and use the first1/8" jack (viewed from top, counterclockwise), leaving the second jack open. For example, useonly 3a and leave 3b and its associated jumper open.

Jacks 4 and 5 are single pole only due to space constraints but you could mod my board layout toallow all 5 measurement circuits to be 2 pole if you wish.

The burden resistors are all set to 100 ohms on the schematic as shown and depending on thecurrent transformers or desired currents measured will need to be altered according to theformulas shown at http://openenergymonitor.org/emon/buildi...

Arduino home energy monitor shield

© 2017 www.botsbits.org Page 8 of 12

For example, I had to lower the burden resistor to 10 on the large main supply currenttransformers, 49 on the 100A clamp-on CTs, 60 on the 30A clamp-on CTs run in 2-pole, and left the30A clamp-on CTs in 1-pole mode as 100 ohms.

Step 6

With your Ethernet Shield modded and your code ready to go you can program your Arduino andstack up the shields. Put the Arduino on the bottom, then the Ethernet Shield, then the PowerMonitor Shield. Using a suitable enclosure, mount this assy near your breaker box, usually in thebasement.

Run a hot, neutral, and ground wire to the enclosure, grounding the enclosure, and running the thehot and neutral wires to the screw terminals on the Power Monitor Shield. (see schematic) Be surethat the power circuit powering these wires is off during this procedure. Next, run your clamp oncurrent transformers to the desired power circuits.

Note: do not clamp the current transformers over the wires unless the 1/8" plug is plugged into thePower Monitoring Shield. This is because the current transformer will generate a large voltage ifnot terminated to the measurement and burden circuit.

Put the main large current transformers over the large main supply wires, when using the clamp ontransformers over a 240 circuit, be sure to have one transformer out of phase of the other, as inturned 180 degrees from the other branch or your power measurements will cancel out.

Similarly, if you are getting negative power values, turn your clamp-on CT 180 degrees on the wire.

You will also need an ethernet jack and cable or a long cable from your router/switch to plug intothe Ethernet Shield. A wi-fi shield may be a better choice if you can't get a network jack nearby, butI can't provide any help there. Search the net and I'm sure someone has done it.

Arduino home energy monitor shield

© 2017 www.botsbits.org Page 9 of 12

Now, power up the breaker that your monitoring system is wired to, and hopefully you see theLEDs on the Ethernet Shield light up and no magic smoke. Check your Pachube/Cosm feed to seeif you are getting data.

You should start seeing data pretty quickly (less than 5 minutes) and updated every minute or so.Use the USB port on the Arduino and your laptop to view serial data from the Arduino totroubleshoot.

Arduino home energy monitor shield

© 2017 www.botsbits.org Page 10 of 12

Step 7

With everything working, you will want to calibrate the system. Depending on the circuit beingmonitored, you should plug in a known load into the circuit and see what the Power Monitor reportsto the server.

You can do this via the Pachube/Cosm website or the serial output of the Arduino environmentusing the USB connection. It is easier to use the USB connection to a laptop reading the serial dataif you can. I used a resistive load as a calibration measurement, it was a simple single burner hotplate which was a 650W load when on HIGH.

I measured the load and power factor using a P3 Kill-a-watt meter and then adjusted the scalingfactors in the Arduino code until they matched. Adding a less than unity power factor load to thecalibration regimen is a good idea if you can, such as a switching power supply or large motor.

The larger the load relative to the peak power of the circuit the more accurate your calibration willbe. In the code you should have the burden resistor values updated to your actual configuration(variable is ct_burden),

you should have the turns ratio adjusted to your actual CT configuration (variable is ct_turns), youshould halve the effective turns ratio for 2-pole branches (for example, put 1000 if using a pair of2000 turn CTs), and then use the calibration constant to adjust the measurement when calibratingusing the ICAL variable.

Arduino home energy monitor shield

© 2017 www.botsbits.org Page 11 of 12

In simple terms, the power monitor shield provides an AC to DC power source for the Arduino andEthernet Shield, samples the AC voltage waveform for power factor correction, and uses the currenttransformers to measure current draw of branch circuits in your home breaker box.

This document was last generated on 2017-06-28 04:57:27 PM.

Arduino home energy monitor shield

© 2017 www.botsbits.org Page 12 of 12