Step 5: Mod the Reset Pin

Secondly, I implemented a software reset of the Ethernet Shield using D9 on the Arduino since I was having trouble with the Ethernet Shield locking up and failing to update the Pachube/Cosm feed.  The fix presented increased the interval between lock-ups but didn't really fix the problem so you 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. I don't know, as I am much more used to a real embedded development platform that has true debugging tools and I just couldn't be bothered with trying to munge with the lightweight Arduino environment. It works as is but you have to power cycle the whole thing every month or two.  The fix requires that you 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 the Ethernet Shield to be reset separately from the Arduino using D9.
Can this be implemented in a 3 phase 220v?<br>How much and will you be willing to make me one?
Theoretically an energy monitor similar to this could be implemented on 3 phase although the timing of measurement and computing phase becomes more critical. It may require a more powerful processor and better sampling code. Not sure. <br><br>Making a one-off 3-phase energy monitor is not extremely interesting to me. The cost would be prohibitive for you. Good luck!
I want to automation my devices and monitor current,energyconsumed,power factor,activepower,reactive power,apparent power and tariff for powet consumed. Can I have source code for web as well as for arduino
<p>And also i don't want so many CT's i need only one CT, how can i modify the code?</p>
<p>Here is a very basic example I made for you by hacking my code to pieces:</p><p> #include &lt;SPI.h&gt;</p><p> #include &lt;Ethernet.h&gt;</p><p> #include &quot;EmonLib.h&quot;</p><p> EnergyMonitor circuit_1;</p><p> EthernetClient client; </p><p> IPAddress ip(192, 168, 0, 10); //Change this to match your network configuration incase DHCP fails</p><p> byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};</p><p> const char server[] = &quot;www.thingputstuff.com&quot;; // Change this to whatever server you're using</p><p>void setup() {</p><p> Serial.begin(9600);</p><p> // start the Ethernet connection:</p><p> if (Ethernet.begin(mac) == 0) {</p><p> Serial.println(&quot;Failed to configure Ethernet using DHCP&quot;);</p><p> // try to congifure using IP address instead of DHCP:</p><p> Ethernet.begin(mac, ip);</p><p> }</p><p> // give the Ethernet shield a second to initialize:</p><p> delay(1000);</p><p> Serial.println(&quot;connecting...&quot;);</p><p> circuit_1.current(1, 30); //This depends on the CT you use, I'm using SCT013</p><p>}</p><p>void loop() {</p><p> float circuit_1_Irms = circuit_1.calcIrms(1480) * 230 / 1000; //convert to kW</p><p> if (client.connect(server, 80)) {</p><p> Serial.println(&quot;connected&quot;);</p><p> /* Make your HTTP request here with</p><p> * client.print(&quot;your request here&quot;);</p><p> * you must construct your own request with headers and all.</p><p> */</p><p> // Wait for the server to respond and print the response to the serial console.</p><p> int count = 0;</p><p> while (!client.available()){</p><p> delay(10);</p><p> count++;</p><p> if (count &gt;= 500){</p><p> break;</p><p> }</p><p> }</p><p> Serial.print(&quot;Response took: &quot;); </p><p> Serial.print(count*10);</p><p> Serial.println(&quot; milliseconds&quot;);</p><p> while (client.available()) {</p><p> char c = client.read();</p><p> Serial.print(c);</p><p> }</p><p> } else {</p><p> // if you didn't get a connection to the server:</p><p> Serial.println(&quot;connection failed&quot;);</p><p> }</p><p> client.stop();</p><p> Serial.print(&quot;Power on circuit_1 : &quot;);</p><p> Serial.println(circuit_1_Irms);</p><p> delay(20000);</p><p>}</p>
<p>I had a look at the code, it is very bloated, I would suggest you use the emonlib from open energy monitor and instantiate a single object per analog pin you want to monitor. The way to do it in the code provided in the instructable would be to change the following lines:<br>#define NUM_CTS 1<br>#define MAX_CTS 1</p><p>AND THEN you will need to trace down all the arrays that jmengel declares, and only add a single element to them. It's a very inelegant way to do things though. </p>
<p>Hey jmengel, i succeded to make my configuration work flawlesly, now that i did the measurements in one phase,i want to develop it for 3 phase measurement:D </p><p>Cheers.</p>
<p>can you please share your circuit and tell about what your results are obtained from your circuit. I want to get the apparent and real power for variable loads in one phase.</p>
If you want to measure apparent power and real power for different loads, you need more CT's(current sensors) and more current sensing circuits.For example if you have 3 different loads like(a dishwasher, electrical saw and a washing machine) you will need for each one a different CT and a different current sensing circuit, your Arduino sketch should look pretty much like mine(i measure 3 currents and 3 different voltages for each of the 3 phase) with a slightly difference: You will have 3(or more) CT and probably only one voltage sensing circuit(i'm guessing all off your loads which you want to measure are 1 phase not 3 phase).I've put on my project a Nokia LCD to show me the results(you can't use serial monitor and LCD at the same time).<br>Currently i'm at the office but if you give me your email i will gladly share my circuit infos and pictures of the project with you.<br>
<p>Hey, i've seen the datasheet of LM2575 and found that it needs a resistor divider to feedback the output which decides the output voltage. cause i'm using a 230 to 12V transformer so do i need those resistors???</p>
Have you seen it? Because I have, and no resistor divider is needed. I suggest you read the datasheet:<br>http://www.ti.com.cn/cn/lit/ds/symlink/lm2575-n.pdf<br>
<p>oops!!! , i got my hands on this datasheet <a href="http://www.ti.com/general/docs/lit/getliterature.tsp?genericPartNumber=lm2575&fileType=pdf" rel="nofollow">http://www.ti.com/general/docs/lit/getliterature.t...</a></p><p>maybe resistor pair is to get adjustable output voltage...</p><p>BTW thanx a lot for ur quick reply , i thought it would take a week for ur reply. Peace!</p>
<p>Hello there, how much current does the pcb power monitor shield drain? I'm looking into it because i can't find a LM 2575 or LM1575 at the moment at the local store and i'm thinking of using a LM 7805.What do you think guys, also if it doesn't work with the LM 7805 can you recommned me something else please?</p><p>Thanks:D</p>
<p>LM7805 has the same 1A rating as the LM2575 and should work fine so go for it. Might need a TO-220 heatsink on the LM7805 but those are easy to get.</p>
I use a 30A clamp, our national grid is at 230V 50Hz..i have a transformer 230V ro 9v unregulated to get the power factor..i reduced the circuit to only one CT and kept the rest but i can't get the code to work..can you help me pleaseeith the code only for one ct and the transformer, i don't need any ethernet, or xbee shields, i'm gonna view the results from the arduino via the connection cable on the serial monitor..<br>Many thanks.
<p>If you'd like to hire me to write the code for you at USD$150 per hour, then send me a private message. Otherwise you are going to have to DIY, it will do you good.</p>
<p>i've seen ur code , can u briefly describe the initial variables u declared like phasecal , Vratio etc. and how do i calculate the value of phasecal and other variables...</p><p>and btw , u've done an awesome job!</p>
<p>All of these variables serve to get from the measured values to a somewhat accurate calculated current, power, voltage value. The calibration code is essentially Trystan Lea's, and he has some explanation on his website: </p><p><a href="https://openenergymonitor.org/emon/buildingblocks/explanation-of-the-phase-correction-algorithm">https://openenergymonitor.org/emon/buildingblocks/...</a></p><p><a href="https://openenergymonitor.org/emon/buildingblocks/ct-and-ac-power-adaptor-installation-and-calibration-theory">https://openenergymonitor.org/emon/buildingblocks/...</a></p><p>For calibration, I used a large resistive load of known magnitude, a 1500W electric space heater, to load the system and then tweaked the calibration values until the CTs and code reported good voltage, current, power and power factor for the load. Good luck!</p>
<p>and i fought to mention that i'm using a CT that has inbuild burden resistor, the CT coverts 30A to 1V.</p>
<p>How can i see your code, i want to know how to calculate the phase angle</p>
<p>You are going to have to read the Instructable. Hint, it is in &quot;Step 3 Code&quot;.</p>
<p>This looks like a great project, I am interested in taking a stab at it but I am a little confused looking at the schematic and BOM (a bit more technical than I am used to looking at). I certainly understand the voltage divider concept but I am unclear how you are measuring AC voltage. Are you using a transformer to lower AC voltage &gt; Rectifier to bring the phase up? Other similar projects are using AC-AC prebuilt adapters so I am a little lost in that area. </p>
<p>The project brings the AC-AC adapter on-board (the xformer) which is a bit different from other projects because I intended this for installation inside the power mains cabinet where it is easy to tap into the 120VAC mains but difficult to plug in a prebuilt AC-AC wall-wart. The AC voltage is measured by stepping the 120VAC mains voltage down where it is rectified and fed into the 5V switching regulator to generate VCC. The VCC is also divided down and used to bias the 9VAC output of the xformer which is itself divided to reduce the amplitude for sampling via the ADC. The sampled, divided, center-biased AC voltage signal is used to calculate phase.</p><p>Regarding the BOM, it is a dump from the Eagle schematic and isn't terribly readable for us humans.</p><p>If you prefer to use a pre-built AC-AC adapter, just get a 9VAC wall wart transformer and feed it into the circuit at the rectifier, omitting the on-board xformer. The rest of the circuit will be unchanged.</p><p>Hope this helps.</p>
Yes, very much. Thanks! I am also building a simple meter inside the mains box so this is still a good solution. I was just having a difficult time wrapping my head around it. <br><br>I think it would be helpful to have a more human readable list of materials for those that don't use Eagle. Can you import that list directly into a supplier like Digikey/Mouser?
<p>Hi,</p><p>Very cool project! I noticed you are measuring the voltage on only one phase and in your pictures you seam to be measuring the current on both phases going in to your breaker. Are you using a calculation to estimate the power factor for the other phase or how are you getting the separate power factors?</p><p>/Jonas</p>
The voltage phase angle is measured on a single phase for all current sensing transformers, with the assumption that being backed by the grid it will be the same across both branches. The measurement of the current waveform phase angle relative to the voltage is used to calculate power factor and is computed for the pair of current transformers when measuring 240VAC current on both branches. So the assumption there is that the aggregate current phase angle as approximated by the code is accurate for both branches. In the strange case where an appliance on the 240 branch has a large resistive load on both branches (PF = 1) and a motor for a blower on only one branch (PF &lt; 1) then this assumption will lead to some inaccuracies in power factor correction perhaps. A limitation. But for the price.... :)<br><br>-Jon
<p>Green energy monitor: http://free-energy-monitor.com/index.php/energy/live_data_locatii</p>
<p>Hi Jmengel,</p><p>Your article is very interesting. So, if you are okay, we would like to link our site(wiznetmuseum.com) to your article for more references. Is it okay?</p><p>I also left the same request to you by a private message a few days ago.</p>
<p>hey...can i get the coding that without using ethernet shield? only print the output at serial output </p>
The code already prints to the serial port. You should be able to simply comment out the ethernet setup and transmission code and go for it.
Can i flat out buy onr of these from you? This seems like a better solution than whats commercially available. Also, i have sometging wou may want in exchange (square D powerlogic cm 3350 with comm chip and panel.) Its 3 phase and waymore / not enough for wjat i want to do.
<p>Honestly I don't currently have any units on hand. I have my personal unit, which is prototype-esque in its fabulous spaghetti. If you are interested I can put one together for you, but the time frame would be post-holidays as I'm just buried right now with managing a kickstarter campaign.</p>
Damn phone keyboard...
<p>i already got this one in the picture, that is 220v-9v. can i use it?</p>
Should be fine. Not going to fit the holes in the PCB files but you can use wires from the PCB to the transformer. Just have to tweak the calibration parameters.
So i can use this transformer without changing any other other hardware component? It's also fine for the arduino power suply?
<p>You may need to change the divider resistors that feed AC voltage to the Aurduino (R2 and R19) depending on the actual output of your transformer. You just need to keep the signal from saturating the ADC input.</p><p>Also, as discussed, the burden resistors for each current transformer input will need to be altered to match the current transformers you end up using.</p>
Hi,<br>First of all sorry for my English because I'm italian.<br>I want to make a project similar to yours but i need to use 220v instead of 120v.<br>I found this on internet http://iq-technologies.net/projects/power/025/ can i use it?
<p>In hardware, all you will need to do to change the circuit for 220VAC is to swap in a transformer with a different winding. For example:</p><p><a href="http://www.digikey.com/product-detail/en/3FD-310/MT2097-ND/285633" rel="nofollow">http://www.digikey.com/product-detail/en/3FD-310/M...</a></p><p>You will also need to adjust some of the parameters in the code. But that will be easier.</p>
Hi,<br>First of all sorry for my English because I'm italian.<br>I want to make a project similar to yours but i need to use 220v instead of 120v.<br>I found this on internet http://iq-technologies.net/projects/power/025/ can i use it?
I'm having a failure every two days atm updating Cosm - it hangs at the update, seemingly at random. Did you ever get to the bottom of what was causing the locking up on yours? I'm thinking of rewriting the code without the Cosm plugin to add some extra connection checking. <br>I've been trying things for weeks now, to no avail. My shield is a clone by the way, don't know if that makes a difference. <br>Yours exasperatedly, Duncan
I did not get to the bottom of the lock up, although it was more on the scale of weeks/months rather than every day or two so I just live with it, and I got tired of messing with it. Did you heatsink the ethernet chip?
Great build, but please - add some isolation between neutral/phase and make isolation between neutral/phase and the ground plane. Add a fuse for that mains transformer too, if the transformer fails shorted you will have full house current cooking your PCB... That PCB layout is a recipe for disaster :-/
Looking over the PCB, I can see that it might make sense to increase the spacing between the mains traces and the ground plane. Also a fuse is not a bad idea. The case the PCB is housed in is a metal case grounded to the main panel. The transformer itself is not rated as an isolation transformer but does isolate the rest of the PCB from mains unless it fails in short across the primary to secondary. So again, I'm not sure how to add isolation.
You need some isolation between parts that is in contact with line voltage, that is - isolation to components on low-voltage side, groundplane, case etc.<br><br>If your PCB is mounted on plastic standoffs there is nothing to mention about placing the standoffs, but if the PCB is slit into some kind of grooves in the box, so the groundplane and metal box is actually touching, you need make a 8mm spacing between the high voltage and the edge of the PCB. The recommended spacing between your live parts and other components and/or groundplane is 8mm too. Please have a look at this picture: http://www.tablix.org/~avian/blog/images/blog/20070408t202730-img_2621-m.jpg<br><br>See the spacing between the two sides ? That is for safety. The only connection between the sides is a optoisolator and the transformer (which is internally isolated)<br><br>A fuse is a good idea, too.
Can you elaborate on a proper method to isolate? I am an ME with only enough EE to be dangerous, as you point out.
Have you looked at the AC waveform you are getting from the transformer? <br> <br>I've been looking at an energy monitor, but found that transformers distort the voltage waveform. <br> <br>See http://www.rotwang.co.uk/projects/energy_monitor.html for details
I have not looked at the AC waveform out of the xformer. I'll take a look and post the result. Nice write up on the power monitor you are building.
Nice, but a lot of cost in the audio jacks, I think people can find a cheaper alternative and save.
Being able to swap between circuits is quite handy so the jacks are a must. You do not want to solder your current transformer leads to the PCB. In any case, the SMT jacks are just $1.04 each in qtys of 10. If you want to find a cheaper jack, go for it, my only requirement was SMT. The current transformers are the main cost at ~$10 each. <br> <br>The cheapest alternative is to turn off the main breaker, tape a sheet of paper with &quot;0 Watts&quot; written on it to the computer screen and go for a walk. Savings!

About This Instructable




More by jmengel:Laser Cut Front End Loader Toy Laser Cut Ukulele Electric Brewery Control Panel on the Cheap 
Add instructable to: