>>> Before committing to this design, please read my comments about the burden resistor value here <<<
Based on the standard V&I sketch which uses calcVI() in EmonLib, I’ve had a system in place for the last couple of months which diverts surplus PV power to our immersion heater. This system has proved to be both effective and reliable, and I am most grateful for everyone who has helped me along the way. The main downside to this arrangement is that it requires an expensive item of third-party kit to distribute the power. (I know that others have found cheaper ways, but my Carlo Gavazzi unit cost me £70).
Other contributors to this forum have shown that a standard triac can be easily controlled by an Arduino. By using a zero-crossing detector such as the Motorola MOC3041, it should be possible for the Arduino to allocate mains cycles directly to the load rather than delegating this task to a separate device.
A Mk2 system of this type has been working in our garage for the last few days. The sketch and a schematic diagram are attached, its main features being:
- a comprehensive 'debug' mode which allows real world conditions to be simulated ;
- a continuous mode of operation, for both measurement and distribution of power;
- an "energy bucket" concept which gives precise control of surplus power;
- interleaved windows for measurement and generation, each only 20mS;
- a rapid response time to changing conditions (<50mS);
- suitable timing for 'arming' a zero-crossing trigger device;
- a single LPF which determines the dc-offset of raw V&I samples;
- a programmable safety margin for biassing import v. export;
- minimal calibration is required.
As supplied, the sketch is in ‘debug’ mode. This allows the code to be put through its paces without requiring any additional hardware – just the Arduino. When running in this mode, voltage and current samples are synthesized, as is the operation of the triac. To convert it to ‘normal’ mode, just comment out the #define DEBUG statement.
The algorithms for measuring and distributing power are linked by an ‘energy bucket’ variable. Surplus energy, as measured at the supply point, is recorded in this variable, and power is only allocated to the immersion heater when the available energy has reached a pre-determined level. The energy bucket is updated after each complete cycle of the mains, and a decision is then taken as to whether the triac should be ‘on’ or ‘off’ during the next cycle.
To minimise the response time, the single-cycle (20mS) windows for measuring and distributing power are interleaved. If sufficient energy is not available, the triac will be ‘off’ from the next zero-crossing point, just 10mS after that information has been gained.
In the standard EmonLib code, there is a separate high-pass filter (HPF) on each of the voltage and current streams. I’ve taken a different approach (thanks Robert for the suggestion), and have instead implemented a single LP filter which allows the DC bias to be accurately determined. By updating the LPF only once per mains cycle (my idea!), its performance is nigh-on perfect, with no attenuation or phase shift.
Too good to believe? Well, the LPF is not acting alone. There is also a standard HP filter which acts just on the voltage stream. The purpose of this secondary filter is to group the voltage samples into cycles so that the LPF can be accurately updated. Unlike the LPF, the HPF can always be relied upon to start up correctly. Together, they form a great combination.
A single (buffered) reference is used for both the voltage and current sensor as shown on the schematic diagram. The LM358 runs from the Arduino’s 5V rail and provides a rock-steady reference point. If separate reference circuits were to be used, the single LPF approach would then not be appropriate.
[Update: If measuring only "real power", which is what the utility meter does, the single LPF would be fine when using separate references. This is because any DC offset in the current samples is removed by the maths. For other calculations such as Power Factor or Irms, the dc-offset of each sensor must be dealt with independently.]
The energy bucket has a nominal capacity of 3600J, or 0.001kWh, with power only being allocated when it is at least half-full. To ensure that a small amount of export to the grid is maintained, a programmable safety margin has been included; this acts as a leak in the bucket thereby reducing the rate that ‘on’ cycles can be allocated to the immersion. For anyone with a nervous disposition, just increase the value of safetyMargin_watts.
So how accurate does this system need to be? Not very, is the short answer. Because there is only one place where current is measured (flowing into and out from the grid), any inaccuracy will be cancelled out. Once the distribution algorithm has reached the operating point, ‘on’ cycles will be allocated at the appropriate rate for the prevailing conditions regardless of any absolute error in the measurement system (it just needs to be linear).
In a place such as this, if I were to suggest that no calibration is required at all, I’d probably get shot down in flames. So, here’s how it works:
In ‘debug’ mode, the synthesized values are directly equivalent to Volts and Amps. By mutiplying pairs of V&I samples together, this gives the instantaneous power in Watts. By adding a mains cycles’ worth of instP values together, and dividing by the number of samples, this gives the average power during that mains cycle, also in Watts. Dividing by cyclesPerSecond = 50 gives the energy gained or lost during that individual mains cycle, in Joules. This energy contribution is then added to the existing contents of the bucket without need for further calibration. In debug mode, POWERCAL = 1.
In ‘normal’ mode, the sensitivity of the measurement system is affected by a variety factors. My simplistic approach, however, says that it is only “energy” that needs to be calibrated. By experimenting with a few small loads, I soon found that a value of about 0.085 allows my system to track real-world energy flow. With a 40W bulb connected, my bucket ‘fills’ at around 40J per second. Moreover, when the light goes off, the bucket’s value remains constant to within a few tenths of a Joule per second – there's minimal unintended leakage. So, before adding my measured power contributions into the energy bucket, they are multiplied by POWERCAL = 0.085. The units of this parameter are Joules per ADC-unit squared, but what about its value?
Using any of tools that have been posted recently for recording the range of raw sample values, the extent to which voltage and current are being over- or under-read in terms of ADC units can be determined. From the voltage and current samples taken while powering my 3kW kettle, I appears that I am ‘under-reading’ voltage by 471/678.8 and ‘over-reading’ current by 535/35.36. Taking the inverse of each of these ratios gives an overall value of 0.095, which is close enough to 0.085 for my purposes.
One final bit of calibration is needed, this being to determine an appropriate moment for arming the external trigger device. Because my system under-reads voltage by a factor of 471/678.8, my voltage samples (after removal of the DC-offset) need to be multiplied by the inverse of this ratio to obtain the correct value in Volts. VOLTAGECAL = 1.441 is therefore applied before checking whether the voltage is at a suitable value for arming the trigger (for the MOC3041, this is a minimum of 20V beyond the +ve going z/c point.)
The hardware is entirely straightforward, photo attached. The input circuitry is still on breadboard but will no doubt be transferred to strip-board in due course. With the 40W triac bolted to an offcut of aluminium tubing, it gets pleasantly warm when the PV gets going, but is rarely too hot to touch. A better heatsink, with vertical fins, would be a nice addition.
Great work Robin, and thanks for documenting your work.
I hope that in the near future I'll get some free time, and plan to follow in your footsteps.
Good work Robin, well done on a well thought out solution.
Robin, I've hosted your code on github so I can tinker with it...
** Github link removed at Robins request **
Feel free to fork/change as needed.
That's fine, Stuart, I look forward to seeing lots of improvements :)
Paul, it was your video of the budget triac, silently switching the lamp on and off, that convinced me about the feasibility of this approach. This project is a team effort and I stand on the shoulders of many others.
*** Updated 3/8/12: Just to be clear, I'm perfectly happy for my code to be posted on GitHub, or anywhere else, as agreed with Stuart. A link to this duplicate code had, however, appeared in my original posting which did not seem helpful. So, if you want the original sketch, it's there as a zipped attachment to my original post. Any other versions are obviously outside my control, but I look forward to seeing what useful developments other people can devise. Calypso_rae
Where do you buy your parts from please?
Is there a specific breakdown of parts required?
Im trying to get a friend to make this for me, as I dont think that I could do this myself? Whats your thoughts? I'm good at DIY / with my hands, but have never even made a absic board before...
This is incredible, and if I got it working, would be fantastic! I do have a contact that could 'programme' the ardinuno board for me...
Thanks for your time.
Sorry, there's no specific breakdown of parts as such, only the diagram which shows most of the components. Input circuits are well documented in the Building Blocks section, but if you wanted to use my Mk2 sketch as it stands, you would need to construct the shared Vref arrangement as per my diagram. If, however, you wanted to retain two separate Vref circuits, then you would really need to change the code back to the standard twin HP filter arrangement as can be found in the function calcVI(), in the library file, EmonLib.cpp
To 'program' the Arduino board is entirely straightforward. Just unzip the file that I posted to wherever you want it to go on your computer and open the .ino file. If your IDE has been correctly set up, a folder of a similar name should appear within which there will be just one file, that for the sketch. Then click the upload button, and you're away.
Before launching in to this project, you will need to decide how to connect into your immersion heater's wiring. In my case, the feed cable for the immersion comes directly from the Consumer Unit which is right next to our meter in the garage. It couldn't have been easier to wire up. But if your immersion were instead to come off a ring-main, them some bespoke means of intercepting that power would be needed. If that is the case, then it may be eaier to use a radio link to instruct when the triac should be on and off, rather than having to feed a new cable through the house. But that is not a subject that I know anything about.
The current clamps that I've used came from Cool Components, as directed fro the OEM page. Last time I checked, these items were out of stock, but you should be able to find one elsewhere. Although it does not say so on the schematic diagram, I removed the internal burden resitor from my CT before use. The only burden is therefore the external one, which in my case is 150R. My triac and trigger came from a budget supplier on eBay, as did the Arduino and breadboard. But these are all standard items so you shouldn't have any difficulty getting hold of them.
As to whether you should have a go at making this for yourself ... yes, absolutely, I say!
Start with a simple test-rig, just a modified extension cable so you can measure the current that's taken by small appliance, and see how you get on. Leave the power-distrubution side for later. If you get stuck, then just post a help message on the forum; that's what it's there for. If you can convey the details of a genuine difficulty that you're having, someone is bound to come up with a solution before many hours have passed :)
I've just singed up to the forum having been a "lurker" for some time. I too have been playing around with the BTA41 triac but using an NE555 for zero crossing, but your solution is far more elegant, as they say less is more.
I got stright on eBay and ordered a Uno and MOC 3041, did you choose the LM358 for a reason or will any op amp do?
I've never touched a Uno or any other micro computer come to that, my only programming experence is with a ZX Spectrum (that shows my age) and I've forgotton all I ever knew about BASIC.
Will you be expanding the controler with a display etc?
I hav two SCT 013 030 transfomers (with built in burdens?) and wonder are they useable with your circuit, and how would I inteface them.
I'm sorry if these questions are dredfully nooby, but I am well new!
1. MIND YOUR FINGERS. You're dealing with mains voltages on the triac and opto-isolator. Make sure you have enough clearance between the live mains connections and the low voltage side (check the data sheet). And earth or otherwise enclose the heatsink and other live parts.
2. LM358: Pretty much any half-decent op-amp will do.
3. Forget BASIC (Bloody Awful Set of Interpreted Commands ). The Arduino is programmed in C++ My usual recommended place for learning that is C++ In Action: Online Book (I don't suggest you work your way all though the course, you probably will want to work through the beginning parts only to learn enough to get going, then use it as a reference).
4. ZX Spectrum (that shows my age) I started with Fortran IV, dial-up to a mainframe with acoustic couplers at 110 baud, which shows my age (and I was in my late 20's then!).
5. SCT 013 030 is what Calypso_rae used. I believe (though I've no evidence) that these are the same as the 100 A version but with an added internal burden resistor. Calypso_rae appeared to get one with a faulty resistor and took it out - disassembly is quite easy, and had his burden resistor remote.
If you have any more questions, just ask.
Thanks for the swift reply, will be resistor snipping the CT ASAP as i would like to follow calypso_raes design closely (if it aint broke etc.).
As for phisical isolation I will be making my own pcb probably very similar to how the schematic is laid out with a healthy bit of empty board before the opto/triac. And a lot of copper for the 12.5 amp tracks.
I've looked at the building blocks section and it looks to me that the voltage sensors are no more than small mains transformers, as I have a pcb mounting 9v 3VA transformer knocking around I guess that will do.
As for point one, speaking as an ex civilian naval engeneer working on subs who once came in intermate contact with 16KV DC and spent the worst six weeks of my life in a MOD hospital (the food is worse than NHS) I have a more than passing interest in not getting too friendly with mains voltage!
Thanks for the heads up on C++ will have a look this evening.
"I have a pcb mounting 9v 3VA transformer knocking around I guess that will do."
"I have a pcb mounting 9v 3VA transformer knocking around I guess that will do."
We have reservations about using these. They tend to have a very distorted output (i.e. the output voltage is not a faithful reproduction of the mains input) so you may have difficulties in calibrating the power readings. You might want to try to replicate the tests described here and check it first. I'd do that before I etched a PCB! (if you follow my reasoning).
"intimate contact with 16KV DC"
"intimate contact with 16KV DC"
You're darned lucky to have survived that. You should have bought a lottery ticket that day instead of going to work! We thought a subcontractor's electrician who got too close to 6.6kV was lucky to survive, and that's the closest that I've ever been or want to be to anything like that.
If your current clamp has an internal burden resistor which appears to be intact, I see no problem with using it. If you do use the internal one, just omit the 150R one in my circuit. The value of the burden really doesn't matter. I used to reason that with such small currents flowing at the supply points, then it was important to have a high signal amplitude. But that's too simplistic. Although the net export flow may be very small, the current within individual mains cycles is far from small.
If you have 1500W of spare PV, then that's the amount of power which you'll be exporting during 50% of your cycles, For the other 50%, you'll be importing 1500W to suppliment the 1500W that you already have from the PV. 1500W has a peak current of around 8A, so a slightly smaller signal size caused by a lower valued burden is really nothing to worry about.
Getting those fiddly clamps apart is no easy task. Next time I would probably just stick with the internal burden rather than risk damaging the internals.
I used an LM358 because it only requires a single voltage rail. For my Mk1 version, the AC controller that I chose needed a 0-10V control signal, so I needed to double the smoothed PWM output from the Arduino. When I chacked recently, it appeared that an basic 741 op amp needs a minimum of +/- 3V, so it didn't seem suitable for operation from a single 5V rail for buffering the Vref circuit.
The Arduino Reference pages are very good, all part of the downloadable IDE. There are lots of nice examples in there which you can just paste into a new sketch and have running within minutes.
Good luck, and feel free to raise any more questions here
At the risk of sounding silly....
As I understand it (and my understanding of electronics is close to zero) this circuitry will vary the amount of power allowed into an immersion heater by switching it on and off very rapidly. However this can only happen at a max of 100 times per second. Lets say we have 2kw available from panels (in my case its a waterwheel) and we are feeding a 3 kw immersion heater. If you switch the ih manually (say on for 5 sec, off for 5 sec) then 2kw will come from your own generation and 1kw from mains so you will be paying for 1/3 of power used.
How different is it when you switch at 100Hz (would that be 66cycles ih on,34 off?) ie wont the meter read any `top up`?
Or is the meter `fooled` because it averages over a longer period than 1 cycle?
Have a good browse through the forums. This had been discussed at great length.
The short answer is yes, the timebase does make a difference.
[Edit] There's discussion at:
This list is not exclusive.
There's some description here. [Edit] If it's not enough, I reckon Google could find plenty more. I've since found this. I've not read it at all carefully, but at first glance it looks comprehensive.
Noah: no worries. If you follow any of the examples in these parts, your meter should behave just fine. At 3kW, there's at least a second's worth of headroom before you'll be charged.
fewyatt: I've just used a standard triac without any additional snubber components, and it's working fine. Check the picture at the top of this thread, that's all there is. For two of the resistors, I didn't have the right values, so used two others in parallel.
No need for a snubber, in its simplest form its a resistor and capacitor in seris together accross a switching device, the capacitor bypasses high voltage spikes into the resistor and that kind of absorbs the energy.
1) As you say the element is resistive, snubbers are mainly used on inductive loads or where phisical switches are passing high current.
2) Everyone on here seems to be working on zero crossing systems.
Remember when cars had ignition coils and contact breakers, that was an "anti" snubber system and used the switching to produce EHT for the spark plugs from the coil they had a capacitor arcross the switch to keep burning of the contacts to a minimum but no resistor.
I just looked away from openenergymonitor only briefly, and boy am I impressed with your progress! That is an excellent job you did there.
I have yet to fully understand your code, however it looks so elegant I am willing to ditch the Carlo Gavazzi, and replicate this just for aesthetics.
Just one question: is there a particular reason you went for 'high side' switching, where the triac is sitting between the incoming live and load, instead of low side, where the triac sits at the neutral? The latter would make it easier to sample the voltage drop across the triac (when ignited) to assess whether there is any current flowing or not.
Even if using a low side switch there are considerable safety issues with a direct connection from mains to the low voltage processor, e.g when the triac is off there is 230V across it. How would you do it?
I bought a £5 SSR from China via eBay that does not turn on and off quite when expected and was wondering if it is something to do with lack of snubbers that is affecting it, but as the useful replies say snubbers are mostly for inductive loads.
If you follow Robin's circuit, you could substitute a different triac, for instance the "BTA26-600BW" model which is classed as "Snubberless"
The BTA26 BW/CW triac family are high performance glass passivated chips technology.
The SNUBBERLESS] concept offer suppression of RC network and it is suitable for application such as phase control and static switching on inductive or resistive load.
I suspect Robin got his bits, including triac from Spiratronics either on eBay or directly from their web site (could be wrong) like me, they sell both those triacs though the 40A one is out of stock at the moment, I got the BTA41 for the extra headroom.
What load do you test it with?
Just to emphasise fewyatt's point, ANY galvanic connection to EITHER line or neutral will make the processor technically 'live', so it needs to be double insulated or in an earthed metallic box - and no connections for programming allowed. Else just think what would happen if the neutral connection got severed in the street outside, or perhaps more likely what if you're in a rural area and your feed is via overhead lines on poles, and the neutral is lost?
BTW, I'd go for a somewhat larger device than 25 A, on the grounds that you cannot protect even RAE's 40 A device with a standard BS1362 13 A fuse. Here are the 12t curves for 3 A & 13 A fuses (the lower line is the minimum 'don't blow' and the upper line is the 'must blow' curve), the red line is the curve for the BTA 41. It needs to lie outside (i.e. above and to the right) of the fuse curve at all values of current for the triac to be protected. The triac is safe at currents above 250 A - the fuse blows first - and below 40 A., when the triac can safely carry the current subject to temperature rise of course. In between it's at risk.
And in answer to the question, "Is there a better fuse?" - yes there is, but it costs several times more than the triac!
[Edited with a better graph and safe area of operation clarified].
bommels: The only reason that I put the triac in the 'hot' side, is because that's where I would wire a switch into a lighting circuit. According to the datasheet, it should work either way. I've just changed the wiring around, and it's now working just as before, but with the triac on the neutral side :)
Because everthing seemed to be working together nicely, I took a video of the setup and will put this on YouTube today after the camera's battery has recharged.
Please excuse the state of the garage which is even worse than normal :(
PS. It's uploading now, and should soon be available at: http://youtu.be/QzTAAVOkVAs
Okay then Robert, this is another can of worms you've opened up!
Can you explain more about the fusing requirements please!
I suspect Robin got his bits, including triac from Spiratronics ... on eBay
Yup, I sure did
Did I set off some alarm bells here ;-)
No worries, I understand the importance of galvanic isolation, and I was not suggesting do away with it. It is just that in most SSR applications I have seen, the switch is in the neutral, so the control electronics (trigger circuit & 0 X) are not wiggling along at mains voltage. Perhaps the only advantage is that the optocoupler might gather slightly less dust in its lifetime (?)
(This ought to be a Theory page!).
A fuse is a piece of wire that has resistance, and mass, and some insulation around it. The resistance makes it heat up when current flows. The mass regulates how long it takes the temperature to rise with a given amount of heat going in. The insulation keeps the electricity in (irrelevant to this discussion...) and it keeps the heat in.
Domestic Miniature Circuit Breakers are designed to mimic the action of fuses fairly closely.
From those basic concepts, you can draw a curve - the I2t curve - for a fuse that describes the interaction of those 3 things. A 'fast blow' fuse has little thermal capacity and good thermal insulation so that it heats up and melts quickly. A 'slow-blow', anti-surge or time-delayed fuse will have a larger mass of metal that takes a while to get up to melting temperature. You can sometimes see a glass fuse with a blob of solder in the middle of the wire - that's no accident, it delays the melting of the wire so that a brief surge of current, such as you get when starting a motor, doesn't blow the fuse.
So it's obvious that the common belief that a 13 A fuse blows at 13 A is rubbish. The 13 A fuse will carry 13 A indefinitely, at the maximum expected ambient temperature. From the graph I've posted above, it will blow at 2 x current (26 A) at somewhere between 3 s and never! It needs 30 A to guarantee to blow inside 400 s (6 2/3 minutes), but it might blow in 1 s.
Now the same kind of curve exists for anything that carries current and gets heated by that current - resistors or, the device we're interested in, triacs. The data for the BTA41 is given in just one line on the data sheet: In Table 2 "I2t I2t Value for fusing tp = 10 ms 1000 A2s". From that you can draw the curve for the triac. For the triac to be protected by the fuse, the whole of the triac's curve must lie above and to the right of the fuse curve. [Bear in mind that unless it has a large and fully rated heatsink, the vertical line for the triac is wrong, it should continue to slope but without knowing or making assumptions about the heatsink, we don't know enough to show it].
It's worth carrying on and mentioning that the curve for the fuse must itself lie totally outside the curve for the actual load current of the device it is protecting, else the fuse will blow during normal operation. So the appliance can draw 50 A for 0.1 s, or 100 A for ½ cycle, without the fuse blowing, and 20 A for a long time.
(Don't confuse the terms 'slow blow' or 'quick-blow' with "HRC". Another property of fuses is the maximum fault current they can handle. An HRC fuse is constructed with an arc-quenching material inside so that it can safely handle a much higher fault current)
Thanks for this explanation Robert, you certainly know your stuff!
So in simple terms, a 13A fuse is likely to blow at double its rating (say 25-30A) but while this is waiting to blow, the triac would have been destroyed because the BTA26 model can only handle 25A max.
Having said this, does the "peak surge current" handle the extra load, but only if the fuse will blow within the peak surge current rated time (400A surge peak for10ms on BTA41 - I think!)
So in simple terms, No, you can't say that. Nothing is ever simple! What you can say is the fuse won't blow at much less than double the rating (this is a reasonably safe assumption for most fuses if you don't know any better - for some fuses it may be 1½ times, here it's just over that).
You have to define the current that is being passed and work from there. In practice, the cables in your house and the supply fault level will limit the current. All you can say for definite is if the whole of the triac's I2t curve lies outside the fuse's, it will survive no matter what current flows; if the whole of the triac's I2t curve lies inside the fuse's, it will probably die; in between, it is anyone's guess (but even if it survives, it might have been severely frightened and expire prematurely).
If you look at the data sheet, what "peak surge current" means is spelled out. 400 A for 1 whole cycle but not repeated until the junction has cooled to 25°C! Table 5 adds to that and defines the value for more than 1 cycle, and for repetitive peaks (though I don't know what 'repetitive' means - in terms of the cooling time between bursts of current).
If you do have a 400 A fault, then the triac is OK because the fuse clears first. But note the fuse is not defined below one half cycle, the reason being that you must assume the arc will not go out until the next crossing.
Hi Robert you were dead right about the transformer, o/p looked like a sine wave drawn by a chimp! I found a Mascot same as the one on test on eBay so snapped it up.
I have just rigged your circuit up with the triak and I have been trying to get my head around the code but it is just too complicated for me to understand. I am geting these reading in the serial monitor, can you tell me if they seem ok.
In NORMAL mode ...
cyc# 5, sampleV 409, fltdV 34.77, sampleV-dc -122, cumVdeltas -3089.20, prevDCoffset 562.29, refFltdV 531.40, enInBkt 0.00
cyc# 505, sampleV 519, fltdV 20.36, sampleV-dc 8, cumVdeltas -3.50, prevDCoffset 510.75, refFltdV 510.72, enInBkt 47.93
cyc# 1005, sampleV 508, fltdV 9.43, sampleV-dc -2, cumVdeltas 28.91, prevDCoffset 510.54, refFltdV 510.83, enInBkt 106.89
cyc# 1505, sampleV 507, fltdV 8.34, sampleV-dc -3, cumVdeltas 24.64, prevDCoffset 510.59, refFltdV 510.84, enInBkt 165.49
cyc# 2005, sampleV 520, fltdV 21.45, sampleV-dc 9, cumVdeltas 22.62, prevDCoffset 510.42, refFltdV 510.65, enInBkt 225.02
cyc# 2505, sampleV 505, fltdV 6.49, sampleV-dc -5, cumVdeltas -1.75, prevDCoffset 510.70, refFltdV 510.69, enInBkt 284.00
cyc# 3005, sampleV 513, fltdV 14.46, sampleV-dc 2, cumVdeltas 30.44, prevDCoffset 510.46, refFltdV 510.76, enInBkt 343.16
cyc# 3505, sampleV 511, fltdV 13.59, sampleV-dc 1, cumVdeltas -29.74, prevDCoffset 509.69, refFltdV 509.39, enInBkt 1403.25
cyc# 4005, sampleV 499, fltdV 1.56, sampleV-dc -10, cumVdeltas 13.76, prevDCoffset 509.52, refFltdV 509.66, enInBkt 3600.00
cyc# 4505, sampleV 518, fltdV 19.52, sampleV-dc 7, cumVdeltas -11.18, prevDCoffset 510.59, refFltdV 510.48, enInBkt 3600.00
the last 2 lines are with a 2kw hairdryer switched on.
is the samplev too high or is 500+ ok.
Hi JimJam, great to hear that my code is in use :)
This line of printout every 10 seconds is to check that the low-pass filter is working OK. With a 2.5V reference, then you should get a refFltdV value of 511, this being mid-way in the ADC's input range. Your value of 510 looks spot on.
For the energy bucket to work as intended, your CT needs to be at the supply point near to the meter. Outgoing energy, as generated by the PV, is seen as positive. The level should rise steadily as surplus PVpower is sent the the grid, but should never exceed 1800J by much because the triac turns the dump load on at that point. When your house is importing, the energy bucket should be empty (0J). Maybe you need to flip the CT around the other way? Have you seen the video which I posted yesterday when I showed my system working and talked about these levels.
To get the ouput side to work, why not use 'debug' mode. Although its cycle rate won't be synchronised with the mains, it works perfectly well with real hardware connected, If you specify a PV of 1500W and a dump load of 3000W the output pin will rattle up and down with a 50% duty cycle. If you have a triac connected to a bulb, you should see it doing something.
I got my system to work first on a test rig. You can simulate the PV output by simply measuring the current taken by a light bulb using a extension lead from which a short section of the outer cover has been cut away. If you're supplying a 100W filament lamp, then your energy bucket readings should increase by 100J per second. Adjust POWERCAL until it does.
Just below the "WARNING" statement, 'comment out' the large block which you no longer need, and 'comment in' the short block immediately below which just displays the energy per second. To see the change in energy per second, just zero the value after printing it out.
Robert Wall... Fuse topic..
Considering the fuse/safety aspect of this system, what would be commercial practise?
A better specified fuse (one which matches the characteristics of the triac) or would the designer add a simple 13A fuse, knowing that the triac *could* get destroyed by it - but knowing that the circuit was safe, because the fuse would blow and therefore remove any risk of fire ?
What fuse would you pick?
I think the possibility of a triac - or indeed any similar semiconductor: thyristor or transistor - starting a fire to be pretty remote, especially if it is properly mounted and heat-sinked. Most likely it will fail instantaneously, either open or short circuit. If it fails to short-circuit, the fuse operates after the triac fails. If if fails to open-circuit, it has become the fuse.
I would choose the most economical combination of fuse and triac. Without searching catalogues, data sheets and price lists, that would likely call for a bigger triac (the fuse to protect the 40 A triac costs in excess of £11, IIRC, [a lot - see post below] and that's without a holder).
My advice to Calypso_rae, knowing that he had chosen and got the triac, was "Make it easy to replace - i.e. don't solder directly to a p.c.b. and fix with a nut and bolt, and make sure that it's easy to get at."
And Calypso_rae's heat sink should be solidly earthed. He's relying on the insulation between the junction and the tab in the triac, and I wouldn't guarantee that would remain intact if the junction melted. I'd have mounted the triac on a heat-sink washer, and used a nylon bolt to secure it. That way you have two layers of insulation.
Robert is quite right to point out that I have glossed over some of the safety implications of 240V circuitry. However, my rig appears to be safe enough for its current use by me, and it's the sketch that I was mainly involved in rather than the output stage.
When I get around to putting everything into a box, I'll need to give some thought as to what additional safety measures may be needed. But for now, it seems fine as it is where I can get at everything.
If I were to produce a kit of parts for sale, then I would obviously need to include additional safety measures. However, on a forum such as this, I trust that readers will be aware of the safety implications and take appropriate precautions.
If you use my design, while following Robert's wise precautions on safety, then you'll get the best of both!
Yikes! I have a bad memory. I've just checked again the fast semiconductor fuse I found that would protect the 16 A triac. Here: http://uk.farnell.com/cooper-bussmann/fwh-015a6f/fuse-15a-500v-ferrule-f... I won't include the price here on the grounds that everyone will think I copied it incorrectly.
[Edit] The 40 A triac can be protected somewhat less expensively, but the fuse still costs more than the device it's protecting.
The triac is now in the Neutral line of my rig rather than the Live. This was to allow the state of the thermostat to be determined locally to the Arduino by digitally monitoring the presence or absence of 240V via the immersion. The switch + neon from upstairs has now been rehoused in the garage, adjacent to the controller.
Being in the Neutral line, the neon now works in antiphase: when the triac is off and the thermostat is closed, the neon is on; otherwise, it's off. Having found that our supply meter's LED could be monitored using an LDR, I was hopeful that a standard mains neon could be similarly detected.
And so it proved to be. With no changes to the code or circuitry, the neon's state can be detected by the LDR without any difficulty. Rather than clutter up the +ve half of the mains cycle, which already has things to do, I've added code for testing the neon-detection caaibilty in the -ve half of each mains cycle. To summarise:
- the neon can be detected at all stages of the cycle, this is presumably due to persistence of some kind;
- detection works of 350V but not at 400V, thus showing that my calibration is about right (240V rms = 340V 0 to pk);
- when the neon was lit, I recorded 50 'on' states per second; when off, the number was 0. No errors, seems reliable.
With this sketch running, I wondered how much Serial activity could be included in a single (neg) half cycle of the mains before the opportunity for measuring during that cycle had passed (this being approx 8mS with the limit set at -200V). Two blocks of 50 characters were OK, but not three; 28 pairs of 1 or 2 char strings were OK, but not 29. Displaying that amount of information would seriously affect any power measurements during that cycle, but if a lot of data needs to be displayed, then quite a lot can be sent out within an 8mS period.
My updated sketch includes the neon checking code that I added today; it also has LED monitoring code which categorises LED events into PULSE, ON and OFF, and displays the energy state on each occasion.
Tip - to make sure that your daytime sketch will start up next day, temporarily reverse the CT. If the on-board LED lights up (caused by incoming flow filling the energy bucket), then all is well. Don't forget to reverse it back to how it should be!
I have just done a stripboard layout of robins current and voltage circuit I would be greatfull If someone could check it out to see if it is ok or any improvements.
Hi all this is a great project and I’ve decided to build the system and get involved but I have one problem. I’ve studied the circuit diagram and understand in general how the system works but I’m unsure how to size the transformer on the voltage sensor can someone list the type and size of the transformer required as I’ve read that not all transformers are suitable for voltage sensor measurement due to some transformers degrading the output waveform. I’ve probably missed something obvious. I’m thinking of making an energy store (200L+ unvented tank) feeding my combi boilers water input feed thereby giving me the ability to store/use my PV surplus generation but still have the cheap gas water heating option on sunless days or when the energy store is depleted.
Your PCB looks fine but you have complecated it with an AC connection and a pin 2 connection also on the current side you have a CT and pin 1 connection.
You could do what I have done and add a strip of aluminium angle down one side and put a 2.5 or 3.5mm socket in for the current sensor so you can connect direct. I have also added a 2.1mm socket for a 12V AC/AC adaptor so I can connect direct for voltage sensing, then only four terminals are needed for Pin1, pin2, +5V and 0V (Gnd).
Any 9V or 12V, 3VA, 6VA or higher transformer will do. The important thing is that you cant use the same transformer winding for a power supply, as it has to be unloaded. I suggest an external mains AC/AC adaptor with a 2.1mm plug that can go into a scoket on your main sensor PCB along with a socket for the current transformer. See above post.
I have an old BT 12V AC mains adaptor working just fine on this circuit.
Yes I agree I could have set it out a bit better but i only had these very small stripboards to hand and a few edge connectors, this was the only way i could fit everything on.
I have had a jiggle about and think this works better.
"Any 9V or 12V, 3VA, 6VA or higher transformer will do." Nope. You need to be sure it works far enough out of saturation, else you will see a distorted version of the mains waveform. Unless you are using it to power the emonTx (which despite your assertion, you can do - see the design for the new SMT emonTx, when a decent VA rating helps), the VA rating has nothing to do with that, even though common sense says it should have. It's all down to the flux level in the core, and that was set by the designer. You can look at the report on the Mascot adapter to see how to check your transformer.
I have some Mascot 9VDC adapters with european plugs to hand, so with a dremel you can get to the transfomer for use in this circuit. I will find out the postage cost for anyone who's interested.
Thanks for the quick reply this project has been going round in my head hence I'm wide awake at 03_55 :-)
So far, I've tried three different approaches for the voltage sensor. The waveforms that they give are all slightly different, with differing amounts of phase-advance, but our water seems to be heated just as effectively by any of them. The difference in performance is tiny. Any safe way of obtaining a miniature voltage waveform that is centred at 2.5V should work fine.
The aspect that niggles me is that when the system is active (triac doing something), our meter's LED is nearly always 'on'. With safetyMargin set to 0, the system should be able to sit there equally well with the LED off. There appears to be some non-linearity in the system which is biassing it towards export. Measurements suggest that I could be losing around 35W, but it's difficult to quantify once the LED is showing export because there's no further information to go on. I noticed a similar effect when using the standard V & I sketch from the Building Blocks page. Any ideas what could be causing it?
I rather like the stripboard layout tool. Is that a freebie?
RW: "You can look at the report on the Mascot adapter to see how to check your transformer."
Robert, your report on the Mascot Transformer is an excellent source of reference and I have studied it in some detail. However, without access to specialised test equipment such as a Variac, I can't see any practical guidance about how to check my own transformer or AC/AC adapter for suitability.
Sorry if I've missed something ...
The 40 A triac can be protected somewhat less expensively, but the fuse still costs more than the device it's protecting.
The 40 A triac can be protected somewhat less expensively, but the fuse still costs more than the device it's protecting.
So just treat the triac as a disposable item ?
Calypso_rae & stuart,
Yes, I admit it's not easy to tell which transformer is going to be 'best'. It is compounded by the fact that in the UK we have some of the highest system voltages. The UK supply still centres on 240 V and may rise above 250 V, whereas most transformers made for international markets seem to be designed for 220-230 V, so when used in the UK they are already working above their optimal design point (and distortion and losses increase rapidly once saturation sets in).
How much it concerns you should depend on what you want to use the measured values for. In your particular case, you need what I would categorise as 'medium' performance: You are balancing a moderate and continuous generated current against 12 A 20 ms pulses of load, so reasonable linearity of power measurement from 0 to 20 A at whatever voltage is desirable. Provided the voltage dip due to the load is negligible, knowledge of the absolute voltage is pretty much unnecessary ( viz. balancing 240 J against 240 J is the same whether the 240 J is 1 A @ 240 V for 1 s or 0.5 A @ 120 V for 4 s), but if the immersion load does cause a significant dip then you do need to know.
However, if you want an accurate measure of energy consumption, which is a laudable goal, and especially if you have loads that distort the waveform, then an accurate representation of the mains voltage wave will enable that and give you an accurate measure of power (and conversely, a heavily distorted sample of the voltage wave won't).
You don't need a Variac unless you want or need to evaluate the performance of your transformer at different voltages, and you don't need to sample the raw mains unless you need to see and measure the phase shift. Most computer sound cards can take an input of up to 1 V, so a resistive divider to reduce the secondary voltage, a couple of diodes to protect the input, and the free download 'scope will allow anyone to view the mains wave and check what it looks like (and the 'scope program I used has a generator built in, so you can see what a pure sine wave should look like as a reference).
We do know that the very small pcb mounting transformers can suffer a high degree of distortion due to their limited physical size and the designer's desire to push as much power through as possible, so these are best avoided if accuracy is paramount.
And yes, Stuart, it would be a 'commercial' decision to treat the triac as disposable - though not a sensible one unless you're able to replace it easily!
[Edit] A 6 A Type B MCB would protect the triac, but that would trip once you got above half power (and yes, it would carry 12 A for several cycles without a problem) and you'd need to intelligently limit the power to 50%. And you could not have a by-pass switch.
Thanks for sharing the project & the video; I've also been 'lurking' for a while looking for a neat PV to immersion solution and reckon this is it! I've taken a look at the code and ordered the bits so will let you know how I get on.
From what I understand from how the circuit works, is it correct that even the resistors on the AC side (360R and 300R) will only see a small current so low power electronics type kit (0.25 or .5W) is going to be fine?
I'm also planning to (eventually) put some code in the -ve 1/2 cycles to check immersion temperatures (I want to heat a hot water tank + a CH buffer tank) and switch the output to two different immersion's using a relay.
Also thinking about a simple output display to show what's going on (something like http://www.oomlout.co.uk/lcd-display-16-x-2-p-212.html), but maybe has to be coded outside the 1/2 loop given time constraints...
Hi dm, reformed lurkers are most welcome
Yes, those resistors only need to be low power. I didn't have the exact values so found a couple of parallel combinations that would do instead. The ones that I've used are 1/4 Watt. I don't know what temperature they run at, as I prefer not to touch them!
The negative half of the cycle is a great place for additional code. I've played around with LED- and neon-detection there. The extra code does not appreciably delay the measurement flow because it uses digitalRead() which is fast, unlike analogRead() which is slow.
As an alternative to a relay, you could run two triacs. If you want the header tank to only start heating once your DHW is up to temperature, the Arduino could do this automatically. Just declare two threshold levels a few hundred Joules apart. While the first tank is heating, the system will sit at the first threshold level. Once the first stat opens, the energy will immediately rise to the second level whereupon the second triac will come on. I think this is a really neat approach, but sadly not my idea :(
Not sure about the display side of things. There's not much time for Serial operations in this code ...
This is my first post so I hope that I haven't misunderstood what this is all about.
By profession, I suppose I could call myself an electronics engineer as I provide applications support for a large American equipment supplier who make silicon chip test equipment. I'm well versed with high speed testing of mixed signal chips but my forte is not in power electronics at mains voltage. I do a lot of programming of the equipment but am versed in original C rather than C++. Last Novemeber we invested in a 3.5KWp PV system with micro inverters. It suddenly dawned on me how much money I am wasting by returning power to the grid and then using gas to heat the hot water cylinder. Then I discovered what a PV dump controller was and then stumbled across this site. Then I found this thread. Like the previous poster, I decided that this probably is the holy grail of control.
I've never programmed a micro controller or, for the past thirty years or so, had a need to work with mains power control. Both are a bit daunting but would seem to be just waiting for experimentation in an immersion control application.
I have dual EnviR monitors and these correlate very well using optical pulse read back against the PV meter. They can be a bit problematic when sent via the smartbridge to the web because the smartbridge has a habit of freezing. I find them absolutely useless when exporting energy because the led stays green and doesn't register anything useful.
So, what I would like to do longer term is to build something which controls the immersion heater along the lines of what Calypso Rae has been doing (great design by the way) while still offering an output to a display so that I can more accurately measure power returned to the grid. I don't really want to have a PC running all of the time as this defeats the purpose of saving power. The electronics will most likely end up in the garage but I would like to have my display inside the house. I suppose I could have a wireless link to the display advocated on the forums or I could drill a hole through the wall and have it on a lead. Within reason I am not too bothered about the cost. I see this as partly a cost saving exercise but, equally importantly, something of a science project. So I am wondering if my best starting point is a basic arduino or if it is better to go with the nanode and have integral wireless and a few extra bits. I assume that both units will work with raes software? I also assume that the system on this thread is designed to run without an output of any form (aside from in debug). Do you see any issues with interfacing with a display unit so as to offer a dual purpose function? I'm in the middle of my holiday at the moment but using every opportunity to learn (between dodging rain showers and eating cream teas) and plan to buy the hardware very soon after returning. Any thoughts and suggestions would be gratefully received. If I ever come up with anything of use, I will happily contribute it to the forum. Thanks Ian.
Hi Ian, you seem to have got my project well sussed!
As you've noted, I'm just using a basic Uno and there is no permanent display. My Mk1 version had four LEDs which came on to show the quarter-power levels. They could be easily be reinstated, but I don't really see the need. As long as the on-board LED is flashing in synchronism with the triac, that does me fine.
The system is intended to sit right on the balance point between import and export so no power should be returned to the grid. For reasons that I've never understood, this does not happen. Whenever the triac is distributing power, the meter's LED is invariably on which shows that we're exporting - unless, of course, I happen to be videoing at the time!
At low powers, the sensitivity of the system seems to be less than when a kW or two is available. If you can think of any way to shed light on why this non-linearity may be occurring, that would be a great contribution.
Go easy on those cream teas ... Calypso
`just a thought robin, have you tried out stuarts modified version of your code which is hosted on github.
In theory, there is enough voltage available in the emonTx to drive the zero-crossing opto-isolator that Calypso_rae uses. (The emonTx runs off 3.3 V, Calypso-rae used the Arduino running at 5 V, it just needs one resistor changing). A manufacturing engineer friend wants almost exactly the system you describe so I'm just about to start looking to see how practical it will be to measure two currents, the system voltage, drive three triacs - he has 3 hot water tanks - and report the data for display and logging. That's all!
The emonTx is the same processor as an Arduino - apart from possibly a few very minor changes (I think the LED is on a different pin, I haven't checked the analogue signals!) Calypso-rae's software runs fine on an emonTx.
`just a thought robin, have you tried out stuarts modified version of your code which is hosted on github.
No, what does it do?
The modified code is here https://github.com/stuartpittaway/ArduinoSolarPowerController/tree/maste... I dont really understand it but i think he has tried to speed things up a bit, I jusst wandered if it may fix your led on the meter issue.
Woudn't bother with that code yet, going to pick this project up again tomorrow night when I get chance, unfortunately DIY house decorating is getting in the way!
Robin, I've not watched the video, does your meter have 2 LED's or just one - does it solidly light when theres no export/import - i.e zero power ?
I'm tempted to get an electrician in to install an export meter on the meter tails to see whats going on.
I have just set up robins circuit with a kettle connected instead of the immersion. With 800watts of solar this equates to about 300 watts of spare power, it took just 15 minutes to boil the kettle. I tried stuarts modified code and still noticed the led was lit on the meter.
Many thanks for the positive comments everyone. This all looks pretty interesting and is getting even more interesting as I read further.
I'd like to think about a work breakdown approach and see if I have missed something obvious:
It seems like the way for me to go forward is to invest in an EmonTX together with a voltage and a current sensor. That way I can accurately monitor power and direction on the grid line. These should interface directly into the EmonTX without needing to add in a burden?
It should be possible to take Calypso's isolator and driver circuit and code and, possibly with some calibration tweaking, make this work with what may be a slightly different sensor front end to what he has. Then, I assume, by changing the 180 ohm resistor so as to maintain the correct forward current, I should be able to drive the MOC3041 and the triac.
I could, if I felt flush, attach a second current clamp to the load circuit and see how this is being modulated with varying PV. The same can be achieved with a kettle and a long wait, but, with minimal cost, it provides an additional debugging method. Also, in the long run, I may be able to integrate this sensing and a pair of temperature monitors to properly measure power sent to the immersion and the temperature of the tank. (My wife thinks I am becoming more and more "sad" by the minute :=) ).
Once all of this is working I could then add in an EMONGLCD and splice in code to direct whatever I wish to the display. Well, I hope so, anyway. What isn't clear to me at the moment is how to splice the data into the EMONTX stream and how to intercept that data using the EMONGLCD. Is the data sent as defined transmission packets with names defined by the EMONTX code and then those same packets need to be read by the EMONGLCD or are the naming conventions for the packets fixed?
I just had a read of a website which introduces the concept of coding these micro controllers. In principle, it looks reasonably straight forward. The trick is knowing how to use the libraries which have been written to do more complicated tasks. Practise will make perfect... or, more correctly, better code.
I'm dying to open my wallet and buy some bits and have a play. We're back home early next week and I want to order the stuff ahead of time. Suggestions as to what I need to buy initially and from where are much appreciated. I'm more than happy to buy through the site if that makes sense and helps them out. Always good, I think, to support those who have supported me.
Robin, just a thought, but have you tried running the code with a positive "hole" in the bucket ?
i.e. force the energy levels up until you start to import again ?
How do you know the meter is still exporting - is it just because the LED is lit?
This PDF, http://www.meterspec.com/143.pdf
A red test output LED is provided which pulses in accordance to the following configurations:
The test indicator pulses are 40ms wide. The pulse value is 1000 p/kWh for all meter ratings and is marked on the meter nameplate. The LED is not modulated.
Although not your meter, this is interesting... http://www.pjwmeters.com/pdf/CM-AM-Manual.pdf
Anti creep occurs if an average power of 12.5 watts (+-20%) or less is detected for a period of 4
minutes and 48 seconds. Activation of abti-creep is indicated by the red LED being
continuously lit. This function is reset as soon as the average power over 4 minutes and 48
seconds exceeds 12.5 watts (+-20%); the LED then returns to pulsing as normal
That makes sense as my solar generation meter led is constantly lit red at night when no electricity is being generated. So a constant lit led on the main house meter is good when the controller is running.
Robin, I've not watched the video, does your meter have 2 LED's or just one - does it solidly light when theres no export/import - i.e zero power ?
Stuart, it just has the one LED, which blinks when importing and stays on continuously when exporting. When balanced (import = export), the LED can either be ON or OFF depending what happened most recently. But, after a short while, the LED invariably comes on which suggests a bias in the export direction.
I'm tempted to get an electrician in to install an export meter on the meter tails to see whats going on. Sounds a great idea, then you would really know what's going on. Could take a while though to recoup the expense ;)
With my Mk1 build, I did try the '+ve hole idea, but haven't done so with the Mk2 version. When no current is flowing on a test rig, I see no leakage, so it would seem unhelpful in that situation to be purchasing energy. But the combination of having a '+ve bias' towards import, plus monitoring the LED to 'pull back' if the flow of LED pulses gets too great, could be a promising combination
On my Landis meter, there are two types of chargeable events: 'PULSE' and 'going ON'. There is no charge when the LED goes off. When it crosses a threshold for which you have already been charged, there is no additional charge providing that you have not dropped below the next threshold level in the meantime. It's easier to explain in a diagram than in words, I must draw one. Or just put the kettle on and off a few times while running my meter analysis tool (requires an LDR, resistor and capacitor)
madmurg: The LED on our generation meter is always ON at night. I presume this is because of the small flow of energy in the backwards direction
So my measurement of 38mS using millis() was not far out then :)
"The LED on our generation meter is always ON at night. I presume this is because of the small flow of energy in the backwards direction"
I've connected a spare Efergy meter to the line from the inverter to monitor generation at my desk (also programmed the gen & fit tarrif so I can see what I'm earning!), at night it shows 50 watts on the move (the efergy cant tell the direction), I presume the inverter needs some mains power to monitor when to switch on etc.
Also I've got a test rig mostly running and am using a PCB transformer for the AC ref, it's one of the Vigortronics ones Spirotronice sells its a 3VA - 9V one and gives a nice clean sine wave O/P, I havent checked phase difference as yet but it looks like it's doing the job OK.
To thansfer to "real life" do I only need to comment out the one line- #define DEBUG to be up and running? I did this and was able to drive a 60W bulb and could check the CT was working with a load on an extention lead.
One last question, how do I post pictures on this forum? I've got some on photobucket to share.
Just click on file attachments, then click on choose to attach the file you want, then click the attach button and tick the list box and all you have to do then is press save.
"how do I post pictures on this forum?"
"how do I post pictures on this forum?"
Click "File attachments" below the edit window, attach and upload the file(s), then before you post ("Save") make sure List is ticked for each.
[Edit - OK, beat me to it whilst I was writing the post ]
"I presume the inverter needs some mains power"
"I presume the inverter needs some mains power"
The 50 W quiescent load for the inverter sounds about right - it needs to keep alive to monitor both the incoming mains and the PV output as it can only invert when the mains is present (because the supply company gets excited if they think they've isolated the supply and then you feed in, and if I was a linesman in the bottom of a muddy trench, I'd understand why).
I have just completed my controller, next job is to screw it to the wall.
Looks like a very neat piece of work. I am very impressed
Any transformer will have a non linear zero cross. If you want an accurate voltage sensor it has to direct from the mains.I have spent hundreds of hours trying to use a transformer but defeated by the nonlinearities however big the transformer. You will find that it is voltage dependant as well. It is possible to design a safe voltage sensor using a y capacitor and a large resistor. the phase advance is more critical than you think and has to be determined to better than 100uS to achieve less than 10W export.
I don't think some of your assertions are entirely accurate. Can you elaborate please?
Please post a circuit that complies with regulations that does not need at least minimal isolation.
"It is possible to design a safe voltage sensor using a y capacitor and a large resistor."
I am testing a system that is based in Robins design with a small transfomer and it works, it's not that critical a componant.
And if I were worried about 10W of export, then I would be worried about my sanity.
attached voltage pick off from my circuit. for your circuit 100k would need to be reduced to 22k and referenced to 2.5V ( could be done by zener ref from 5v supply) to produce approx +.5 to +4.5V. transorb zeners would need taking down to 5V. without the cap across the 100k it produces an advance of approx 0.5ms. the cap is used to trim the advance to the CT in use which you will do in software and so it is not required.
regulation requirement as I understand it (please correct) is
earth leakage should be below 3.5mA (75uA or 10uA for medical NA here)
discharge should occur in less than 1 sec
safety assement of failure modes should not result in a live chassis
dc isolation of 1M tested with 500V is usually carried out but technically only applies to personal appliances not fixed professional equipment which this is otherwise it would have to comply with harmonic current limits ( not ecconomically possible with triacs and 3KW )
In my case the discharge is provided by the EMC filters 1M discharge path if you are operating without a filter then a discharge resistor would be needed. the 4.7nF cap needs to be y rated so it is self healing or does not fail short circuit.
in reponse to you declaring me insane I should have said 10W of error rather than export. unfortuantely lots of liitle errors when not understood add up to big ones I had over 200W of export under some power factor loads ( air source heat pumps ) to start with. I had to design using a phase controller first to understand where the errors are coming from as the burst fire produces over a 100 times bigger devaition in power which is difficult to measure and work out what is happening. having reduced the errors to just component tolerances and understood where they come from a monte carlo analysis suggests an export offset of 25W and max export of 50W for the phase controller will produce a robust system ( no trimmers ) and no meter creep. single or half cycle ( not sure if legal ) burst will work with the same values and has been verified by meter trials on my system. The sample rate you are using will limit the power accuracy with some house loads so I suspect the offset will have to be higher to avoid import although I have found with disc meters reverse and forward creep due to load changes tend to cancel as the mechanical latch doesnt immediately kick in. digital meters anti creep can also be exploited but there is little documented by the suppliers
Is there a good reason to physically separate the TRIAC from the MOC and the MOC from the other low power components in this design? I can imagine there's quite a potential for induction from the TRIAC switching on/off at HF which could I guess upset the digital/processing side of things?
My plan was to put everything in a single box with mains voltage at one end, the MOC in the middle and the low power at the other... is there any theory or prior discussion here anyone can point me to? Many thanks!
Rae: My system is hydro unlike most on this forum and I wonder if that makes any difference if using a power diverter. Lets say I am producing minimum power , 500w (about 10%) and there is no house load. The resistor bank will be switched on once a second for 0.1 sec and off for 0.9 sec. Running under no load for 0.9 sec is a long time seeing as G83 switching has to kick in within 0.5 sec. Is the generator actually running at no load or is it (to use your bucket analogy) filling the bucket with power ready for the next burst? In which case where is the bucket? Or is the `bucket` really hysteresis?
"Any transformer will have a non linear zero cross. If you want an accurate voltage sensor it has to direct from the mains.I have spent hundreds of hours trying to use a transformer but defeated by the nonlinearities however big the transformer. You will find that it is voltage dependant as well"
"Any transformer will have a non linear zero cross. If you want an accurate voltage sensor it has to direct from the mains.I have spent hundreds of hours trying to use a transformer but defeated by the nonlinearities however big the transformer. You will find that it is voltage dependant as well"
This may well be true of all the transformers that you tried, but I don't think it is a universal truth. I've written quite a lot in various threads about this and don't intend to repeat it here, it comes down to the design of the transformer. It is quite possible to design and make a transformer with very high accuracy, and is indeed done for instrumentation devices. For most off-the-shelf transformers, waveform accuracy takes a back seat in preference to power, weight and cost.
You seem well aware of the safety issues, but many reading these forums may not be quite so aware as you or I, and may not realise the significance of Y-rated components. It is for this reason that the encapsulated mains adapter is generally recommended, and for most purposes the performance is adequate.
Verry sorry pmcalli, what I meant was that we can't expect the system to be 100% perfect and to try and achive that would be chaseing very narrow margins, no offence intended.
As for transformers I belive calypso_rae has said that after testing a few transfomers with his design he found it not to be a very critical componant in his circuit.
Calypso_rae's firing circuit works a lot faster than the 0.1 s / 0.9 s that you quote. Tests made and reported here seemed indicate that the energy transferred was the important factor, and the time scale over which this happened was not important. However, whether this is universally true of all digital meters is not known. I don't know how your generator is controlled, I think you would run at whatever load you can generate and feed into the grid for a few cycles, and when you have fed in enough energy to supply your resistor for one cycle, you run the heater for one cycle and recover the energy using the grid as the energy reservoir. Although the impedance you are driving into changes, unless you have a very weak supply I doubt you would notice the effect.
The 'bucket' is a concept, more than a physical reality. It's a number that is added and subtracted from according to the nett flow of energy to and from the grid. It does not matter what the house load is, the controller works on the nett energy flow.
In Calypso_rae's controller, although he is measuring power, the nett relative power flow is more important than the absolute value, so the transformer output waveform is less important than in absolute measurements. However, having said that, some transformers have an output that leaves much to be desired and are best avoided. I know of no way of predicting whether a transformer will perform well or not - it depends on what parameters the designer put uppermost. A transformer specifically designed for measurement will obviously have a more faithful output than one designed for an isolated power supply.
That makes sense to me: Isee it as playing with the hysteresis of the system:this may be inaccurate but at least I can visualise it (as an elastic band attached to a toggle switch- you can pull the band to a certain degree and then recover the energy. if you pull too hard the switch will trip and show up as an import pulse)
However I still dont see how you escape the .1 sec on .9 sec off routine. If you are restricted to 100 switches per second you could be on for 1 half cycle and off for 9 but that still limits you to 10% minimum use or maybe 30w on average systems. Not a problem for me as I would consider 100w steps to be fine. Of course if the time ratio of on to off is not relevant- only the amount of power shifted- then that makes sense too: the elastic band is longer than I thought.
Hi folks, just to clarify how my 'energy bucket' scheme works. It's really simple ...
During each loop of the code, a pair of voltage and current samples are taken at the supply point. These are multiplied together, with the voltage sample having been phase-corrected using PHASECAL, to get power. During each mains cycle, all of these power contributions (instP) are added together (sumP) and then divided by the number of sample pairs. That gives the average power over the 20mS interval. Knowing the average power and the duration gives the net energy flow, which may be positive or negative, during that individual mains cycle. This value is simply added to the contents of the energy bucket. That is the entire measurement algorithm, there's nothing else.
When surplus power is available, energy starts to slip away into the grid. This is measured as above, and the level of the energy bucket (energyInBucket) starts to increase. The distribution algorithm makes an on/off decision every mains cycle shortly after the bucket's level has been adjusted. If the level has reached the specified threshold level, the triac is set to go 'on' for the next mains cycle; otherwise it is set to be 'off'. Providing that the rating of the dump load is greater than the amount of surplus power, the energy bucket's level will sit close to the threshold point. If the surplus power suddenly ceases, then power distribution will cease too, well within 50mS. That is the entire distribution algorithm, there's nothing else.
This system will work equally well with PV or hydro. The rating of the dump load is not relevant; a larger load will just spend less time 'on' than a lesser one. If the amount of surplus power exceeds the rating of the load, the energy bucket will increase above its normal operating level (1800J). A second threshold point could then be used to turn on a secondary load, still using only free power.
The operation of the code is best analysed in debug mode by adding Serial statements wherever is helpful. Using the pause() function, the code can be halted anywhere while printout on the screen is analysed. cycleCount increases by 50 each second and is a useful benchmark. After ten seconds, cycleCount will be 500 so processing can easily be intercepted at that point using a simple test criterion.
Debug mode works fine when connected to real kit; it's just not in synch with the mains. If you setup a 10% distribution ratio in debug mode (surplus PV = 300W; immersion rating = 3000W; safety margin = 0), you should see the triac coming on for approx 10% of the time.
noah: However I still dont see how you escape the .1 sec on .9 sec off routine. If you are restricted to 100 switches per second you could be on for 1 half cycle and off for 9 but that still limits you to 10% minimum use or maybe 30w on average systems. Not a problem for me as I would consider 100w steps to be fine.
My Mk1 system was limited by the operation of the external power controller, a Carlo Gavazzi. In its mode 2, Carlo would distribute whole cycles evenly over a 64-cycle window. That imposed a fundamental resolution limit of a percent or two. The main problem with that setup, however, was that I was predicting how much surplus energy would be available during the next second or so. If someone turned the kettle on, Carlo wouldn't know ...
Mk2 makes no predictions. It simply records how much energy has slipped into the grid. After a certain point has been reached, it says "Right, that's enough", and turns on the triac for one whole cycle only. The same process is repeated every mains cycle. For a 3kW load, we're talking 60J per mains cycle. That's well within the 3600J window that most meters appear to allow.
While power is being distributed during daylight hours, it seems likely that our meter is entering its anti-creep mode. By definition, therefore, no power is slipping away. Previously I thought that we were permanently exporting. Although the LED is constantly 'on' in both conditions, the anti-creep mode explanation seems to match the observations better.
rae I shall doubt no further. I can follow you circuit diagram in a lego sort of way however I see that the voltage sensor bit is less complex than on the `measuring ac voltage` page ie no resistors to add offset. Has this been left out for some reason or is it not needed as same function carried out elsewhere?
Please, someone ask me a question about hydropower so I can look less uninformed!
Hi Noah, Robin has a more elegant way of getting the offset voltage, he is using the op amp, the two 12K resistors at it's input are the divider and the o/p gives a very stable offset voltage.
Fuses. I wanted to check my setup recently at something over 3kW so decided to run both the 3kW kettle and 1.5kW hot air blower from a double adapter. OK, so the fuse is only rated at 13A, but I only want to run them together for a couple of seconds ...
The kettle started up fine, as it has done many times before, but when I switched the blower on as well, something popped. Having listened to all the debate about the way that fuses may operate, I was rather impressed that this one had ruptured so quickly with just 50% overload.
The fuse in the adaptor was fine, so it must be the one in the plug. When checked inside the plug, the fuse had indeed failed, its rated value being ... 5A !
I can think of 2 good reasons why it was a 5 A fuse.
1. The cable and/or adapter is only good to 5 A, or
2. Somebody had 'borrowed' the 13 A fuse!
More amateur questions; the components listed such as moc3041 seem to come in variations:
Are these variations important? Don`t want to buy the wrong bits.
I take it from 40A rating on triac that running 2 3kw heaters in paralell wont be a problem (as long as triac is well cooled)?
"I take it from 40A rating on triac that running 2 3kw heaters in paralell wont be a problem (as long as triac is well cooled)?"
"I take it from 40A rating on triac that running 2 3kw heaters in paralell wont be a problem (as long as triac is well cooled)?"
Read up my comments on fusing and protection. A 40 A triac with a 13 A fuse might just survive a short-circuit in the heater. With a higher rated fuse, it almost certainly would not. In any case, you would need a good heatsink as each triac can dissipate about 13 W when firing continuously.
For the triac, you want the TOP3 package, 600 V insulated, 50 mA sensitivity, i.e. BTA41-600B
For the LM358, the standard 'N' suffix should be fine (8-pin DIP, 0 - 70°C) The 'A' version has slightly lower offset voltage and current, and a lower input bias current.
As always, the data sheets are your definitive source of information.
I havn`t closely followed the fusing debate as my (probably well outdated now) experience from early music transitor amps was that semiconductors would always die before any fuse could really get going. That said, I would think that the chance of a short in an immersion heater is pretty low as long as you don`t go bending it.
I`ve often found useful information on data sheets but, unsurprisingly, they assume some degree of background knowledge and the simplest thing to aficionado can be pure gobbldygook to a tyro.
My, that's a lot of spare power that you're intending to divert!!
If several appliances are connected in parallel, the triac wouldn't need to dissipate any more heat because its 'on' cycles would occur less frequently. The video that I posted recently shows this concept in action. The flash rate of the light is dependent on the combined load of the light and heater. When the heater is turned up (two bars rather than just one), the flash rate drops because more energy is consumed for each cycle that the triac is 'on'.
Fully heating up one tank first and then moving on to a second appliance sounds a good idea to me. The algorithm can do this very easily by defining two threshold levels rather than just one. To get more heat into our tank, I may add a pump which comes on whenever the energy bucket gets to the higher level. The effect of the pump would be to stir the water in the tank thereby cooling the thermostat so that more heat could be taken on board.
But we don't know how much power is available. Does the 16A limit also apply to hydro? If it does, then yes, the heat sink needs to be no bigger. But if not...
It's about what you want to drive with the triac in this case it could drive a fan oven (9.6KW) with sutable cooling. A 3KW immersion only takes 12.5 amps.
I have two hydro systems, a waterwheel and turbine. The waterwheel produces domestic single phase with a max output of 5.5kw . The turbine is 10.5kw 3phase. Both grid connected using induction generators. The ww is connected under G83 (even tho output is 25a): DNO`s have discretion on this depending on the state of the local grid.
My house, for forgotten reasons, has two seperate heating systems; 2woodburners with back boilers,2 sets of rads and u/f pipes and 2 immersion heater tanks. Hence running in paralell so all of house is heated.
My plan is to make up two small IH tanks- maybe 15/20ltr- with 3kw elements and attach them in paralell to the back boilers. The existing ch pumps will then distribute heat around the house. Hence running in paralell so that all of house is heated.
One disadvantage of this system is that if you are feeling cold and plug in a heater you wont get any warmer until your plug in load exceeds generated power.
Compared to most solar this is a large output. But it needs a lot of looking after. Good excuse for not leaving home.
Noah the "N" sufix just says it' the 8 pin dip package normaly we just use LM358, just being lazy!
If you go to Spiratronics web site there are links to data sheets for most products they sell this where Robin and I got our parts.
As for the triac the "BTA" denotes it has an isolated tab so no insulation washer needed just some heat conductive paste, I'm earthing the heatsink as a precautionary measure, if it were to go live then the CB in the consumer unit would trip, I think the idea of protecting the triac is a moot point as first as a 40 amp device its going to be pretty robust and if it fails it will more than likely go open circuit in a very short time and is replaceable. After all light dimmers rely on the consumer unit if they fail, all we are working with is a big light dimmer.
As for your heating idea I see no problem useing it as you surgest. In a more conventional gas central heating system still useing Roberts circuit to pre heat the the circulating water in the system would work, then the gas would be used to top up what you pre heated.
One thought I had was to have an air source heat pump type air conditioner/heater this would need to be switched in at a set generation level and have a longish hysterisis so it remains on for a practical time for you with the hydro system generating a more predictable o/p it could work quite well, as modern units will provide around 3.5KW o/p for around 1KW electrical i/p, and in the summer when the water is heated you can switch over to air con cooling.
"One disadvantage of this system is that if you are feeling cold and plug in a heater you wont get any warmer until your plug in load exceeds generated power."
I'm not sure what you are saying there, can you explain a bit more?
(posted this an hour ago but hasnt appeared. I`ll add some more anyway)
Plumbing I can handle.
HSP would be good especially with river nearby to extract from. But, baby steps.
If you plug in a heater the diverter will see this as another household load and reduce power sent into your i/h. If your i/h is part of central heating (rather than just hot water) this reduces your ballast heat to balance new load. Its only when you plug in more than whats available from home gen that you get more heat.
Hows about this for a ct with inbuilt burden:
If I were using this one, I think I'd go for a smaller burden resistor to keep the phase-shift down ...
I would have thought with the water wheel giving 25A and being a depenable power source you would have no problem running the 3KW (12.5A) immersion and another heater, but you could find some way to check if the immersion stat has kicked in before diverting to the heating system, it's just a matter of choosing your priorities.
And I think that CT looks too cheap to be true why not stick with the tried and tested SCT-013-030? it has a built in burden, I got a couple from China they took a while to arrive but I belive there is a UK supplier someone is bound to post who they are.
It's quite possible then that both triacs will be on solid for a significant time, therefore you DO need a heatsink rated to about 25 W.
"One disadvantage of this system is that if you are feeling cold and plug in a heater you wont get any warmer until your plug in load exceeds generated power."
Not true. Calypso_rae's controller will automatically throttle back on the power being dumped to the controlled (immersion heater) loads in favour of any other house load. If you're not generating enough, you will import to supply the demand and no power will be dumped to the controlled loads.
Triac: "a 40 amp device its going to be pretty robust" - maybe, but not robust enough to guarantee to trip a 16 A MCB or blow a 13 A fuse under all conditions and survive. Check the data sheet and compare the I2t values for the triac, fuse and MCB.
"but you could find some way to check if the immersion stat has kicked in"
There's no need to check the tank thermostat. If the "energy bucket" continues to fill, the 'stat has opened (else the heating element has died or a wire fallen off ! ), and you leave that triac turned on ready for when the water cools and fire the second triac as well on a threshold that's 2 cycles worth of dumped energy higher (about 120 - 150 J). And so on. If No.1 takes the load, the "bucket" will empty and heat No.1 in preference to No.2, which will turn off as No.1 maintains the "bucket" below No.2's threshold - unless of course you have more spare energy than No.1 can consume, when No.2 will take what it needs to balance. And if No.2 can't use all the power, you export.
It's always interesting to hear other people explaining how my system operates.
On this occasion, RW scores full marks :)
Robert the point I was making about the triac is in the case of it's failure, at that time protection is secondery and to protect the house wiring, if it goes short and stays that way it will not blow the trip but will just leave the immersion on till it reaches temperature (as it will be importing).
This senario is unlikly as it's more likely to blow open than go short.
The third senario is if the triac tab goes live it will send the heatsink live so it must be earthed in order to then blow the trip.
What we need is some way of monitoring the condition of the triac, mayby a neon accoss it so if the triac is short the neon is out and if the Arduino can detect "neon off+PV below threshold=alarm" and if the triac goes open then "neon on+PV above threshold=alarm"
What do you think?
"It's always interesting to hear other people explaining how my system operates.
On this occasion, RW scores full marks :)"
.............and I'll take the wooden spoon, said I was a noobie!
The i/h elements paralelled to c/h system would be the dump load: when no other circuits are switched in then all excess goes to them. I/h`s in hot water cylinders switch in an out as per normal demand. As there are two in the house I have wired them with interconnecting relays so that only one comes on at a time: no need to have them both on at the same time and (probably) import to make up shortfall.
Surely one 40a triac will suffice for a 6kw load? There is no need for any `stepped` output to my c/h elements. If say for an appreciable time only 2.5kw is going spare then only half the house will be heated. Better to share whatever power is available between the two.
If there is 4kw being generated and no other household load then 4kw goes into c/h system. If you switch on a 2kw fan heater then 2kw will be subtracted from the c/h leaving total heat still at 4kw. So if you are really cold you would need to plug in 4kw+ to get EXTRA heat.
I`m quite happy to go with the SCT-013-030 but as its rated at 30a wouldnt it be damaged by a possible 60a houshold supply?
We are looking, if I understand correctly,for a CT which will handle the max that could be sent through it (for normal house 100 amp?) with a low burden to minimise phase shift. Must be a perfect candidate out there somewhere.
The CT should be positioned just after (ie load side) of the import meter before consumer unit and home gen input, correct? In my case that means a distance of maybe 20m between sampling point and dump load. Would a 20m cable between these points introduce too much voltage drop? I`d rather run a cable containing 2.5v and have the switching done close to the load as opposed to running a 6kw cable - which would have to be 10mm armoured as the run is actually between two buildings.
Yes you are right, the 030 is 30amp, doubt if any damage would occur but may give non linier o/p, there is a SCT-013-060 (60A /1V version) or the SCT-013-000 current reading version that you would have to choose your own burden resistor value to get the voltage you need.
thanks richmc. I am easily confused. I shall set about acquiring one of these SCT-013-000 beasties and reread the resistor pages.
Wait up! Surely that should be STC-013-100? Ah but 000 seems to be their code for current output. See how easy it is to get confused.
Regarding unreliability of clamp ct`s.
I`m having a meter change at the end of the month and could use the opportunity to slip a ct over the tail. I guess this would be more reliable. Any downside? if it stops working I can always go back to a clamp.
OK Robin & Robert,
I'm into testing. I'm using a 60W bulb as my load and a seperate 60W lamp to give me a signal for the ct side. After letting things settle down I switch on the simulated PV o/p at sample 5005, the bucket graduly fills till at 7505 the load lights (1724 in bucket)
All is good so at 19005 I switch off the PV lamp but the bucket remains at 3600 and the lamp stays on until I press reset then the bucket sits at .3 to .6 ish and the lamp stays off. So something is not right.
I'm guessing things are working but where do I go from here?
By sample I mean cycle.
"What do you think?"
"What do you think?"
You monitor the triac, then what? Do you intend to set an alarm or send yourself a text message? The possibility of it happening is fairly slim and I'd go for waiting to realise something was amiss then fault-find rather than adding the complication of extra devces, inputs and wiring etc. KISS and all that! But that's only my view.
But yes, you really need to insulate and guard the heatsink, or earth it. Personally, I'd go for the insulating washer, nylon bolt and a solid earth to the heatsink. Then you have two layers of insulation to fail before an earth fault can develop.
"and I'll take the wooden spoon," Don't worry too much - I've been doing industrial electronics and control systems for 40+ years - I've had a bit of practice.
Yes, the 40 A triac will support that load - I got the impression that you wanted to control the central heating load in preference to (or maybe the other way round?) the hot water load.
The CT should be positioned just after (ie load side) of the import meter before consumer unit and home gen input, correct? In my case that means a distance of maybe 20m between sampling point and dump load. Would a 20m cable between these points introduce too much voltage drop? I`d rather run a cable containing 2.5v and have the switching done close to the load as opposed to running a 6kw cable - which would have to be 10mm armoured as the run is actually between two buildings."
I'm planning to solve a similar problem in a friend's farmhouse in rural Scotland by splitting the system between the emonTx/Arduino and the opto-isolator, joining the two with nothing more than a twisted pair of telephone cable. The opto current is sufficiently low for there to be no appreciable voltage drop (and if there is, you reduce the series resistor to compensate, and it all runs at 3.3 / 5 V, so no safety worries.
I think (without proof) that the YHDC c.t.s are all the same except for the burden resistor (or absence thereof). Have a read of my report and ask if anything isn't clear. I doubt that the c.t. would be damaged at 2x rated current - it's a ferrite core, not iron so unlikely to be permanently magnetised even.
In short, you can hang whatever burden you like on the c.t, but the GREATER the burden resistance, the GREATER the load you put on the c.t. That's opposite to voltage transformers. But you still want to keep the transformer loading to a minimum for best accuracy.
I'm not sure of your test setup. You need to be able to both generate and consume load through the c.t. to simulate normal working conditions. The bucket fills with generated energy, and empties with consumed energy. So if you have a test rig that only consumes (and you lie to the controller by reversing the c.t. so that it looks like generated energy), then you need to reverse the c.t. again to tell it about the consumed energy, and the bucket should empty.
[Edit] Reminder: when installed, the c.t. should see the nett energy flow into or out of your house. The idea of the system is to try to balance that down to zero. So you install the c.t. at the supply side of the point where the PV feeds in, and of course on the supply side of all the loads you have.
Thanks Robert the penny has dropped, you don't just stop filling the bucket you kind of syphon the power out. I just went through the routine again and instead of turning off the simulated PV I reversed the CT and it "sucked the bucket dry"Apart from that is there any other set up I need to do for the "real world"?
Attached picture of the rig so far-
Splitting the circuit: does that mean extending the wire leading to 1 & 2 (altering 180ohm resistor) on MOC3041 or extending from MOC 4 & 6 (altering either 330 or 360).
Or in fact neither?
So what is the best burden on the ct: 35, 150 or doesnt matter too much?
If I can end up with a system that settles on importing or exporting around 100 watts and doesnt cause any other problems I`ll be well happy.
Just a reminder that the level of the bucket (float energyInBucket) is only affected by the measurement system. The sole duty of the measurement system is to maintain this variable which replicates the state of the supply meter. In 'normal' mode, the bucket's level is not adjusted within the code when the triac fires!
In parallel with the measurement system, there is a second system which diverts any surplus energy to a dump load, generally an immersion heater. Both of these systems work continuously, but they are not directly linked. The energy-diversion system checks the level of the bucket near the start of each mains cycle, just after the level has been updated. If the bucket is sufficiently full, the triac (via its z/c trigger) is switched 'on' for the next cycle. otherwise it is switched 'off'.
The effect of switching the triac on is to reclaim some of the energy that has been temporarily stored in the grid. When that energy flows away from the house, it is measured as being exported which causes the value of energyInBucket to rise. When it flows back into the house, it is measured as being imported which causes this value to fall.
While surplus PV is available, the control system has feedback. The energy level will quickly rise up to 1800J but then won't go any further because all additional energy is diverted to the immersion. For a 3kW immersion, any surplus PV between 0 and 3kW will cause energyInBucket to sit at 1800J.
When using a test rig, there is no feedback so things are different. When monitoring the current taken by a 60W light bulb, the bucket's level should increase by 60J/sec and the 1800J threhold will soon be reached. At this point, the triac will come on and stay on. If the 60W bulb is turned off, the bucket's level should stay just where it is, with the triac remaining on. There are a couple of easy ways to manoevre the system back an forth across the all-important threshold level:
1. Reverse the direction of the CT. The energy level will then fall by 60J/sec as energy is 'sucked out' - nice one richmc :)
2. Set safetyMargin to, say, 50W. This acts as a leak. When no current is flowing, the value of energyInBucket will fall by 50J/s, soon crossing the 1800J threshold at which point the traic should turn off.
Neither of these approaches will cause the triac to cycle on and off; they are both static. To make a test rig more dynamic, just recompile the sketch in 'debug' mode having set up the situation that you want to simulate (e.g. surplusPV_4debug = 1000, powerRatingOfImmersion_4debug = 3000, safetyMargin_watts = 0). The code will quickly ramp up to 1800J and sit there happily because of the action of the simulated triac (which only occurs in debug mode). It won't be synchronised to the mains, but the real triac should still rattle on and off which is fine for test purposes. Don't forget to recompile the sketch again in normal mode!
richmc: I'm into testing. I'm using a 60W bulb as my load and a seperate 60W lamp to give me a signal for the ct side. After letting things settle down I switch on the simulated PV o/p at sample 5005, the bucket graduly fills till at 7505 the load lights (1724 in bucket)
This all sounds fine, just what I'd expect to see when using a test rig where there is no feedback.
The lengthy printout line is for checking the operation of the low-pass filter which is clearly working perfectly in your case. It's probably time to comment it out and maybe replace it with something more useful.
Robert, I was thinking of a simple sounder or flashing led to show a triac error, as Robins circuit has no LCD (as yet) if it were to go short you might not notice till the bill came in, or open when you get an unexpected cold shower. I know the likelyhood of the triac failing is remote thats why I thought a low tech solution would surfice.
If the triac were to fail fully on, you would probably hear the immersion singing gently to itself. Then the thermostat would turn off and you would be pleasantly surprised to find hot water in the taps when you were not expecting it. If the thermostat were also to fail, the system would then start to boil and strange noises would be heard as it starts to belch steam and hot stuff up into the header tank.
Until our Mk 1 controller appeared, we hardly ever used the immersion and had no idea that its stat had failed. The replacement immersion came with two safety features. First, there's the stat which can be set as desired between 50 - 70C. Then there's a second mechanism which supposedly cuts off the power at 97C. I think you may have to manually reset that one if it were ever to operate.
If the triac were to fail fully on, it's no worse than someone just forgetting to turn off their manual switch after half an hour or however long they intended to leave it on for. Maybe they got sidetracked by the Olympics ...
That sounds good enough. But is it foolproof? No volts across the triac might mean the 'stat is open. You will then need a high value resistor across the thermostat so that you can tell the difference between an open thermostat and a short-circuit triac. But just a cautionary note that whatever you do might lead you into a false sense of security because there are other failure modes - the thermostat, fuse/MCB, the immersion element itself, etc. It's quite hard to test for failure. The only real test is the water temperature, is it rising when it should be? And even that's not foolproof because you could have cold water flowing in to hold or reduce the temperature.
Splitting the circuit: does that mean extending the wire leading to 1 & 2 (altering 180ohm resistor) on MOC3041 or extending from MOC 4 & 6 (altering either 330 or 360).
Or in fact neither?"
Splitting the circuit: does that mean extending the wire leading to 1 & 2 (altering 180ohm resistor) on MOC3041 or extending from MOC 4 & 6 (altering either 330 or 360).
Or in fact neither?"
I think you meant me?
The LED in the opto-isolator (Pins 1 & 2) connects between 5 V and the Arduino output pin (which is active low) with a low value resistor (180 Ohms) in series. It is those two wires to pins 1 & 2 that you extend the 20 m or so, keeping the opto-isolator itself and all the high voltage connections with the triac. So the circuit is 5 V rail, resistor, extended wire, opto LED pin 1; returning via opto LED pin 2, extended wire, Arduino output pin Dig 9. I doubt very much whether you'll need to reduce the 180R resistor. My original calculations showed it needed to be between 165 Ohms and 190 Ohms, so if cable resistance is less than 10 Ohms for the loop, there's no problem. Otherwise, you might want to come down to 160 Ohms.
noah, going back a page when I said heat pump air con I was thinking of this kind of thing.
So in the summer when the water is hot you get air con and in the winter it can supliment the heating, they make very efective heaters 4KW out for 1KW i/p power, as you have a consistant power supply (not relying on the sun) they may be of use to you.
The disadvantage of this sort of thing is that you get one big source of heat which is not good for a multi room house. Would be good for a workshop or somwhere thats just one space.
My house has got 2 ft thick stone walls and in West wales - you think I need aircon already?
Ha Ha! I guess air con would be surplus to requirements.
But a number of those units around the house could work, nowerdays we are tied up with the need for central heating and as heating units are very effecent. Just a thought.
Is anyone using or considering an LCD for Robins design? with overall power useage, export/import rate, generation and diverted power display. I'd like to incorporate that but know nothing about how to go about it. Robin has surgested that the print part of the code can go once the diverter is up and running, can it be replaced with somthing useful that won't delay the essential workings of the device?
As published, my code does two things:
First, it maintains an energy bucket (energyInBucket) which mimics the operation of the supply company's meter. Second, it provides a means of diverting any suplus power so that the energy bucket's level remains constant.
Energy that is diverted to a dump load is ignored by the meter because the net flow at the supply point is never large enough to cross the meter's chargeable thresholds. The supply meter could therefore not tell you anything about the effectiveness of any PV diversion scheme. The Arduino code, however, is one step ahead of the meter and could easily keep track of the amount of energy that has been diverted. For a 3kW load, approx. 60W will be consumed for each cycle that the triac is on. Just keep count of the number of 'on' cycles, and that's the energy that's been diverted (provided that the thermostat has not cut in ...)
The next problem is how to reset the counter each day. The energy level in the bucket can fall to zero for various reasons. One reason is that it might be midnight. Another is that someone may have just put the kettle on, or be taking an 8kW shower. To reset the 'diverted energy' counter, there would need to be some association with a real time clock, which sounds rather complicated.
One simple approach might be to monitor the LED on the inverter's front panel so that PV on/off periods can be identified. At its simplest, operation of the code could be suppressed whenever the PV is off. Then, when the PV starts up each morning, the code would be allowed to proceed with the 'todays total' set to 0. The total value could then be displayed every time it has increased by 0.1kWh, or whatever.
A better approach might be to power-down the Arduino each evening when the PV goes to sleep, but then it wouldn't be able to display anything. So, is is better for the system to stay live 24/7 just so you can ask it how much power energy has been diverted today? Or is it better for the system to switch off when the PV is inactive, thereby saving power. Personally, I favour the latter approach. I can always see how much sunshine there has been today by checking the inverter's display.
richmc on Tue, 14/08/2012 - 19:14. Is anyone using or considering an LCD for Robins design?
richmc on Tue, 14/08/2012 - 19:14. Is anyone using or considering an LCD for Robins design?
Yes, I've got one working a 16x2 LCD based on Robins original code, not quite ready to publish it yet, although a draft is on GITHUB (minus the LCD stuff!)
Just working through some phase calculations to improve my calcs.
Just taken delivery of a SCT-013-000 and I can see that it would be easy for the core to mis-seat. What immediately springs to mind is a stong elastic band.
Yep, a stonging good idea that Noah :D
Interesting design. I see you are using the same op-amp buffer and clamping diodes I used in my energy monitor design.
The clamping diodes need to be Schottky diodes. The abs max input voltage for the ATmega328P is vcc+0.5V. The silicon diodes you've used, IN4001, will have a forward voltage of slightly above this. Also, I don't think that you need such high current capability, that was why I chose the BAT43 diode.
I've only just come across this post. I've been working on my own power controller for a while. It uses a radio link to the controller, as I don't have an immersion heater (yet) and am looking at a kettle and an oil filled radiator as my load. I'll publish the design shortly.
I'm still not sure about the heatsink requirements. I started out with a large heatsink in the prototype, but it didn't get the slightest bit warm. I have now put the whole circuit in a small case and use the case as the heatsink. It seems to work fine, but a kettle isn't on for long. I've added an LM35 temperature sensor so I can monitor the temperature. Does your heatsink get very hot?
I opted for full phase control and a standard control loop using the import / export measurement, using a similar design to this
This allows fine control of the power applied. The zero crossing detector piggybacks on the 5V power supply. I'm also using the JeeNode rather than the Arduino because I needed the radio link. I get the import / export data from my energy monitor (see above) so I didn't need to provide that on the JeeNode itself.
Hi Daveb, thanks for the suggestion of alternative protection diodes. My use of the standard 1N4001 was simply as recommended by Glynn a good while ago.
My suggestion for buffering the reference voltage was posted at http://openenergymonitor.org/emon/node/673 on 10th May. At that stage, I don't think your design had been published ...
Your right, I didn't publish my op-amp thing until June :) You commented on my circuit, but didn't mention you'd already done the same thing! You should have mentioned it at the time. Apologies.
Schottky diodes are really useful when you need a low forward voltage drop. Not sure what the max current capacity should be, but I'd be surprised if it needed more than a signal diode.
I don't know if anyone has had problems with damage due to overvoltage spikes damaging the ADC inputs. I live in the town where underground power cables tend not to suffer the same spikes as ones on poles. It may not be a problem, but I felt it was best to be safe.
I noticed that there is a company selling a two terminal device to reduce the power of your immersion heater to half. I presume that this must be a diode. Your dynamic monitoring removes the need to do this of course.
Any thoughts on using phase control instead of switching on for whole cycles?
Do you think that electricity companies are likely to reprogram smart meters to prevent people from doing what you are doing?
Definatly NOT a diode, that would be illegal. It could be as simple as a 19ohm power resistor in a box with a price tag!
A resistor! A 3kW load looks like a 19ohm load, so two of them in series halves the current. But half the remaining power is dissipated across the resistor! Madness.
I found one here :
If a diode would be illegal, how about a triac using every other half cycle?
My 1.5kW Bosch hot-air gun uses alternate half cycles for its low-power setting, so this approach was presumbly legal 20 years ago or thereabouts. Maybe things have been tightened up in the meantime ...
Not for the fan I hope! I was going to try driving a fan heater with my circuit until I realised that the fan would probably not turn much at low power, which leaves the heater at risk of burning out, even at low power. You have to switch the power just to the element, which means taking the heater apart ... so I stopped there. I might get one of those oil filled radiators though.
Hmmmm, I got that little gem from the electricians forum in hindsight it does sound a bit daft.
And Daveb, reading the spec for that device it does sound like a diode i.e. "useing the device halves the power, adding another will not result in quarter the power."
Half-power diode - is it actually illegal? (Chapter & verse?) I know it's definitely anti-social and the power companies disapprove strongly because they don't like d.c on their transformers, and for understandable reasons.
My system, which is all up and running now (but subject to some calibration) is based upon Robin's design in that I have used his triac concept but with an Arduino. I am also using the principle of his software in that I use his energy bucket algorithm. He's been very helpful as I have gone through my design and bring up.
From that point on our methodologies differ as I have added additional functionality to my system:
My dump controller is about 15 metres away from the sensing point of the incoming power. I simply changed the resistor to 180 ohms (or there abouts ... I cannot recall as I cannot access the circuit given that it is mounted inside a lump of aluminium extrusion mounted on a block of heat retardant wood in my airing cupboard). It seems to work beautifully.
The arduino sits inside a plastic box and I have LED's which fire when the system believes itself to be in export or import mode and a third LED fires when the triac is energised. It was something of a doctor who moment adding all of those lights but I would thoroughly recommend this for anybody who is building a dump controller because the lights are immediate and not hogging time through serial printing (and there is nothing to read, just lights to watch). I can visually correlate operation between this and the LED on my house meter and see things working correctly. It also seems to provoke discussion as even my wife can understand what is happening simply by looking.
Finally, I have an emonGLCD hooked up using the RF12 interface. The emon acts as an energy monitor in that the energy bucket software that Robin wrote has been extended by me so as to monitor rms voltage and current and to calculate true and apparent power and power factor. All of this is transmitted by RF as a payload and I have written code for the emonGLCD to interpret this and to present it. The LCD display shows true power, grid voltage, grid current, temperature and the level in the energy bucket - all taken from the payload.
The power measurement algorithm was tweaked pretty thoroughly against an enviR optismart energy monitor on my PV. I managed to get a pretty linear scatter graph of emon measured vs enviR measured power but with a small offset. This was factored into my calculations. I have now moved the clamp to the incoming power feed to the meter and it is less accurate. I'm thinking that the problem is because the cable is much thicker on the incoming feed and so there is less air gap. the emon reads high now. Over the coming days I need to gather a load of data (not easy as I will be away on business today and tomorrow) but once I can build another scatter graph over a decent range I will adjust the metering algorithm in the emonTX.
Like the arduino, I have used the LED's on the emonGLCD (the whole thing is mounted in a plastic case) to tell me when the system is exporting rather than consuming power. My payload transmission is currently every few seconds so the data needs some interpretation but when we see the system alternating between red and green (and nothing 10W either side of zero) we know that there is spare capacity and we can turn on the washing machine or dishwasher or simply smile at the thought of the system heating our water for free!
You have some nice developments there, can you post up diagrams of how you've wireds the leds?
Ian, I'm pleased to hear that your system is up and running. Relaxing in a free solar bath is a great place to think of ways that things can be improved :)
Accuracy: I'm interested that you believe your measurements to be less accurate when the clamp is on the supply cable. That is the only place where I have ever monitored energy flow. Checking the output of the PV may be of interest for calibration purposes but doesn't achieve the effect of identifying surplus PV power so that it can be usefully diverted.
For the purpose of diverting surplus PV energy, the absolute accuracy of the measurement system simply doesn't matter. Adjust it either way by 50% or 100% and it makes absolutely no difference to the triac's operation. However, the linearity of the system is crucial because any non-linearity will cause the measurement system to drift relative to the supply meter. By non-linearity, I mean any distortion of the sampled voltage or current waveforms, including any phase-shift that is not being effectively cancelled out.
LEDs: On my Mk1 version, I had a Dr Who panel of freebie LEDs which showed how much power was being diverted to the immersion. Although it was fun to watch different coloured lights coming on and off, their presence did not achieve anything of practical use so they've not been reinstated. The Arduino's on-board LED, which flashes in synchronism with the immersion heater's neon, shows exactly what's going on. If it's off, there is no surplus power; if it's flashing, surplus power is being diverted; if it's constantly on, surplus power is not being utilised because the water is fully up to temperature and the thermostat has opened.
As I think I mentioned a month or so back (when I joined the website), I am just as keen to offer my endeavours as I am to make use of the endeavours of those who have kindly shared what they have done to a wide audience. In this regard, once the dust has settled and I am happy with the performance of the units and software I will happily publish something.
I work in the micro chip testing business but on low power high performance applications of DC, audio, digital and RF. The kit that we make to test silicon chips is in the million dollar region and it's a little like swimming with my hands tied around my waist when I work with Arduino. The problem is that its quite difficult to establish a certifiable measurement reference. There is no truely accurate meter within the system as everything is subject to relatively poor accuracy and error. I had to think about establishing my reference using external instrumentation. I cannot use the stuff that we make as a company so I had to make do with what I have at home. For the mains I decided to use a reasonably decent Fluke meter and trust that it was measuring sensibly. I also established the voltage reference used by the arduino with the same meter. I played a few mathematical ideas around measuring the voltage through the mascot and the potential divider but to no avail. In the end I had to put in manual attenuation factors for the voltage chain and the rms voltage that the arduino thinks is in my house is now stable and pretty close to what the Fluke sees. I guess I could have sampled the incoming signal and then done a fast fourier transform on it so that I could establish the distortion from the frequency domain. I've done this before with 8 bit processors but I'm not inclined to experiment with it again. Suffice to say, I've stuck with my manual calibration constant.
The next step is establish the true and apparent power. I calculate the rms of voltage and current over a sampling window dictated by Robin's energy bucket algorithm. I also run Robin's energy bucket algorithm at the same time. At this point establishing a known reference is a big deal again. During the past six months I have been correlating the PV generation data from my Elster AC100 generation meter with an enviR energy monitor which reads the energy pulses from the optical port. I have a second one doing the same thing on the main electricity meter. I also have the web portal which tells me how much energy the micro inverters in the roof think they are harvesting. On the assumption that the Elster is the most accurate instrument, this has to be my reference. From here I can tell that the Enecsys portal total energy generation is reading 2.8% high over the past 6 months. The enviR's are a bit problematic in that the smartbridge which takes their data and sends it Pachube and then on to pvout.org sometimes freezes. However, when it does work, its within about 0.5% of the Elster unit. Now, the enviR also has an energy monitor display which is updated every 6 seconds or so. Thus, if the enviR is accurate it's reasonable to assume that the energy monitor is displaying accurate data as well... certainly good enough for my needs. Thus, the enviR is my reference.
So, over several days, with a current clamp on the PV wire, I tabulated the instantaneous power measurements from my emonTX/emonGLCD display against those of the enviR. I was careful to ensure that both were stable before tabulation. I took about 100 points with power between zero and about 3KW (the most PV I saw during the interval). From there, with a little bit of help from Excel I was able to establish a best fit line. It was actually pretty linear and the slope was pretty close to 1. There was an offset and this was applied to the calculation and the whole thing repeated. The correlation was pretty good.
So, with all of this done, I boxed up my units and put the current clamp on the grid side. I now see an offset in power. The rms voltage looks fine but there is a problem. I am in the process of gathering data again (when I am at home at least) and will repeat the best fit line exercise and decide the next step. I read somewhere on here that an air gap on the current clamp can introduce all kinds of errors. The PV cable is 6mm plus a sheath. The cable from the grid is substantially larger and so the air gap is smaller. I think that this could be the cause of the difference as my readings are high. Any thoughts?
For a pure PV dump accurate measurement of power is not necessary. For my application, where I want to see imported as well as exported power (which should be close to zero!), I have to be able to sense the power reasonably accurately. I don't care if I am off by a few watts. I also don't care if I give back a bit more power to the grid than I could. As long as I am not paying to use the immersion heater I am happy. What I want to see is my emonGLCD giving roughly the same numbers as the enviR. At the moment, it doesn't and I need to address that. I also need to add a few additional features such as turning off the LED indicators on the GLCD when the room is dark. It's like Blackpool in the autumn at the moment! I want lights when the sun is out but not when it is dark. This is all cosmetic stuff.
As to LED's on the emonTX. I agree, the LED on the board is fine. However, my emonTX sits in a grey plastic box in the garage and the LED on the PCB is hidden from view. The LED's on the front are a bit gimmicky but they really help me to see what is happening !
My wife says that i need all the "help" I can get .... but that's a different matter :=)
"The PV cable is 6mm plus a sheath. The cable from the grid is substantially larger and so the air gap is smaller. I think that this could be the cause of the difference as my readings are high. Any thoughts?"
"The PV cable is 6mm plus a sheath. The cable from the grid is substantially larger and so the air gap is smaller. I think that this could be the cause of the difference as my readings are high. Any thoughts?"
I doubt that centering the cable within the c.t. core is likely to be a big problem, I checked for but could not discern any change when I tested the YHDC c.t. A much greater problem is likely to be aligning the two core halves and making sure there is no air gap in the magnetic circuit of the c.t.
So it might be that your earlier readings were low due to this.
Alternatively, as you are now measuring the nett power, that by definition is smaller and you could be adding in digital noise picked up from the processor itself (which could account for the offset you mention). Also, as the value being measured gets below about 10 ADC counts, inaccuracies due to the process of digitization come into play, which can lead to gross errors at very small powers.
From here I can tell that the Enecsys portal total energy generation is reading 2.8% high over the past 6 months.
This does not necessarily mean that the Enecsys energy generation figures are wrong by that amount. At that point of the grid into which the inverters feed their power the voltage is likely to be a bit higher (and therefore also their power reading). In a decent installation this voltage drop (or increase) should actually be lower than 3%, but up to 3% still seems reasonable.
I read somewhere on here that an air gap on the current clamp can introduce all kinds of errors. The PV cable is 6mm plus a sheath. The cable from the grid is substantially larger and so the air gap is smaller. I think that this could be the cause of the difference as my readings are high. Any thoughts?
I'm sure that was referring to any gap between the two parts of the ferrite core. Slipping just one layer of newspaper in there does indeed create havoc with the readings. Once the two parts of the clamp are properly seated, the material surrounding the current-carrying cable shouldn't have much effect. The conductor should ideally sit centrally within the clamp; a length of paper wrapped loosly around the cable is an easy way to achieve this.
Because our supply meter measures "real power" (which is actually "real energy"), my energy-bucket algorithm does likewise. If there is any real power to spare, it gets diverted to the dump load. Given that your prime objective is to divert power without being charged, I'm intrigued to know what other sort of power would be of interest to you ;)
One final point: if you are exporting power for any reason, are you able to quantify that power by any independant means? I can't, which is why it's difficult to know for sure how well the system is doing.
Unfortuantely half wave rectification does seem to be legal. just bought a hot air gun from wickes and its does halfwave for low speed setting. checked what regs I could find and the only one is a harmonic spec EN 61000-3-2 which has a get out clause of does not apply to professional equipment of more than 1kW. this means that half wave and triac control of half waves are legal. As most PID controllers use a SSR for heaters this would produce some halfwave content. the commercial offerings for solar immersion controllers ( such as immersun ) CE declarations of conformance do not quote this spec. although it is a requirement being a horizontal spec to the emc spec they are using the get out clause but this means they are not allowed to sell to general public.
I read somewhere on here that an air gap on the current clamp can introduce all kinds of errors
Robin and I conducted some experiments on CT phase performance and found some interesting results. If sinusoidal power is measured the CT phase lead increases slightly as power is reduced but this is small so unlikely to give ians problem. If you use non sinusoidal power then the CT phase lead reduces as the power is reduced. When measuring the net power via a CT clamp on the grid cable if there is any non sinusodial current from rectifiers or worst still phase control dimmers then the phase lead applied to the CT will be incorrect. the size of the effect will depend on the power factor of the underlying house loads errors of 200W have been seen ( installation with heat pumps ). using a larger CT reduces the phase lead and hence the size of this effect. STD CT's give around 0.5ms and the large ( 200A ) ones 0.15ms.
This is interesting data and much appreciated. I wish I was at home and in a position to make more checks and measurements. I had overlooked the point that the error is due to a discontinuity in the ferrite. I have two CT's and I may simply try connecting up the other one to see if it behaves differently. Equally, I could try the other CT on the PV feed and see how it behaves.
I seem to recall that the error between the enviR and the emonTX, which was within 10W has now jumped to about 100W. I don't know if this is a linear error as load is increased. I really need to do some investigations when the PV isn't contributing. That or turn off the breaker which goes to the micro inverter power bus. I'm inclined to do the tests with the breaker connected as this is the real world. I need to spend more time playing with the system and investigating. As I say, when I correlated the same CT and analog input with using the PV generation side and the enviR it was all but bang on. Now it isn't.
Another trick is to put a scope on the voltage and current inputs to the arduino and just see what is there. The voltage waveform should be easily seen but the current waveform could be pretty rubbish unless the load current is high. When I get the chance I may give both a go.
On the subject of the Enecsys figures: conversations with them previously have confirmed that the measurement method is not especially accurate. For most people simply seeing a pretty picture of their panels on the web is enough. Being an engineer, I like to drill down and understand a bit more. Pages of data have shown that there is a fixed power drain for as long as the panels are awake. Being away I don't have that data to hand but it causes substantial differences between the generation meter and the web page when the irradiance is low. When the sun is strong the fixed losses appear as a smaller percentage on a daily basis. Overall though, the running error is 2.8% over the past six months or so. In addition, as pointed out, the cable has some losses as well. I'm not unhappy with the 2.8% of loss. I just like to know what the number is.
The PhaseDisplayTool that I've posted could provide a simple display of the raw voltage and current samples that your Arduino is seeing.
The current that our inverter produces is quite interesting, display attached; it is far from sinusoidal. If you look at the voltage waveform, and try to imagine where it differs from an ideal sinusoid, I think the inverter is pushing out more current when the voltage is lower than expected, and less current when it's higher. Because the peak of the voltage waveform has been clipped, the inverter pushes out more current during that part of the waveform.
When I enquired about this behaviour, our PV supplier said that he would raise the matter at a technical meeting with the inverter manufacturer ...
I've just been testing robins rig using real readings from the live tail into my CU and a 2KW convection heater that conveniently can be switched down to 750W and 1250W (Argos cheapie) the solar output has been variable 0.5 KWh to 3.0KWh today and I've been switching appliances on and off all over the house to see the results. I have a PC USB scope but am being cautious about how I read the "big" waveforms (X100 probe referenced to earth). I've a 60W lamp across the heater as an indicator and from the scope I can see there are very few times that the system chops a cycle in half i.e. causes a half wave rectification. The zero cross looks accurate and the response of the system is quick, switch on a kettle and the lamp goes out instantly and the bucket recovers within a couple of seconds. At all times the heat sink did not get any higher than 50deg C so mounting it inside the box maybe with a miniature fan could be an option.
The AC reference and CT signal seem to be quite noisy but I think that’s down to the floating nature of the signals, I'm not sure where to put the earth lead of the scope probe and am working on the side of caution, I had a fully floating test rig that showed very little distortion or noise on the AC reference, that said whatever the waveform looks like IT WORKS! once it's permanently wired in to the immersion I will be asking about what I need to do to fine tune the system to ensure I'm not importing etc.
Thanks Robin for the heads up re the LED, I will be putting one on the front panel as an indicator until I get round to putting an LCD in place, I have been sent a sketch and alterations needed form a guy on the "Talking Solar" forum and will be looking at that over the next week.
Thanks again Robin for the inspiration to get this thing working.
Pictures to follow.
Rather than put loads of boring images up heres 2.1KWh being generated and the power guzzling TV on with 250W background..
Hi richmc, I'm delighted to hear that it's working.
You mentioned half-wave rectification. As my code only instructs the triac to go on/off once per cycle, I'm surprised as to how that could be occurring. If VOLTAGECAL were to be way off, then some false triggering may occur. A lengthy comment in the sketch explains how this variable should be set so that the trigger is armed correctly (at least 20V after the +ve going z-c point).
Your scope trace shows a sequence of four cycles on and two off (which suggests that your VOTAGECAL is set up fine). This is a really nice demonstration of how the algorithm works. With a a 2kW load (40J/sec) and a 2:1 duty cycle, that suggests you have approx 1300W of surplus power available (or 27J/sec). Maybe there are some other things on in the house as well as the TV ;) As soon as the energy bucket's level is found to be above 1800J, the triac comes on. For each cycle that it remains on, the bucket's level will drop by around 13J, that being the amount of energy which is reclaimed from the grid to power the heater during that mains cycle (the other 27J of the 40J consumed by the heater is supplied 'live' by the PV).
After remaining on for 4 consecutive mains cycles, the energy level drops below 1800J. Because of the interleaved windows, the triac continues to draw power for a further half cycle, this being concurrent with the first half of the next measurement period. For the second half of that next measurement period, however, the triac will be off. Depending on the exact levels and rates of energy flow, on or off periods can occur in either single mains cycles or pairs of cycles; that's what I've seen when playing around in debug mode. It's very reassuring to now see the theory working in practice using a scope.
No need to worry about fine tuning, this system just doesn't need it. If the behaviour of the LED looks about right, then your system is probably working just fine. Because imported and exported energy are in balance while power is being diverted, and there's only one measurement system, there's very little that can go wrong. Diverting surplus PV is a far less demanding task than monitoring all the energy flows in a house and getting everything to balance.
I know theres no half wave rectification, that was a bit of a joke as some on board are confusing the action of a triac with a thyristor/diode. ( I've got a stupid sence of humor) as you can see from the trace. And as well as the TV (big plasma) my home PC and 250W of fridges etc were on. Thursday is the big switch on with the water heater, will re post then.
The print statment goes tomorrow! Any thing else that can go? Don't get all programmy on me, no speka da C++ yet.
Any thing else that can go?
All of the 'debug mode' code could go, including the pre-processor lines, and all of the print statements.
There's no C++ in my code :D
Don't suppose you have time to post up a stripped down sketch? It's not that I'm lazy I just dont want to delete anything important, Arduino for dummies dosn't come out til November.
What would you, or others, like me to strip out?
Mabey a version without the debuging, the print instructions and the descriptions at the top and through the sketch, after all we can refer back to the original code if need be, esentially anything not esential to the running of the system. I don't know how much on board memory the Uno has but if others are looking at adding an LCD display or other gismos then the more space the better if that sounds logical. Does that sound logical? As I said I am an absolute noobie and can make very little out of the code at the moment, so wouldn't like to mess up your great work.
OK, sounds like a reasonable request. Debug mode was really useful while I was developing the code, but if no-one is using it now then it's probably better out than in. I also need to reinstate the PHASECAL logic, and the order of V & I measurements should be changed.
Any more suggestions?
Here is a cut-down version of the original sketch.
It passes the basic check of the led coming on and off when the CT is reversed, but I can't test it for real on account of today's Bank Holiday weather :(
WOW that was quick!
Will load that up and give it a test ready for thursday when I've got the house electrics sorted.
Very neat and tidy.
richmc, any chance of a pic with the cover(s) off, then we could see how the Arduino gets its power, and where the CT is etc. etc.
Hope this works, loads of trouble posting pictures. The arduino and ref have the (newly installed) spur the blue CT is on the main live in. The second CT if you can make it out is an efergy monitor on the PV live. although you can see L N & E going in and out of the box, I'm only using the L for the triac and the earth to ground the heatsink in case there is a problem with the triac, I've bundled up the neutral but left it there in case I want to try putting the triac on that side (probably won't now). Had a good afternoon so the water is as hot as the immertion thermostat will allow although the lower part of the tank has not been reached. My wife put the washing machine on earlier and the system responded as expected, and as in your video. I'm intending to post up a list of parts and suppliers with costings on the talking solar forum and will do the same on here.
Thanks for the extra pic, richmc. You appear to have a very well designed installation. I particularly like the use of the tubular heatsink on the outside of the project box.
I as others on this forum and other keen solar diverters would like to see an LCD print from the sketch to give more information in real time
I as others on this forum and other keen solar diverters would like to see an LCD print from the sketch to give more information in real time
Adding extra data to the GLCD sketch to display the diverted energy to heat water is not difficult - it took me a morning to write some code to do this. I just replaced the room temperature display with water tank temperature and current heater power, plus a simple bar-graph meter to show the heater control output level (0-100%). I added two extra fields to the emontx RF payload - water temp (measured by the emontx) and control output. Power to the heater is already there in the payload as the CT3 power.
However, when I tried to add the hot water power usage into the 7-day history display, it started crashing. I tracked this down to running out of the 1K memory limit. Got it working again by removing all references to the (now unused) 1-wire sensor library and the (also unused) RTC library (RTC library is useless to me as I have no emonBase to provide the time).
Good to hear that you've been following what's going on and keeping up to speed with developments. If you'd like to follow how my Mk2 code works, the cut-down version may appear easier - mainly because there's less of it. But if you really want to understand how the filters operate, or the how the energy bucket's level is affected by the operation of the triac, that kind of investigation is best done using the original code in debug mode. That's how I got the code to work in the first place, and I'm no superhero!
Provided that you're clear about what it is that you're trying to understand, and single-minded about how to go about the task, all can be revealed. It's a great feeling to really understand how something works, whether or not it's one's own design. Using just print statements and the pause() facility, everything that the inquisitive reader could need is available within the sketch; you just need an Aduino and a logical approach.
If you're not sure about some aspect, just post a question with as much detail as possible. Someone is bound to provide the answer, and it may well not be me :)
Got a bit lost with your argument. A SSR or triac in phase control mode is not introducing asymmetry (only harmonics) as it chops the positive and negative cycles equally (within triggering timing erors) so very little/no DC component. Burst fire does not either as long as only complete cycles are delivered. So why can't Immersun sell to general public? Do they use phase control or burst firing?
Immersun cannot sell to general public because their ce declaration does not include conformance to harmonic regulations which is a requirement only for sale to general public.
There is a table of the limits for the permissible harmonic currents in this publication, on page 14: http://www.reo.co.uk/files/handbook_en_61000-3-2.pdf
Phew, good job we're using triacs, not thyristers :D
I'd be surprised if there was not prior art to invalidate that patent. I'm not at all well versed in patent law, but if they've only been granted their patent and published their design in July 2012, there is significant published prior art on this site alone.
I love the patent title "Load management controler" dosn't even specify the type of load, could mean a pully system for lifting weights. And as Calyso_rae spcificaly does not measure generation theres no problem, the list of things it controls is a joke as well.
I would say this is about as valid as patenting a spherical object containing air or another substance to assist in the playing of games. Such as but not exhaustivly - football, tennis, golf, hockey, vollyball , rugby (with variation of the shape) cricket, ping pong and whatever.
I would really like to see the whole patent.
Unfortunately it goes back to when the patent was applied for which was April 2007. So only prior art before then can be claimed.
The whole patent is here http://www.ipo.gov.uk/p-find-publication-getPDF.pdf?PatentNo=GB2448504&D... Look at Claim 1 on page 10. Claims 2-12 are just added features on top of the basic controller in Claim 1.
On the EMC front how does burst firing relate to EMC specs? All thyristors/triacs (being slightly non linear) produce significant harmonics above the 150kHz lower limit of EN55022 etc. even if fired in complete cycles, so I doubt an unfiltered triac would pass EN55022 Class B. In addition the burst firing presumably results in huge sub harmonics of 50Hz but these comply with EN55022. Are there any other specs that apply?
I also wonder how the PV inverter copes as there is maybe a 1-2 volt (I am guessing) fluctuation in the mains RMS voltage seen by the inverter between cycles where the immersion is being fed by triac and when it is not. Depends heavily on the impedance of one's mains supply. Mine seems particularly high as house lights flicker due to the burst firing.
According to their website, Cool Products' patent application for their 'Load Management Controller' was filed on 17th April 2007.
Anyway, since posting my Mk2 scheme, I have been trying various ways to see if the configuration can be improved. I now have two rigs side-by-side in the garage, and can switch between them by simply plugging the trigger's control wire into pin 9 of one Arduino or the other.
Rig A is still on breadboard and essentially as posted. For the voltage sensor, it uses an AC/AC 'telecom' adapter which is similar to a Mascot but with worse performance. I had two of these lying around; Robert Wall has kindly tested one of them and found its performance to be pretty grim. Nevertheless, the second one continues to work reliably and heat our water. For the current sensor, Rig A uses the standard YHDC CT 30A model with a 150R burden. This provides a good level of signal for the Arduino but with a considerable amount of phase shift at 13A. This rig is running my recently posted cut-down code with PHASECAL = 1, hence no phase-correction. The Arduino is using its standard 5V reference with the buffered Vref rail set to 2.5V.
Rig B has several enhancements. Its voltage sensor is a 'direct' version of the mains voltage using just resistors and op amps, hence no phase-shift. This rig has no earth, the 'common' is mains Neutral (shhh!) Its current sensor is a Magnelab CT which is undoubtedly a better component than the standard blue one. To keep the output voltage low, I've used a small value of burden and provided an op-amp stage to boost the CT's output signal. PHASECAL has been set to the optimal value for this particular setup as determined by measurements of a resistive load. On this rig, the Arduino is using its internal 1.1V ref mode, by setting analogReference to INTERNAL. My buffered reference is therefore 0.55V which is derived from the Arduino's 3.3V rail.
So, quite a few differences, but how do these two rigs compare? In a word, their performance is very similar. The most noticeable difference is that when minimal surplus power is available, Rig B does flash a bit more quickly than Rig A so it is somehow managing to find more power to divert.
When either rig is diverting power, the LED in our supply meter is constantly 'on'. This appears to show that the meter has entered its anti-creep mode. However, there must be some difference between my two rigs because their flash rates are not identical. The 'safety margin' variable can be used to good effect here. When safetyMargin_inWatts is set to -10W, Rig B no longer sits in anti-creep mode. The supply meter's LED slowly turns on and off, each 'off' event carrying the standard 0.001kWh charge. Having synthesized 10W out of thin air, I am being charged for around 15W. But if I leave this variable at 0W, then the LED remains on constantly. This suggests that, by keeping the meter in its anti-creep mode, Rig B is gaining a few Watts of free power.
The behaviour of Rig A is slightly different. With safetyMargin_inWatts set to -20W, the LED stays on constantly. But at -25W, it cycles slowly off and on. Rig A therefore appears to have an unexplained bias towards importing power which can be offset by setting safetyMargin to -20W. With this offset in place, the flash rates of Rig A and rig B look identical.
So, to get the most out of any given rig, my suggestion is to synthesize as many Watts as you can get away with (by setting safetyMargin_inWatts to a negative value) but make sure that the supply meter's LED remains 'on' while power is being diverted. If the LED ever goes off while the system is actively diverting power, then you have been charged and should reduce the value of this offset.
It may be useful to record the value of offset which works best at different rates of power distribution. While the triac is on for less than 10% of the time, the system may work best with a -20W offset as I have found for Rig A. But with a higher on:off ratio - when the PV is more active - the optimal value may be different. The exact behaviour could well be different for each rig. Once the profile of a particular rig has been investigated, the offset could be dynamically allocated for optimal performance as conditions change. Any 'LED off' events while power is being distributed could be noted and cause the amount of offset to be backed off a bit ...
However, back to reality. The bottom line is that any Mk 2 rig which is basically working is probably fine just as it is :)
All I know is it works bloody well! and I can live with 15W! I'm now playing with the mecanical aspects of the immersion system to minimise how much gas is used for "top up". Thoughts are Mk2 will gather as much energy that is possible through the day, so gas top up can be done in the evening if required. I've set the immersion thermostat to max i.e. 70deg C (not ideal I know) the gas stat I will set to just click out with what I have with generated to cause the immersion stat to cut power. So in the evening if MK2 has done the best it can there will be no gas use, if it's been a poor day a bit of gas will be used to top up. In the morning I hope there will be enough hot water to provide showers for my wife and me and any other small use of water we have. We use the dish washer, tumble dryer and washing machine in the afternoon, the appliences are cold fill so use solar to heat the water. whatever has happened to the immersion.
Am I making sense?
As to Calypso_rae's final comment "If it ain't broke, don't fix it!"
Earlier today, I posted: "The behaviour of Rig A is slightly different. With safetyMargin_inWatts set to -20W, the LED stays on constantly."
However, with the laptap monitoring its behaviour this morning, I can reveal that the LED has had a few (chargeable) 'off' moments. But with a import bias of just 15W, it was fine. So, I'd better change that to: With safetyMargin_watts set to -15, the LED on Rig A appears to remain reliably 'on'.
Richmc: "If it ain't broke, don't fix it!" Sure, but if the initial design can be improved, then why not? That's why my kit remains in a flexible form so as to take advantage of any refinements that come along. In practice, the performance of my rigs is so similar that I'm happy whichever one is doing the business.
Looking at the full text of that patent, thanks fewyatt, their 'invention' is clearly one in which current is measured at two places and the difference is computed for th purpose of diverting power. For what it's worth, that's the way that the eMon project appears to be presented (but as no diversion of power is taking place, only monitoring, that's OK)
From the outset, my Mk2 PV Controller only measures at one place, namely at the supply point (where they don't actually measure). For this application, I have never seen any point in measuring anywhere else. Whether 10% or 90% of the PV is being used within the house at any time is of no importance; the only flow that's worth measuring is the one to and from the grid.
Claim 1, which underpins all of the others, involves three specific aspects, two of which I am not doing. As for the third point, well my triac is called Tommy, not Emma.
Thats "TIMMY" (Southpark), and yes improvement is always good.
another good day with the immersion having done its thing by 13.00 I'm almost skipping around the house trying to find somthing else for the excess to do.
As an aside if anyone did tread on their toes enough to threaten legal action they are probably so small an outfit to not be able to afford a suit, they aren't exactly Apple v Samsung.
Calypso the difference in offsets between your two rigs is explained by the phase leads of the different cts. A simple simulation will give you the difference which I have confirmed by measurement. The smaller ct has a lead of 4.5ms and the larger one 0.15ms. As a rough rule of thumb the power is misreported by 10W per 0.1 ms so you should see about 30W difference. The difference will vary from day to day because it also depends on the power factor of your house load. The numbers given are for resistive loads if you have any bad power factors then it will get much worse I have seen 200W errors.
In answer to have cool power started legal action the answer is yes a fellow poster on electricians forum has recieved initial contact which is always to inform of the existance of their patent.
The harmonic spec is what is called a horizontal addition to the emc spec and it does not say you have to get permission to connect to the grid that is reo interpretation if you do not fit any of the classes and use the professional clause and they use the word may. Burst fire and half cycle may fail emc at 150kHz but this can be corrected with an active or passive filter very easily. Phase control needs an exotic filter to pass. The harmonic spec is very difficult to achieve without risking misfiring of triac or scr so all commercial implementation I know of use the prof install get out clause in their ce declarations.
"In answer to have cool power started legal action the answer is yes a fellow poster on electricians forum has recieved initial contact which is always to inform of the existance of their patent."
"In answer to have cool power started legal action the answer is yes a fellow poster on electricians forum has recieved initial contact which is always to inform of the existance of their patent."
Having now had time to read through (some) of the patent, I think it's highly questionable that there is anything in it that is "an inventive step that is not obvious to someone with knowledge and experience in the subject". I've been in electronics and controls since 1967, and it's pretty obvious to me that the "invention" is nothing more than the straightforward application of an automatic control system. The firm where I was a student apprentice made maximum demand controllers - they didn't use a microprocessor back then of course, it was all analogue amps and integrators - that switched off selected loads in order to remain under a target, and the basic idea behind this "invention" is very similar to that, namely controlling a load in response to energy consumption - similar I would suggest to the extent that the development of one from the other is "obvious to someone with knowledge and experience in the subject".
pmcalli, what cause the misfiring? Is it the filter? People here don't report misiring and I don't get it although I use an SSR with filter.
pmcalli, what cause the misfiring? Is it the filter? People here don't report misiring and I don't get it although I use an SSR with filter.
Burst control and half wave are fine with a standard power line filter I notice that crydom now produce an active filter block to absorptively kill the residual 150kHz problem area. Phase control produces very large amounts of harmonic energy and it's tempting to try to slow the edge from the firing down by a large inductor but this can lead to a phase delay of the zero cross of the current and the end effect is the triac turns on from exceeding its dv/dt. This is one of the reasons for using back to back scrs instead of triacs as well as their higher power handling they have a higher dv/dt. Design of phase control filters is therefore a bit of a black art. I have a number of standard two stage filters that I will be testing feeding them from a LISN and measuring conducted emissions in a Spectrum analyser in the hope that a bespoke filter is not needed. Will post the results when the tests are completed.
You need a dip compensator to deal with "the impedance of one's mains supply. Mine seems particularly high as house lights flicker due to the burst firing."
It's a long time since I had anything to do with one of these, if I remember correctly it was a capacitor bank in series with a saturating reactor, the idea being that as the voltage changed, the reactor came in and out of saturation. As the voltage dipped, it diverted current into the capacitor bank. The capacitor bank set up a series resonance with the inductance of the supply to therefore raise the voltage and compensate for the dip.
(Incidentally, it was a combined harmonic filter and dip compensator).
It's easy enough to get an approximate value for your mains impedance, but I've no idea how you would determine the values of the reactive and resistive parts, hence the amount of capacitance you would need. The only suggestion I could make is to try adding some capacitance and measure the effect. (You'd need to very carefully consider where to put the capacitors, how to rate and protect them and the side effects of switching a large capacitor (inrush).
above are the pcbs for the project.
Parts list & pricing
Part Price Source Note
Triac BTA41-600B £3.74 Spiratronics
Opto couple MOC3041-M £0.64 Spiratronics
Op amp LM358AN £0.22 Spiratronics
Diode 1N4001 £0.38 Spiratronics Pack 10
8pin ic socket £0.39 Spiratronics
Arduino Uno £22.79 Spiratronics ---- From £11.50 eBay?
CT SCT-013-030 £8.80 eBay
PCB Transformer 3VA 9V+9V £3.02 Spiratronics ---- It works!
Terminal block 2 way x5 £1.25 Spiratronics
3.5mm stereo pcb jack £0.20 Spiratronics
Resistor 150R .25w metal film £0.39 Spiratronics ---- Burden resistor not
Resistor 180R .25w metal film £0.39 Spiratronics needed if CT has
Resistor 330R .25w metal film £0.39 Spiratronics one built in.
Resistor 360R .25w metal film £0.39 Spiratronics
Resistor 12K .25w metal film £0.39 Spiratronics Resistors come in
Resistor 15K .25w metal film £0.39 Spiratronics packs of 10
Resistor 150K .25w metal film £0.39 Spiratronics
PSU for Arduino 12V .5A £9.99 Maplin
Case 194.5x145x78mm £6.25 eBay The Allendale stores
Heatsink £13.98 eBay Discount Devices Shop
Cable glands PG11 x4 £7.56 Maplin
EDIT - Forgot to add, sketch and hard work by clypso_rae....................PRICELESS!
Wire, 13A plug, 30A terminal block, self tapping screws etc.
Most of the Spiratronics stuff comes in multi packs but is still cheaper than Maplin etc and leaves you with more bits to experiment with!
You need a dip compensator to deal with "the impedance of one's mains supply. Mine seems particularly high as house lights flicker due to the burst firing.
Something seriously wrong with your wiring. Burst fire applied to lights makes them flicker because there is intermod products at low frequencies. Applying burst firing to the immersion should not afect your lights unless it gives a large voltage drop. I would have a look at all the connections along your meter tails. I had a similar effect on a friends house a few years ago and we traced it to the 100 amp isolator before the meter that the builder had fitted. DNO removed it saying they had lots of cases of fires due to loose connections in them.
Just to add to pmcalli's comments. Having run the system for a few days now I've not measured any drop or experenced any "side effects" of it operating i.e. lights flickering, my house is 12 years old and fed by a sub station that feeds around 200 homes, so I think you may well have a problem.
Well I gave it my best shot, assembled all the bits as per rae`s diagram, uploaded the reduced code and --- nothing happens.
Of course the fault could be anywhere- dodgy component, iffy breadboard etc. Unfortunately, to reverse an oft stated paradigm, if it don`t work I can`t fix it.
Anyone out there willing to put together a rig for me? Of course I`ll pay (but don`t tell Emma)
Before you give up on it Noah, try turning the CT over if its wrong way round nothing will happen.
And load up calypso_raes original sketch then you can see what the energy bucket is doing.
My house wring is pretty recent so I’d be surprise if it’s the wiring but I do have a 100 amp isolator as mentioned above. The flickering is only slight and only on incandescent bulbs. Many people would not notice it.
It was reported on another forum that someone had problems like this with his own house and the neighbour’s too reacted to the on/off action of the controller. That was a slow switching controller, not a true burst fired one. High impedance connections in a house would surely not affect one’s neighbour?
It is possible to afect a neighbour. The incoming feed on modern estates is often daisy chained. If the loose connection is on the point where it chains to the next house then they will be affected too. It would be a good idea to check the voltage drop across the isolator if you can do so safely. Otherwise see how hot it gets when you have a high house load. My friends isolator melted the plastic surround. Your house wiring is not likely to be the problem. The tails from the 100amp fuse to the meter, the tails to Henley block and isolator and the tails from the isolator to the consumer unit are the most likely areas for loose connections giving this sort of effect.
Dip may or may not affect your immediate neighbour - it depends on which phase you are on and which they are on. Presumably, neighbours on the same phase will see flicker if it's not your wiring, but if the neutral impedance is significant, everyone could suffer, (though those on the same phase will see the voltage go down as you do, those on the other two phases may see it go up). I've never worked for an electricity company, however I believe houses down one side of a street are wired R Y B B Y R (etc), and it used to be the practice to indicate the phase with coloured discs by the supply authority fuse and neutral link (red & black, white/yellow & black, blue & black), though I don't know whether this is still done.
Of course the fault could be anywhere
noah, I'm pleased to hear that you've got everything assembled. That's the time consuming part. To get it working shouldn't take long and there's plenty of help available here. Any chance of a photo of your rig?
The cut-down code should be fine. Print statements can easily be added to help understand what's going on. Having found that "it doesn't work", you now need to break down the project into manageable chunks and check each part in turn.
For starters, does your energy bucket work? To find out, just clip your CT on to a test lead that has some current flowing, and the bucket's level should change. To see this happening, you'll need to include a print statement every so often. With the clip one way round, the bucket's level should increase; then it should decrease if the CT is reversed. With no current flowing the bucket's level should stay where it is. Once the bucket gets to the 1800J mark, the triac should turn on, as should the on-board LED.
Before doing that, it would be helpful to to check that your current and voltage samples look right. They need to be centred around the 512 mark, i.e. central within the ADC's range. Various tools have been posted for this.
If all else fails, feel free to send me a PM ...
As a post script, the system has been perfoming 100%, I now have the gas side of things set to come on between 8.00 and 9.00 PM and so far it hasn't been called, I've set the immertion stat to max and the gas boiler stat to a little below the point where the immertion has cut out with a full tank of hot. By the morning the water in the tank has cooled slightly (can't accurately quantify it) and serves for two indulgent showers and whatever is needed before the sun works its magic.
What I would like to do now is ensure that export and import are at their minimum I have a bog standard Landis + Gyr (5258K) meter, anyone know how to make sence of what the lights are doing? I know calypso_rae had a look into this, just wondered if there was a useful outcome.
Over the next few days I will go from the full (debug disabled) sketch to the leaner sketch that calypso_rae was kind enough to give us. and will feed back any differences, I have no idea what the phase cal is about or if I will have to change anything tune it to my system.
My electrician wants one of these, but of course I've told him I can't make one for him because of patent issues.
Re As a post script
I have had a system running for over a year now and collected data on cooling rates etc. typical dipped tank needs 2kWHr to overcome the heat loss per 24hrs. It is well worth insulating all the pipies going to and from the tank. I have also found the loss rate can be halved by adding an additional jacket over the top of the existing foam insulation this makes a big difference in the winter. I don't run the gas at all from April to October as its cheaper to boost the immersion than run the gas on the odd occasions it's needed all depends on your usage of course.
I wouldnt worry about the patent firstly it would only apply to you selling commercially and secondly the current legal advice is it doesn't cover a single ct measuring residual energy flow to and from grid.
Richmc, any difference between running the original sketch (in normal mode) and the cut-down one should be minimal. Although the later sketch includes a phase-shift correction capability, the value of PHASECAL is set to 1.0 which has no effect.
In the cut-down sketch, current is sampled before voltage. This is likely to improve the alignment between your two waveforms. The alignment can be further refined by adjusting the value of PHASECAL to match your particular setup. Over the last few weeks, I've suggested various ways of doing this. If anyone feels they needs more guidance about this aspect, please ask.
There's a lot of material about phase-shift and PHASECAL at http://openenergymonitor.org/emon/node/870.
rae. I was convinced my ct was not working as it was showing open circuit on a meter. however i looked at it again tonight and it was showing a resistance of around 100 ohms. dont know if this is in any way correct but i decided it was worth trying again
here is a readout with ct on a load of 3 amps or so. there was no load present on the triac.
cyc# 5, sampleV 408, fltdV 17.45, sampleV-dc -126, cumVdeltas -3879.83, prevDCoffset 573.51, refFltdV 534.71, enInBkt 0.00
cyc# 505, sampleV 521, fltdV 21.38, sampleV-dc 10, cumVdeltas -34.24, prevDCoffset 511.24, refFltdV 510.89, enInBkt 0.43
cyc# 1005, sampleV 517, fltdV 17.76, sampleV-dc 6, cumVdeltas -54.30, prevDCoffset 510.71, refFltdV 510.16, enInBkt 0.89
cyc# 1505, sampleV 521, fltdV 20.91, sampleV-dc 9, cumVdeltas 30.92, prevDCoffset 511.27, refFltdV 511.58, enInBkt 1.68
cyc# 2005, sampleV 503, fltdV 3.27, sampleV-dc -8, cumVdeltas 17.73, prevDCoffset 511.12, refFltdV 511.30, enInBkt 2.31
cyc# 2505, sampleV 526, fltdV 26.19, sampleV-dc 15, cumVdeltas -24.76, prevDCoffset 511.16, refFltdV 510.92, enInBkt 2.40
cyc# 3005, sampleV 508, fltdV 8.23, sampleV-dc -3, cumVdeltas 21.55, prevDCoffset 511.22, refFltdV 511.44, enInBkt 3.33
cyc# 3505, sampleV 501, fltdV 1.04, sampleV-dc -10, cumVdeltas -19.66, prevDCoffset 511.47, refFltdV 511.27, enInBkt 4.37
cyc# 4005, sampleV 524, fltdV 24.13, sampleV-dc 13, cumVdeltas -17.32, prevDCoffset 511.02, refFltdV 510.85, enInBkt 3.40
made no difference which way round the ct was facing (changed in middle of that lot)
hope this means something to you!
This may sound daft but everything looks OK except the bucket, a few questions.
What are you using as the AC reference transformer?
Is the "pin 13" led on the Arduino flashing at any time?
What are you using as the outpul load?
What are you using as input load (for current reading)?
noah, 100 ohms for a CT sounds fine if the internal burden has been disconnected. I would expect a lower value if an internal burden is in place. Your display provides quite a lot of information ...
First, it shows that your low-pass filter (LPF) is working perfectly. That's the refFldV column which should be around 511; your value looks spot on. This is used for removing the dc-offset from your voltage and current samples. When I was developing the code, it was helpful to see other values too, each new value of refFltdV being prevDCOffset + (0.01 * cumVdeltas). If you check your values, you can see that this is the case. The LPF is not part of the standard OEM code, which is why I left the diagnostic printout in place. Now that your LPF is clearly working, you can remove this block of printout and replace it with something more useful.
The final value in the display line is for the energy bucket, which is clearly not doing much. The bucket is simply an accumulator for packets of (virtual) energy, each one being generated by multiplying a pair of voltage and current samples together. Your voltage samples should be centred around 511 and have a amplitude of a few hundred ADC steps. From the display that you've provided, it's not possible to check the amplitude of your voltage signal, this being because the same part of the voltage waveform is being displayed every time. But provided that your display lines are appearing every 10 seconds, it seems likely that the voltage side of things is fine.
Now for the current. The first thing I would suggest is to run one of the diagnostic tools which displays raw voltage and current samples. Voltage values should always stay much the same, but the current values should be dependent of whatever load you are measuring at the time. Near the top of the thread here, there are two simple sketches which do this. My minAndMaxValues sketch, posted on 1/7/12, allows you to measure the maximum amplitude of your voltage and current waveforms as sampled by the Arduino's ADC. Voltage and current samples can also be displayed in the form of a graph using my rawSamplesTool here. You can then compare your displays with the results that I've posted alongside the tool.
Because your energy bucket's level is floating around (not jammed at either end of its range) it suggests to me that no current samples are getting through. Running any of the above tools will confirm this. Once you have a steam of current samples in place, the energy bucket should rapidly wind its way up and down its 3600J range as you monitor current flow with your CT and/or reverse its direction.
In the original Mk2 PV sketch, the second block of code below the "WARNING" statement (currently commented out) will display the energy bucket's level every second. In the cut-down 'mini' version, you need to uncomment the relevant line(s) in the same place for whatever you want to do. Enabling the two lines containing energyInBucket_4led ('mini' code only) provides an easy means of calibrating your system. If you're measuring 100W, you should see 100W being displayed each second. If the correct value does not appear, just alter POWERCAL until it does. Once calibrated, your system should be linear from 0W to whatever surplus power is available. In my case, that's 3kW - but I'm no expert on power stations!
I`m going to wimp out on this for now as rich (and others) have very generously volunteered to put a working model together for me.
Many thanks to all respondents.
Rae, thanks for your input above. I had a look at the minandmax sketch and immediately i needed guidance: how do you run this? load it onto arduino so it displaces PV_router? See the problem is I have so little knowledge at this point that i`ll be hassling people to explain what is obvious to them but obscure to me. Rather not waste your time if a kind person will set me right.
noah: I had a look at the minandmax sketch and immediately i needed guidance: how do you run this? load it onto arduino so it displaces PV_router?
Yep, spot on; both sketches use exactly the same hardware. Just load it up and watch the numbers appear on the screen, Then you can adjust anything you want before switching back to the main code.
It's rather like preparing a meal. If some kind person will do all the cooking for you, that's great, but you never become familiar with what goes on behind the scenes. Good job that my long-suffering wife enjoys her time in the kitchen :)
Yes, you can only have one sketch at a time loaded into the chip, so you just load the minAndMaxValues sketch and play with it, then reload another, or the original. I'm doing it all the time to check various things (I've even loaded nanode emonBase sketches into an emonTx to check a particular aspect - OK, not everything works but the section I was interested in at the time did!). There is a limit to how many times you can do this - 10,000 - so I wouldn't worry about that too much.
If you want to PM me with the 'idiot' questions, feel free. If you want to learn and you're prepared to work at it, I'm prepared to help you.
I've been running the cutdown code, and over the last two days have had two good tanks of hot water with no intervention from Mr.Gas. Next week I'm not working (love shift work!) so I will be able to keep a close eye on whats going on.
With the new sketch I feel it's acting differently, can't quite put my finger on it but it seems to need a little more time in the morning before the LED starts to flicker, could be the safety margin, or just that the days are getting shorter. And it seems to take a litte longer before the LED in on constantly although we have had some blisteringly fine days down here in the SW 20KWh days with 3Kw peaks lasting for several hours.
I guess the only way to tell is to get myself an emonGL built or invest in an Eco-Eye smart PV, my meanist insticts are advising against this as I will have to pay £85ish for the Eco-Eye, has anyone costed the emon?
richmc on Fri, 07/09/2012 - 14:11. I feel it's acting differently, can't quite put my finger on it but it seems to need a little more time in the morning
Rich, I suspect its simply the time of the year and the daylight shortening. With my house base load around 250W, its past 9am before I'm generating surplus power. I'm uploading my realtime stats to my site and PVOutput, links below if your interested. Today is a lovely curve!
richmc: With the new sketch I feel it's acting differently,
Are you using the same value of POWERCAL in both sketches? Although its value is not important once the system is up and running, it does affect how quickly the bucket gets to its operating point whenever surplus power becomes available.
Yes guys (both of you) I've not changed anything only switched from the original (debug disabled) to the cut down version. Don't get me wrong it works. I'm getting the feeling that the safety margin is possibly being affected by the swap around in sampling current and voltage. I need to measure the absolute value of import and export, I have an efergy that can help and help me adjust the safety margin.
And Stewart I've taken the daylight hours into account as I keep a close eye on when the PV kicks in and my background use.
caypso-rae I havnt changed POWERCAL so yes the same in both sketches, are you saying that it can affect the starting point of the system or the base power export before it kicks in?
Rich, in each sketch, the 'safety margin' is specified near the top of the code. For comparison purposes, it's probably best set to 0 in all cases. Changing the order of current and voltage should have very little effect. If you think that this change is having a discernable effect, why not change the order back to what it was? I don't think that simply comparing my original and cut-down sketches as posted is a useful exercise. The Arduino doesn't see these as any different because all of the code that I've removed would be stripped out anyway by the preprocesser when compiled without the #define DEBUG line.
POWERCAL is described as well as I can in the original sketch, and I think I retained this description for the cut-down version. It's simply there to 'scale' the energy measurement system. When power is being diverted, import and export should be the same, with no net flow of current. If POWERCAL is set correctly, every cycle that the triac is 'on' will cause the energy bucket's level to drop by 60J. If POWERCAL is set to twice what it should be, then the effect will be 120J instead of 60J. But it really isn't important because both import and export will be 'stretched' by the same amount.
If two distances are found to be the same when using a ruler, it doesn't matter whether that ruler is calibrated in inches or centimeters. The only thing that matters is that it's linear. That's why I think it's important to keep the CT's output signal down to around 1V ptp. Otherwise, the output voltages caused by large and small currents are unlikely to be proportional. The solution is to either amplify the CT's output, or to configure the Arduino to use its INTERNAL (1.1V) reference. My preference is the latter. Having said which, my original Mk2 setup is still heating our water reliably with pretty much all the problems that are going.
Hi guys I’ve had the components in the delivery bags for a while and have finally found time to solder them on the circuit boards but when I run the debug sketch I get the following print statements. I’ve checked the circuit a few times and it appears to be O/K but I obviously have a problem so can anybody point me in the right direction as to what’s happening when I run the code. I have another set of components and can build a second unit but would like to understand where I have gone wrong with the first build.
In DEBUG mode ...
cyc# 5, sampleV 365.06, fltdV 41.80, sampleV-dc -153, cumVdeltas -1894.64, prevDCoffset 537.34, refFltdV 518.39, enInBkt 0.00
cyc# 505, sampleV 503.39, fltdV 13.08, sampleV-dc 3, cumVdeltas 0.00, prevDCoffset 500.00, refFltdV 500.00, enInBkt 806.00
cyc# 1005, sampleV 503.39, fltdV 13.08, sampleV-dc 3, cumVdeltas 0.00, prevDCoffset 500.00, refFltdV 500.00, enInBkt 1746.00
cyc# 1505, sampleV 503.39, fltdV 13.08, sampleV-dc 3, cumVdeltas 0.00, prevDCoffset 500.00, refFltdV 500.00, enInBkt 1786.00
cyc# 2005, sampleV 503.39, fltdV 13.08, sampleV-dc 3, cumVdeltas 0.00, prevDCoffset 500.00, refFltdV 500.00, enInBkt 1766.00
cyc# 2505, sampleV 503.39, fltdV 13.08, sampleV-dc 3, cumVdeltas 0.00, prevDCoffset 500.00, refFltdV 500.00, enInBkt 1746.01
cyc# 3005, sampleV 503.39, fltdV 13.08, sampleV-dc 3, cumVdeltas 0.00, prevDCoffset 500.00, refFltdV 500.00, enInBkt 1786.01
cyc# 3505, sampleV 503.39, fltdV 13.08, sampleV-dc 3, cumVdeltas 0.00, prevDCoffset 500.00, refFltdV 500.00, enInBkt 1766.01
Relax, Ken, there's no problem. As posted, my sketch is in 'debug' mode, as shown in the first line of the display. Debug mode is useful because it allows you to investigate all aspects of the code without requiring any peripheral circuitry.
In 'debug' mode, the code synthesizes its voltage and current samples, and it does so perfectly. That's why the dc offset is displayed as exactly 500.00 (the penultimate column). An Arduino needs any analogue signals to be centred within the 0-5V range of its input range. With a real voltage sensor in normal mode, you should see around 511 - that's half of 1023 - but anything within say 20 of this value would be fine. For debug mode, I use an offset of 500. The fact that your display is showing precisely 500.00 means the low pass filter which extracts the dc offset is working perfectly (as one would expect it to do in debug mode).
Debug mode also simulates the triac. You can see that it's working becasue the energy in the bucket never exceeds 1800J. Why not play around with the numbers in the sketch to get a better feel for what's going on? Debug mode is intended to be experimented with.
The get the code working for real, it has to be in 'normal' mode. To make this change, just comment out the #define DEBUG line near the top. You will then no doubt be hoping that everything will work just fine, first time. It may indeed do so, but it also may not. If it doesn't, the next thing to check is the operation of your voltage and current sensors. An easy way to do this is with one of the tools that have been produced for this purpose. By this means, you will be able to verify that your voltage and current signals are OK.
sketch near the top of
is well suited for this purpose. You could also try my
which shows your sampled data in graphical form.
When first measuring current, I would recommend using some small resistive appliance rather than the current drawn by your entire house. Check the Building Blocks pages if you're not sure how the voltage and current sensors work.
Once your sensors have been shown to work OK with a tool, they should work fine with my code, Any problems, just post the details here. The more specific the symptoms, the more compact can be the answer :)
Thanks for the quick reply I'll play around with the code and see what happens. I'm quite happy nothing smoked or went bang :~)
I'm now in a position to make PCBs as per my previous posts, they will come drilled (except for the mounting holes), whether you use the transformer from Spirotronics or a wall wart is up to you. I'm going to charge £10 just to cover costs and my time, if anyone is interested please PM me.
For those soldering iron shy I'm thinking about selling populated and tested boards but haven't costed that out yet, again if anyone is interested PM me and I'll look into the cost.
Robin it seems that the problem with my rig was wrong value resistors so I feel rather embarrased about copping out too soon.
However I`m very much looking forward to having my own Professionally Made Mk2 Robin Reliant supplied by kindly folk of the forum.
I have an old fashioned disc meter which has been running happily backwards and forwards. My FIT supplier has been promising to change the meter for a shiny new non-reversible type (not that I`m in a mad rush you understand) but they have now missed the third appointment. Will the MK2 work with a disc meter? My instinct says no. As an analogue device it will not need an accumulator but just translate any incoming or outgoing current into disc movement.
Obviously while I can bank and withdraw kWs at whim a diverter is not a high priority. I guess I`ll be waiting for a digital meter before I can install.
Unless you are thinking of synchronising the controller with the LED flashes from a digital meter, Robin's controller has nothing to do with the meter. It will work whether you have an analogue Ferraris (rotating disc) meter, a digital meter or even no meter at all! The controller is exactly matching what the meter does, but there is no direct link between the two.
All that will happen with your disk meter is it will run backwards a tiny amount, and then forwards as the immersion heater draws off the current. Most probably, because we are only talking about one or two cycles at a time and the disk has a small but finite inertia, the disk will never actually move at all.
So go ahead and install, and with luck your meter will only rotate either when you are not generating enough to satisfy your load (when it will run forwards), or you are generating too much to be able to absorb all of it (when it will run backwards). If your meter disk creeps very slowly, Robin will tell you how to adjust the safety margin bias in the software.
I have a disk meter which unfortunately has the mechanical backward stop and it works fine on robins circuit. at low powers the disc wobbles but doesn't have any long term movement so go for it. You will have the advantage of being able to tune the safety margin as your meter goes backwards.
It occurs to me that some people are not comfortable with mains on a pcb so I thought I would share an alternative for the mains shy. I was asked by a friend to put a controller together for them on a short timescale so I decided to take the plunge and build robins design from parts I already had. I used an owl ct a pcb transformer and a standard puck type SSR. Following robins recommendation I used the debug sketch and the max min sketch to determine that the hardware worked the only thing I had to alter was the sense of the triac drive which is done by either changing the on definition or using the led output. it took 10 mins to assemble and worked first time. The puck type SSR is available from eBay and elsewhere for similar money to the triac.
I know some people are using the cut down sketch but I would ask that the debug one is kept going as it is so useful for testing the hardware has been assembled correctly. Many thanks to robin for his excellent work.
Thanks Paul, I'm delighted to hear that 'debug' mode has been helpful to you, and that the tools I've posted are being used :)
Robert and pmcalli.
Surely the way the meter works is important. A digital meter counts (somehow) cycles or parts thereof and decides, when a certain amount of power has been used, to register this. Until the registration happens there is a window where the accumulated amount can be modified by feeding back into the mains. This obviously works but surely its possible that a meter can be designed so that its accumulator as well as register is non reversible. As long as this is not the case then we are gangbusters.
I realised soon after raising the query about analogue meters that this wouldnt be a problem especially with reversible type as in effect the energy bucket could be any size. With a ratchet (non reversible) type then the size of the bucket is defined by the tooth and pawl and I`d guess that this is likely to be larger than the digital meter`s accumulator anyway.
Of course I`m always imagining these thing in a mechanical sense which may well be misleading.
Yes, the way the meter works is important, but as long as the controller and its "energy bucket" offers finer-grained control, then the meter won't register. If you want an analogy, it's like driving down the road: if your car is 5 feet wide and your lane is 10, and if you keep the middle of the car within 2 feet of the middle of your lane, you're OK and there's a bit of a safety margin.
In a nutshell, we are taking advantage of the fact that digital meters do work very much like the mechanical one with the ratchet, stiction and inertia. And when you think about the pulsating nature of electrical energy, imaginary currents (the reactive component) and vars, they have to.
And if you want a number, I think (though I don't know) that most digital meters work on units of 1 Wh (3600 J), though there is also a minimum current below which they don't register anyway. This does vary quite a lot between different meters and usually works out at around 1cfl light bulb (i.e. 5 - 10 W)
While slightly off topic, as you have a meter which reverses then dependant on an alternative water heating fuel and cost i.e. gas or oil, would you not be better off letting the meter reverse during generation and then heat water via gas/oil? Usually electricity is much more expensive so you'd be cancelling out what you'd already used (improving the system pay back period). At least until your meter is replaced.
Dennis I`m arfraid I don`t understand your post.
At the moment, with reversable meter, the grid is acting like my own giant battery. Whenever I export it builds up my `credit` then when I need more power than I am producing I just re-import at no cost - because I have a fairly constant 24/7 generation of 3 to 4 kw my meter reads about 20Mw less than it did when I started producing. (so even with re-import, I`ve still exported more than I`ve used). This is pretty much an ideal situation with only one drawback: it`s not allowed. Once the power co gets around to changing the meter (they have known about this for ages, just slow to react and keep missing appointments) then a power diverter will be the best way to ensure full utilisation - in winter, as in summer I`ll probably end up exporting about 75%.
Robert. I imagine that the meter co`s could shorten their sampling time if they wanted to but then again we are not trying to rip off any free power as we replace what we borrow for microseconds.
I'm afraid it doesn’t work like that the grid is acting as a very small battery and thats what the MK2 is taking advantage of, you export at one (low) price but import at another (high) price that’s why you need to use or store as much power as you can. With your turbine system you have the luxury of being able to generate power 24/7 (I am envious). The system that Robin has designed mimics the way the meter works be it analogue or digital it measures consumption or export and averages out over a relatively short period of time.
My provider managed to change my meter over after (only) eight weeks, I wasn't going to complain but the switch over was inevitable.
It's taking forever for the electricity co's to switch to digital meters so I don't think shortening the sampling rate will be an issue for many years, just think of the cost doing that country wide, anyway all we would need to do is adjust the energy bucket to compensate.
P.S. triac side working fine, have ordered hardware, I think me and the wife may have to visit to supervise installation.
Rich. Eh? My disc meter DOES work that way. I have as I said approx 20Mwh to use up before I get back to the original meter reading when I first registered for ROCs. No doubt PowerCo will get it together to change meter soon......
But yes a non reversing meter will only store a tiny amount.
I dont think it would be possible to outgun the meter designers if they put their mind to it. They need a pair of samples at some minimum time spacing to work out power consumed-which could be a single joule or 1/1000th of a joule whatever but we have to insert our own reading and decision making (ie more computation than they need to do) within that same time frame.
If such a meter were invented and installed then the only way ( I think) to have power diversion would be a binary switched system matching output to load by adding or subtracting discrete resistances. This would be far less accurate: you`d need 5 immersion heater elements to get 3kw in 100w steps. And expensive.
The problems of dealing with reactive loads may make a decent sized energy bucket a necessity but that sort of theorising is way beyond my pay grade.
Fine to visit: we have a spare bed (actually about 50 spare beds as we used to run a bed factory). Maybe I could interest you in a bed/mattress/bits of wood/surplus woodworking machine? Bring bicycles.
Brilliant! Yes your meter you have now is sucking the profits out of the power company (gosh I feel so sorry for them), but when you have the inevitable new meter, that's when it changes.
I have some great photos taken at a local mill that I'll post a link to, you will defiantly find amusing.
Out gunning the meter designers will be easy, I have a cunning plan Baldrick.
Re meters and energy bucket
tried the controller on a few types of digital meters and they seem have about a three second window to fool them the disc meter is more forgiving and provided the power kick backwards is not too big they will run backwards but not for more than a turn. If the meter manufacturers did change they could not go less than a cycle otherwise reactive loads would be charged. If they went to a single cycle then phase control would be the alternative.
to avoid being charged the energy bucket ( infinite memory integrator to us analog types ) needs to have leak corresponding to the averaging time of the meter this is set by the safety margin which needs to be 60W for an average time of 1 second however I have set it to zero and it still doesn't register on the digital meter but it does on the disk an accurate power meter confirms that import is occurring . I have to assume that the anti creep in the digital meter is being exploited as well i shall look forward to my meter being changed hopefully for one with a nice anti creep.
hmm, but even if you got a 'nice' anti creep meter...
how much could you actually exploit it... when the sun isn't shining i mean.
after all , all the other things in the house (fridge, wifi, clocks etc) would be using the leccy under the 'creep' threshold wouldn't they ?
just enquiring ;)
"all the other things .... would be using the leccy under the 'creep' threshold wouldn't they ?
"all the other things .... would be using the leccy under the 'creep' threshold wouldn't they ?
That's not likely. Anti-creep is set at between 20 - 50 mA for most of the meters that I've seen data for (i.e. under 12 W), so clocks and wi-fi might get away with it, but add in a single cfl lamp and you blew it, and run a fridge on 12 W ?
Yes, I think that's what I meant.
Any possible exploit benefit would just be lost in the normal background usage.
The threshold is too small to be useful, except for modulating/balancing a large load while keeping import/export just right.
Re Yes, I think that's what I meant
the exploitation wasn't intended to save power in normal use just less safety margin than you might otherwise calculate.
my initial measurements give a bigger variation than the expected +\- 60W. This is probably due to my low ct output and the plesiochronous nature of the sampling I thought I saw someone post an interrupt driven venison of robins code but can't find it.
There a post earlier about flicker . Robins code produces a 12.5 Hz current at half power due to the interleaving. Human sensitivity is maximum at 8 Hz so if the interleaving could be removed this would raise it to 25Hz less irritating for the people with dodgy mains and incandescent lamps/halogen who should be shot anyway. Before anybody quotes a standard the mains flicker standard is EN61000-3-3 and we are quite safe as 14.6A change is required to fail and 3kW is under that.
Stuart is the author
When our PV is inactive, the house invariably draws more current than is allowed with 'anti-creep' mode. Every Joule that is consumed by our fridge, broadband router, phone base-station etc. is chargeable.
Once our PV gets going, any excess power is diverted to the immersion. The net flow of power through the meter falls to virtually zero and the meter enters its 'anti-creep' mode. By setting safetyMargin_watts to a small negative value, I believe it is possible to bias the system such that a small amount of extra power is taken from the mains without it being charged for.
A value of -10 Watts is well worth a try. Go for the largest -ve value that you can get away with. Remember that most state-changes of the meter's LED are chargeable (even going from on to off)
“Robin’s code produces a 12.5 Hz current at half power due to the interleaving. Human sensitivity is maximum at 8 Hz so if the interleaving could be removed this would raise it to 25Hz less irritating for the people with dodgy mains and incandescent lamps/halogen who should be shot anyway. Before anybody quotes a standard the mains flicker standard is EN61000-3-3 and we are quite safe as 14.6A change is required to fail and 3kW is under that.”
http://www.reo.co.uk/files/handbook_en_61000-3-3_and_en_61000-3-11.pdf mentions the 14.6A on page 12 which gives a 3% voltage fluctuation on the supply volts. But also on page 13 it has a graph that implies that the 3% only applies at flicker rates less than one per minute. I am assuming our burst firing mode is equivalent to its "rectangular voltage fluctuations". At Robin’s 8Hz the limit is not 3% but 0.3%. So I interpret it to mean that you can not meet this spec with this design. Even if you artificially overrode the bucket algorithm to limit the frequency to be either more than 25hz or less than 0.25hz you would still need to meet 1%, which limits the load to around 1kW. Am I correctly interpreting this?
On page 9 it says that burst firing on larger loads can not meet this spec.
“Robin’s code produces a 12.5 Hz current at half power due to the interleaving.
If the impedance of the mains connection is sufficiently low, there will no flickering of lights as loads are switched on and off. At our house, the application of a 3kW load appears to reduce the mains voltage by around 2V, or 1%. This will cause the power taken by a light bulb to be reduced by around 2% (because both voltage and current are 1% down).
At half power, my interleaved algorithm is likely to put the triac on for two whole cycles and then off for two whole cycles. This sequence will repeat at 12.5Hz. Any flickering of the lights is therefore likely to occur at this frequency.
While my Mk2 system has been in operation, have I ever been aware of flicking of any lights? The simple answer is "No". Having said which, while the sun is out and the system is operational, we're unlikely to have many lights on. At the next opportunity, I must check in some dark place where the sun don't shine (loft or eaves) to see whether I can discern any flickering from the lights there (in both cases, these are still old-style bulbs).
Prior to Mk2, I used a Carlo Gazazzi AC Controller which apportioned cycles evenly over a 64-cycle window. At one-eighth power, the output sequence would presumably repeat at 8Hz, albeit not with a square wave (one cycle on, then seven off ...)
So, how feasible would it be to alter the 'sequence repeat' rate of Mk2? Because the sampling is asynchronous with the mains cycles, I don't think it would be wise to bring the triac on immediately that the level criterion has met. That's because the first positive sample in the new cycle may be in time to arm the trigger, or it may be too late. If it were desired to fire the triac immediately for an even faster response time, then the measurement window would have to stop slightly earlier at some designated voltage level towards the end of the previous cycle.
Reducing the sequence repeat rate would be simple enough. With an additional counter, it could easily be arranged that the triac never goes on for fewer than, say, five or ten whole cycles at a time. The flicker rate at half power would then be 5 or 2.5 Hz respectively. If this approach were to be adopted, I would recommend increasing the energy bucket's threshold level so that once the triac has gone on there will definitely be enough power in the bank grid to complete the operation.
A better approach may be to prevent the triac from turning on if has been off for fewer that a specified number of mains cycles. In that case, the threshold value should probably by reduced. Cycling less frequently means that larger amounts of energy are moving to and fro through the meter. This will eat into the charge-free window that meters allow but should be OK I think.
More complex algorithms could no doubt be devised which would avoid cycling at certain frequencies. Debug mode, using my original sketch, would be an ideal vehicle for developing such logic because any desired value of surplus power can be specified - there's no need to wait for the weather to oblige.
I have had robins setup running for a couple of months and it has been working great, but it has suddenly stopped working. The pin 13 led is permanently lit. If i press the reset button it lights after 2 or 3 second and will not go out. The circuit board seems ok and cant see any fried components. When the controller was working ok the only time the led was permanently lit was if the immersion tank had reached full temp.
Any ideas what could be causing this problem.
Problem solved i changed the analogue inputs from 1 and 2 and moved them to 3 and 4. I wonder what made my analogue inputs blow
I've no idea what might have caused that fault, but well done for sorting it out. Do you have protection diodes fitted?
If the voltage input (a2) stops working, you'll lose the cycle count and the accumulator (energy bucket) could do anything.
While the led was fully on, you were presumably heating your water ...
"I wonder what made my analogue inputs blow" - A spike coming in down the mains?
You can get special high speed MOVs for that purpose - Farnell I know do them, so does http://spiratronics.com/ The more impedance they have upstream, the better chance they have of limiting the spike.
Yes robin i do have protection diodes fitted, my guess is that it was a voltage spike as my house is right next door to the hv transformer and my mains voltage never drops below 253v
Normally one of these is of little use but with 253V might be worth considering they reduce the mains voltage to 230V (what all pan European appliances are designed for) that would save a fair amount on your power bills and most units incorporate some form if filtering. As your voltage is 10% up on 230V I'm sure there would be a saving for you on non resistive loads (everything but kettles and heaters)
Gosh your kettle must boil up quickly!!!
“Cycling less frequently means that larger amounts of energy are moving to and fro through the meter. This will eat into the charge-free window that meters allow but should be OK I think.”
If my last post was correct the repetition rate needs to be lower than about once per 30 secs for presumably a 50% mark space. Not sure though if that 30 secs would be relaxed or worse at other than 50%. What is the max number of 3kW cycles a typical digital meter will pass before clocking up one increment of energy? I very much doubt it is >1500 which is what we need. I.e. the measurement can’t be canceled out by reversing the current in the next period of time. Lot of talk here about wheel meters but they are passing technology so should not be designed for even though I have one.
My unit is in a dark airing cupboard and I can tell from the old style light bulb in there that visible flicker is always present even though the bulb is not on the immersion circuit, but shares the same consumer unit.
richmc, the link that you've kindly provided leads to a Vphase unit which is available from wholesalers such as Edmonson. In their documentation, there is a downloadable PDF file which sets out how the device should be installed when there is "Embedded generation" at the premises.
At the top of the page, there is a schematic diagram showing a typical installation. This is supplemented by a block diagram which shows how the current flows through the various components. When comparing the two diagrams, there appears to be an inconsistency. I therefore rang the company and it turns out the block diagram is indeed incorrect. Current into "RCB0 No9" should come directly from the "Vphase" box rather than via "RCD No1".
Their online documentation will now need to be updated, as will their various flyers when they next have a print run. My suggestion that they might provide me with a free unit in recognition of my technical assistance was graciously declined.
Could the Vphase react fast enough and to sufficient stability to limit flicker to 0.3% at 8Hz? Simple stabilisers I have seen are basically a multitapped transformer with relays to select the right tap to get the desired voltage output. There is no way such a device can react fast enough.
The point of me posting the Vphase was in response to the horrendous over voltage that JimJam has, this must be costing him loads in excess power and shortening the lifespan of TVs, computers, and other domestic appliances the thought of filtering was an observation regarding spikes, flicker? I don't have it so it's not my concern.
I think his supply company should be giving him a free unit. (as well as you calypso_rae).
I was wondering what was inside that device! If it's a transformer, it is probably an auto-transformer with only high current windings at the top end. It just might be switched with thyistors/triacs. The thermal limits quoted and the need to connect high current loads bypassing it mean it's design is an understandable compromise. As you imply, a device that relies on measuring the voltage, rather than depending on some intrinsic property that's voltage-dependent, will have a hard time following dips of 1 cycle in length.
I once had a little bit to do with a static compensator, the control element was saturating reactors and there was no switching nor active control circuitry at all. It was combined with a harmonic filter. It worked because both the system and the load were inductive - the load was a thyristor drive - so adding capacitance would lift the voltage to compensate - the amount of capacitance that the grid saw being controlled by the reactors. (I never did understand in detail how it worked - but it did). I guarantee that didn't have relays in it - it was on the grid at 11 kV.
 richmc - isn't lamp life proportional to something like V4 ? ! ! !
I think the idea of Vphase is simply to reduce the mains voltage to a lower and more constant voltage. There's no information about how it works, but it looks to involve some active means of changing the voltage rather than just a collection of passive components.
As stated in the guidance notes, any embedded generation capability (e.g. PV) must be connected direct to the mains rather to the reduced supply. An immersion heater would not not normally be fed via the reducer because that would consume most if not all of the power that the box can deliver.
fewyatt: What is the max number of 3kW cycles a typical digital meter will pass before clocking up one increment of energy? I very much doubt it is >1500 which is what we need. I.e. the measurement can’t be canceled out by reversing the current in the next period of time.
Not sure what you're askingt here. Our digital meter records every 0.001kWh of consumed energy, which is 3600 Joules. A 3kW load consumes 60J every mains cycle, so a pulse is seen at the meter every 1.2 seconds. Apart from the anti-creep mode which cuts in after a few minutes of minimal consumption, there are no timing constraints in the meter. While energy moves to and fro through the meter, it's only the amount of energy that's involved which matters, not the time taken.
Have you checked the voltage drop on your mains when a 3kW load is applied? Ours is around 2V if measured on a separate circuit, but nearly double this value on the same ring main. Sorry, I forgot to check for flicker today :(
"richmc - isn't lamp life proportional to something like V4 ? ! ! !"
Yes Robert over voltage is a killer for old style filament bulbs good riddance to them!.
" I can tell from the old style light bulb in there"
Fewyatt - Get rid!, there are loads of places giving away low energy bulbs, where I live is a volunteer run eco info place, they give them away, just walk through the door!
Where lights will only be on for short periods, Class A eco-bulbs make little sense to me because they don't reach full brightness straight away. Class C halogen bulbs are the preferred solution, but old-style filament ones are an obvious alternative.
If my airing cupboard were ever to gain a light fitting, it would certainly have an old style bulb in there. I can't throw away things that still work! Inspection lamps are another good outlet for filament bulbs, they never seem to last long.
Class C are "dimmable" whereas Class A are not (sorry, Rich, if I've described them incorrectly)
OFF TOPIC but all the same needs to be said
I agree totally, no need to replace lamps that are only on occasionally! ..but where they are on for sustainable times I would suggest an LED type.. 5w will produce the equivalent 60 - 80w of filament / dichloric light and should (but yet to totally convinced) in theory last up to 50,000hrs (especially if it does not comes from China) Warm up time is instant!...This is the way it will go beyond doubt! Prices are still falling and will continue to until there is no other option or the price of fluorescent powders used in their manufacture become a commodity that bankers start betting on!
I work for a signage company and recently our illumination method for signage has surpassed 50 percent LED powered of all our lighting methods with 80+ lumens per watt the norm for a good LED system. As a gauge a 58w triphosphor fluorescent lamp(with additional substantial control gear losses) are being replaced by 7- 10w of LED lighting power
This will continue until phosphor markets are classed as a commodity and bet on their' futures' and drive up their value then that will inevitably lead to over inflated prices and an end to ever lowering costs of LED lighting!
Totally agree Mark, As long as they are a decent quality LEDs are the way to go at least for kitchens and bathrooms, mine are totally GU10 LEDs 2W ones replacing 50W halogens 15 lamps in total saving 720W (when they are on) the rest of the house has "curlies" (that I got for free) and only two fake standard bulbs that are halogen 32W.
At least I know where to come for spares now! ;-)
I don't where to discuss this topic as it i so off topic .. is back 'there' room for this dicsussion?
Just for the record, I have no intention of replacing incandescent lamps before they expire naturally, either.
In the gloom of our dormer bungalow's eaves, the two filament-style bulbs can indeed be seen to flicker slightly when Mk2 is diverting surplus power. If I were to remain in there for a while, this effect could perhaps become irritating.
However, in our kitchen with the blinds drawn, I genuinely can't detect any unsteadiness from the three halogen bulbs at any level of power via the fitted phase-angle dimmer control. And in a separate part of the eaves where there is a flourescent light, this too appears to be immune from this effect.
Although some degree of flickering is now known to be a likely side-effect of the Mk2 design, I doubt whether this would constitute a problem in the vast majority of situations. I certainly have no intention of changing our rig for this reason.
If this side-effect had to be avoided, some other means of diverting surplus power would be needed. Given the restrictions of supply meters, I think the only realistic alternative would be to use phase-angle control.
Varying the power to a 3kW load using phase-angle control would be easy enough to implement, but would no doubt require the use of EMC filtering. This is an area about which I know no-o-o-thing Meesta Fawlty ...
Our digital meter records every 0.001kWh of consumed energy, which is 3600 Joules. A 3kW load consumes 60J every mains cycle, so a pulse is seen at the meter every 1.2 seconds. Apart from the anti-creep mode which cuts in after a few minutes of minimal consumption, there are no timing constraints in the meter. While energy moves to and fro through the meter, it's only the amount of energy that's involved which matters, not the time taken.
I assume these digital meters also work like a small bucket. Import fills up the bucket and export empties it. When the bucket overflows the meter clocks up one unit of energy and the bucket empties quickly, ready for refilling.
If the meter has a 0.001kWh bucket (3600J) and that takes 1.2 secs to fill then your unit has to switch the load on a least every second to prevent the meter incrementing. As the EMC spec can only be met with repetition rates of more than once per 30 secs (if I was right above) there is no way burst firing can meet the spec.
It might be worse than this because whilst the meter display increments at 0.001kW there may be an internal bucket that is clocking up smaller increments and only displaying them when 0.001kWh is reached. Say it is internally counting in +0.0001kW (import) steps. Once one such step is saved it is no use making the next step -0.0001kW by turning off the triac as it does not necessarily cancel the previous +ve step, if only +ve steps are saved, with the –ve ones maybe thrown away or just used to put the reverse LED on.
In the extreme a meter could work with a bucket only one cycle long at the maximum current rating of the meter. If it is a 100amp meter that makes the bucket 480J or 0.00013 kWh. I would have thought though that smoothing the measurement over >5 cycles or so would make more sense so that makes it 0.0006 kWh which is around the same as your 0.001kWh display update increment. So that probably means that it does not in fact have a smaller bucket than 3600J.
I have looked at the spec sheets for the core chips that go into digital meters and they are very vague about the integration period of the measurement, i.e. bucket size.
As a gauge a 58w triphosphor fluorescent lamp…….. are being replaced by 7- 10w of LED lighting power
Don’t agree with that. I find you can replace a 60 W conventional incandescent with about 8W of LED or 15W of CFL. That is unless you are comparing the concentrated illumination of a LED against the omnidirectional output of a conventional incandescent or fluorescent.
My incandescent lamp is deliberately there to check flicker and dips. I have not yet measured the drop.
The horrendous over voltage that JimJam has
JimJam have you tried to contact your utility company? I have high voltage and complained to Southern Electric, even though I use Eon for the billing. Within 2 days they were round and attached a voltage logging device. After 2 weeks of measurement they said I was just within the spec so they would not be reducing it. But they seemed very willing to do so had the logger proved overvoltage.
Happily it doesn't seem to do that, I've had a couple of days when I've been able to check from when the Mk2 starts to work till the water is hot, other appliances being run when they don't cause import, and over several hours the meter has not increnented at all, yesterday was consistently overcast and only the domestic background and my PC were running most of the day, The demand trace of the Eco Eye software was "straddling" the PV O/P line fairly constantly through the day and the meter didn't increment at all.
BUT the Eco Eye trax analysis graph showed me as energy usage exceeding generated, this is clearly wrong, as the meter didn't budge.
I think the concept of an 'energy bucket' in the context of the supply tariff meter is misleading. As far as I'm aware, most meters have two properties of interest to this discussion. The first is the smallest unit by which the register is incremented. The second is the minimum current below which consumption is ignored. The smallest chargeable unit is 1 Wh. The minimum current equates to around 10 W (but seems to vary rather more than the minimum unit, which seems consistent). There must be an integration time, it must be a whole number of cycles, but I've seen no credible value for it. My best guess is 200-300 mS, based on the Atmel demo software, and this seems reasonable to me.
Therefore, if all the above is correct, while the energy drawn remains less than 1 Wh, nothing is charged. If the current remains below the 10 W level, nothing is charged. Operation outside these limits will probably result in a charge.
Unfortunately, and for obvious reasons, the meter manuals and data sheets are rather coy in this area.
It might pay to search back in the forums for the results of the tests that established much of this data.
fewyatt: I assume these digital meters also work like a small bucket. Import fills up the bucket and export empties it. When the bucket overflows the meter clocks up one unit of energy and the bucket empties quickly, ready for refilling.
Yes, that sounds right. The meter's accumulator also keeps track of a small amount of exported energy - probably 0.001kWh's worth - and that energy is freely available for re-use by the customer. In this situation, the meter's LED is on. When the LED goes off, that means that you've just run out of purchased energy and been charged for another 0.001kWh's worth (the same as when a pulse occurs)
If the meter has a 0.001kWh bucket (3600J) and that takes 1.2 secs to fill then your unit has to switch the load on a least every second to prevent the meter incrementing.
The meter only increments when the house is importing. If the house is importing at 3kW, the meter will pulse every 1.2 seconds. If the triac were then to turn the immersion on, that would be an additional 3kW of consumption so the meter would pulse twice as quickly.
The triac only operates when there is surplus PV, its purpose being to prevent surplus energy from being exported. If the meter's LED were ever to pulse (or go from 'on' to 'off') while Mk2 is active, that would mean that the measurement circuitry had drifted relative to the meter, and you have been charged.
RW: while the energy drawn remains less than 1 Wh, nothing is charged.
Yes, after a chargeable pulse has occurred, the next one will only happen when a further 1Wh has been drawn from the grid. If, before drawing that amount of additional energy, the flow goes into reverse, the LED will go on when the same level is reached that caused the pulse to occur. The user can now 'export' a further 1Wh's worth of energy without loss. In this situation, the LED remains on until the meter's accumulator has reached a level that is 3600J greater than at the last pulse. When this eventually occurs, the LED goes off, this being is a chargeable event, just like a pulse. Diagram attached.
If more than 1Wh's worth of export occurs after the LED has gone on, the internal 'step' levels appear to reset. When consumption re-starts, you'll probably be charged after 3600J has been consumed (rather than the up-to-7200J's worth that can be freely available if this 'over-export' situation had not occurred).
If the current remains below the 10 W level, nothing is charged.
This is the 'anti-creep' mode which cuts in after a few minutes of low consumption. When Mk2 is diverting power, this is the ideal mode for the meter to be in. In anti-creep mode, the LED is on, but the LED can also be on for other reasons. While our tank is heating, the LED is generally on which means anti-creep mode. On a good day, once the thermostat trips out, the LED remains on while surplus power flows away to the grid. (Technically, the meter may still be in "anti-creep" mode while export is taking place)
double post somehow!
I have decided that my response to this post is too far off topic and would welcome it to carry on else where!
Mark, start a new thread!
fewyatt re : As the EMC spec can only be met with repetition rates of more than once per 30 secs (if I was right above) there is no way burst firing can meet the spec.
I have looked at the flicker spec again and the reo explanation and have to conclude that your interpretation is correct the reo consultant who wrote it used to work for me and is an excellent engineer I think it highly unlikely that his interpretation is wrong. It is not therefore possible to make this design universally legal. For it to be legal you would have to prove that the % voltage drop due to a 3kW load turning on is less than 0.3% mine isn't . I see in the spec you are permitted to do this. the reo doc also says you can use the industrial higher limit if you have a guaranteed 100 amp per phase supply but doesn't say what the higher limit is. The other way allowed is to ask permission of the DNO to connect. I have put two of this design of controllers in where flickering was a problem. In one case we traced it to a faulty isolator but in the other case the mains itself was the problem and I had to change it to a phase controller type as it was interfering with the neighbours as well who had reported it. fortunately we changed it before they traced the cause.
I did some conducted emissions tests this week and the almost zero crossing triac is out of spec by more than 30dB. it requires a filter. A normal common mode line filter will not suppress this type of device it needs a choke. If anybody is interested I will posts the results.
All of this is most disappointing and leads me to conclude that I should finish the phase control filter work I had started but put on hold for robins design. The interrupt driven solution of Stuarts can easily be adapted to phase control just need to to find a way of measuring and and passing harmonic spec lol.
I've looked at the spec, and a few quick sums seem to indicate that a load < 650 W would be acceptable. Is this interpretation correct - it's based on the test system impedance rather than the actual, but I'm thinking that if the device under test passes under test conditions, it is acceptable even though the system fault level may be lower and the flicker correspondingly worse and possibly outside the limits?
So maybe the answer is load of 650 W immersion heaters, only one of which is burst-fire, the rest switched by relays!
<removes tongue from cheek>
My PV Simulation for MK2 PV controller. Having built Calypso_Ray’s MK2 PV controller I had to find a way of testing it. My problem was the main consumer unit and all the meters are in a very small cupboard under the stairs, The inverter is in my detached garage and my workshop is at the top of the garden.
I decided the best approach was to build a simulator using SCT-013-30 split core transformer. The transformer normally clamps around one of the cables between the consumer unit and the main supply meter. To simulate this I put three windings on the clamp transformer. One single turn winding to be connected in series with the load, and the other two windings (one single turn and one ten turn) were to be connected in series with the simulated PV power supply (only one used at a time). These windings had to be connected in anti-phase to the single turn load winding, so that output of split core transformer zero if the power in the two windings were the same. Go to this link to see a video. Sorry for any errors I made in my commentary, I don’t think Hollywood is ready for me yet. http://www.youtube.com/watch?v=QeU6lzl4rVs . I have also designed a De Lux MK2 PV controller Interface circuit using the LMV358MX IC as a buffer/Amp. The only problem that you may have is that this IC is a surface mount device, but if I can do it, then you can do it. The De Lux circuit was used for the above simulation.
Brian's idea of simulating PV-generated power is superb. I've just added a simple extension cable to my rig, one core of which passes eleven times through the CT. This simulates the generation of additional PV power of ten times whatever load I apply. If I power up a 60W bulb using this extension, the CT's output is exactly as if 600W of extra PV power were being generated. If I power up a 750W space-heater, that's equivalent to an additional 7.5Kw of PV. If no current is flowing, the presence of the extension has no effect.
By powering up different loads, the equivalent amount of suplus PV can be adjusted to whatever value is required. If there is already some surplus PV, the extra 600W provided by a 60W bulb causes the immersion (plus its associated neon and the Arduino's on-board LED) to flash 'on' more frequently. When our oven was on just now, 600W of extra surplus power was not enough to bring the immersion on at all, but the effect of the 750W heater (times ten) immediately caused it to go fully on, as expected.
This additional wiring also provides a fail-safe way of setting up one's circuit on occasions when the PV is inactive. Having failed on a few occasions to leave the rig in a working state - and consequently lost several hours' worth of generated power next day - I think this is a wonderful additional to any rig of this type.
Pic attached. I've used the Magnelab CT purely because the aperture in the standard YHDC one was too small for the additional wiring. The white cable goes to a standard 13A outlet. The blue & brown cores go to a trailing socket into which mains loads can be plugged as appropriate. The black/white pair of wires go the the current sensor circuit. Because the Magnelab CT is less sensitive than that of the YHDC, the calibration is out by around a factor of three. The system still works just as before except that it now takes longer for the bucket to reach its half-way point. At very low rates of current, there will no doubt be increased quantisation distortion because fewer ADC levels are spanned. This drawback could be immediately cured be increasing the value of the burden resistor.
Of course, if you really wanted to be clever, you could do the same with a low voltage (say 9 V) transformer, a potentiometer and a centre-tapped resistor chain, and feed a few mA in to where the c.t. normally connects.
R1 & R2 are ordinary resistors, R3 & R4 are a wirewound potentiometer. R5 is the burden resistor, connected at Ct_a and Ct_b. This will drive 8 mA - the equivalent of 16 A of current - in either direction. (In real life, the whole circuit has to float, picking up its reference level from the Arduino input circuitry, so ignore the earth - it's only for LTSpice's benefit).
Yes that would work Robert, but my idea was to simulate the MK2 PV controller with a full load as it will be when installed in the house, so I could check how well it tracked from 5W to 3000W. I only managed to achieve the very low readings with my de lux interface.
As you saw at the beginning of my video with my scope, using a times 10 probe, giving a gain of 10mV per division, I found a lot of background noise being picked up and even with the simulator switched off, the lamp would occasionally flash. It was very difficult to get a reliable simulation below 50W. With the De Lux circuit I managed to achieve 2.5W. I designed the new circuit more like a microphone input but without the high gain. The most important thing is grounding, where all the ground points go to a central point like a star. An example on the bread board was that I made the mistake of having the grounds for the two input transformers strapped together and then connected through a single wire to a bread board ground point. The higher current from the voltage reference transformer generated a small voltage across this single wire that added to the low voltage coming from the split core transformer causing errors. There is a saying look after the pennies - look after millivolts and the volts will look after themselves. Remember when this circuit is working correctly it will be looking at these very low levels to obtain the maximum efficiency.
Very elegant Brian. I think the main problem with measuring low signal levels with CTs is the noise they pick up, I would try a much larger value of feedback cap across the top op amp you are only interested in 50Hz so talking it up to 100nF or even 1uf to get rid of the HF noise. This is in addition to the software filters in the sketch.
Or possibly an audio type balanced input to reject noise?
I've never been aware of any noise problems at low levels of current. With no deliberate 'safety margin', my circuits have always operated within the anti-creep window that our supply meter allows. I really like the idea of checking that the rig is still working at any time by turning on a bulb for a few seconds.
If Brian is trying to look at levels down to 2.5W, then I can see noise being an issue, personally I'm not interested with trying to squeeze every last watt from the system as you say calypso _rae it works within the anti creep window, that's all that its important to me.
I did not set out to achieve very low levels but to ensure good stability and follow good design practice. Having designed and been involved with high quality audio equipment over many years, I have become reasonably knowledgeable and though this design may seem a little more complicated, I think it's worth it. The whole point is if I can simulate down to 2.5W then the design can't be bad and should be very good at 50W. This circuit also adds an extra level of protection to the Arduino with the LMV358MX. The inverting input used giving a 10K input impedance. This input is also known as a virtual earth input and if a scope was connected to this pin very little if anything would be displayed. If the input of circuit was connected to either 5V or GND the input on the virtual earth pin would never get to these levels. The virtual earth can be considered as the fulcrum point of a Childs seesaw as it doesn't move. The two 8K2 resistors between the output and An1 and An2 are added protection but are possibly unnecessary.
Richmc idea of a balanced input is good, but I think unnecessary, and would only make it more complicated. Also I haven't seen a clamp transformer advertised with a balanced output. As far as the feedback capacitors are concerned, if size was increased to say 1UF, phase shift errors are likely to occur and you must remember that the mains wave form is not a pure 50HZ sign wave but a lot more complicated with many harmonics.
Remember this is only the interface and I can only give my opinion on this part of the project. Robin is the main brains behind the project and without his knowledge in programing the Arduino I would have not had the opportunity of getting involved. I haven't got a clue how to program the Arduino and had not even heard of it before I stumbled on this forum.
BBTV: Remember this is only the interface and I can only give my opinion on this part of the project. Robin is the main brains behind the project and without his knowledge in programing the Arduino I would have not had the opportunity of getting involved. I haven't got a clue how to program the Arduino and had not even heard of it before I stumbled on this forum.
This thread is a great example of collaborative thinking at its best, and many people have contributed to help it get to this stage. Your idea of having an additional circuit or two on the CT provides a really neat way of testing an actual system in situ. Test rigs never provide quite the same level of confidence as the real thing. The way that you've simulated PV power generation is far more effective than any software tweak that I've used in the past, such as running the sketch in debug mode.
Although the initial design is still holding up, there are no doubt useful improvements that could be made. Before rebuilding my own rig for the long term, I'm keen to ensure that each part is as well refined as it reasonably can be. I think it's important to retain a simple construction, so there needs to be a really good reason before adding any new component of significance.
For what it's worth, my thoughts for the rebuild include:
- Use a better voltage sensor (the waveform from my 'telecom' adapter waveform is awful, much worse than the Mascot)
- Keep the CT's output below 1V ptp. To make best use of the ADC's input range, the easiest approach is set analogReference() to INTERNAL (1.1V). This, in turn, means that Vref will need to be 0.55V. This is different than the standard OEM approach but should provide a much improved quality of signal from the CT. In particular, the phase-shift will be much reduced which can only help with the system's linearity. For this application, linearity is everything.
- Retain the single buffered reference and the twin floating sensor without any further amplification. This all works nicely and is very straightforward (unless anyone can convince me otherwise ...)
- Although stripboard would probably be fine, I certainly intend to make use of richmc's PCBs :)
- Sketch to be tidied to aid readability.
- Possible use of interrupts, mainly to minimise timing jitter
- Possibly make the output mode selectable (i.e. to run either in whole-cycle bust mode or in phase-angle control mode). The output circuitry would need to be assembled for one option or the other
All input welcome!
Taking the reference down is usually not a great idea as the adc will sink into other errors such as sample and hold plus noise but best proof is to try it.
If the output Opto was changed to the random fire type it would do both phase control and burst fire without change as burst fire is only firing the triac close to zero and phase control is firing it at a variable delay.
It would be nice to have the pcb for the triac dive laid out to include the zero cross detector posted on the no voltage thread As well the pin out for the random fire Opto is the same so no change needed In the pcb for that.
the interrupt code of Stuart's has had the final bug of not firing correctly on the timer fixed over the weekend so this can now be used to run from an external interrupt and or from internal timer which may have some uses here.
When you did the conducted emission test, were you using the dedicated zero crossing trigger (MOC3041) or a software-generated zero crossing?
"Taking the reference down is usually not a great idea as the adc will sink into other errors such as sample and hold plus noise but best proof is to try it."
That is what I would have thought, there seems to be anecdotal evidence that "ghost" power - readings when no current is flowing - is more likely with plugboard or stripboard layout and this seems to suggest that grounding / earthing / screening has not been given sufficient attention. Having said that, the Atmel app.note uses the 1.1 V input, but presumably with a well-laid-out pcb (which they haven't published).
I think the concept of an 'energy bucket' in the context of the supply tariff meter is misleading. As far as I'm aware, most meters have two properties of interest to this discussion. The first is the smallest unit by which the register is incremented. The second is the minimum current below which consumption is ignored. The smallest chargeable unit is 1 Wh. The minimum current equates to around 10 W (but seems to vary rather more than the minimum unit, which seems consistent). There must be an integration time, it must be a whole number of cycles, but I've seen no credible value for it. My best guess is 200-300 mS, based on the Atmel demo software, and this seems reasonable to me.I still think the bucket analogy may be useful. Or it can be described as an accumulator.
2 theories, first one mine and calypso_rae's, second Robert's:
1) I assume the meter samples the voltage and current waveforms thousands of times a second. Every sample pair is multiplied and that will result in some positive (import) results and some negative (export) depending on current direction, distortion and the power factor. These are summed to the accumulator/bucket which “fills” up with no integration time. When full/above a certain value (smallest unit by which the register is incremented ) it has clocked up one unit of energy which is either directly clocked to the display or added to previous values and when that sum reaches a set value it is displayed as a chargeable import.
During burst firing or phase control many samples will be negative so the value in the bucket/ accumulator goes down when they are. If it goes below empty/zero by some value (a third property in Robert’s terminology?) that will be seen as a reverse/export and ignored as far as energy counting is concerned and/or a reverse LED is turned on. Don't quite follow calypso_rae's diagram on the reverse light.
All this has to be done in increments of whole cycles as the bucket/accumulator may be full half way through a cycle yet be not full by the end.
The trick for us is to keep the value in the bucket/accumulator above zero and below the overflow value. But not quite sure what happens it you hover around empty as the bucket/accumulator may discard results below zero so a constant import could be registered even for a real zero import/export.
2) Rather than clocking up a unit when the bucket/accumulator reaches a set value, the meter adds up all the thousands of samples in a fixed integration time period like 200-300 mS that is a set number of whole cycles. If the summed value is positive it is added to a totalizer register. If negative it is ignored. At a fixed display update period, like one second, the new totalizer value is displayed. If more than a small amount of negative value is received for more than a certain amount of time the reverse LED is lit.
If the burst firing is turned on for too large a number of cycles in a row in both cases it records import but the off periods that allow export can not cancel out this cost.
Microwave ovens also burst fire to modulate their power but it is all quite slow like cycling once per 10s of seconds. And they are <1400W input for a 900W output.
Some comments on fewyatt's description of digital meters:
Yes, that all sounds fine. Our meter only shows whole KwHours, so the displayed value is only updated after the internal register has been incremented 1000 times.
OK, here goes... After much time spent switching various loads on and off, my diagram simply shows how our meter operates. Let's say that a pulse is recorded when the meter has reached point X on the consumption scale. Providing that the consumption level does not drop below below X-3600, you are free to use all of that purchased energy. That will take you up to X+3600.
If the level temporarily drops below level X, the LED immediately comes on and stays on until X+3600 is reached (at which point the LED goes off, that being the next chargeable event). If, however, the level ever drops below X-3600 (i.e. we're exporting), the deal's off, and the next chargeable event will occur at a value somewhat less than X+3600. Surplus energy has been lost, and you have to buy it back again to replace it
The bucket's level is only updated once per cycle because the triac's state only needs to be determined once per cycle. There's no reason why each individual energy contribution couldn't be added directly to the bucket, but it's more efficient to do it this way. Only the accumulated value then needs to be calibrated rather than every individual energy contribution. That's how it's done in calcVI() from which my code was lifted.
The trick is to keep within the charge-free zone that the meter allows; my 'energy bucket' is just a tool. If the level at the meter never drops by more than 3600J, you will never lose out. Thankfully, Mk2's operation is far more precise than this. All of the action happens within a range of just a couple of hundred Joules, so you should never be charged while surplus power is being diverted. The value of 1800J is entirely arbitrary; 500J would work just as well, as would 50000J. In the former case, the action would start to happen a bit sooner; in the latter case, there would be a lengthy delay while the virtual bucket slowly fills up and real power is leaked away to the grid.
Once the operating point has been reached, Mk2's behaviour is completely independent of what values have been used. Providing that the measurement system is linear, nothing else affects its operation. Because import and export are held in balance, absolute calibration of the system has no effect. Within reason, POWERCAL can be anything, but VOLTAGECAL needs to be a sensible value for correct operation of the trigger.
Discussions about the meter's behaviour are really helpful. Official descriptions seem hard to come by ...
LED lights discussion
> Submitted by markcarter10 on Sat, 22/09/2012 - 01:08.
> Don’t agree with that. I find you can replace a 60 W conventional incandescent with about 8W of LED or 15W of CFL. That is
> unless you are comparing the concentrated illumination of a LED against the omnidirectional output of a conventional
> incandescent or fluorescent.
> I have decided that my response to this post is too far off topic and would welcome it to carry on else where!
> Any suggestions?
Feel free to continue this discussion on www.talkingsolar.co.uk
The bucket's level is only updated once per cycle because the triac's state only needs to be determined once per cycle.
To be clear my post of Monday was only about the meter so any references to the bucket were to a virtual bucket in the meter and not in the controller.
As per PM with calyso_rae a compromise on flicker may be to limit the output by software so the frequency is never in the 2-15hz range. It is not going to fully meet the spec unless a smaller immersion element is used but this gets over the worst of it.
2Hz is 0.25 sec on or off. As rarely a 50/50 cycle take the worst case so BOTH on and off have to exceed 0.25 or be less than 0.033.
15Hz is 0.033sec on or off.
Let us assume we aim for no less than 0.25 sec or more than 0.033sec on or off. E.g. 0.1sec is not wanted. 0.25 sec is 12.5cycles is 750J at 3kW. So if you set the bucket at 750J and, instead of delivering one cycle, you continue firing till its empty 0.25sec is achieved. Or not quite because changes in PV and house load can also fill or drain the bucket in that time so it will change from 0.25sec a bit. Conversely in the off periods you allow the bucket to rise again to 750J before turning it on again.
A similar concept may be able to handle the above 15Hz range although it is difficult as a 75% ratio would give 0.033 off and 0.1 on, which is not allowed. So you have to stretch 0.1sec to 0.25 giving 88% ratio so “import” too much. If you follow this up with 0.033 on and 0.033 off the average over the 2 burst cycles is about 81%. Without doing the maths it should be possible over 2-3 burst cycles to maintain the desired average mark space ratio. Question is will the meter interpret this as zero cost? With my bucket analogy for the meter maybe it can. With Robert’s 200-300mS time window it will be marginal as 3 burst cycles may exceed the time window so not be truly averaged.
You may need three different macros depending on whether the unfiltered unit would naturally settle above 15Hz, below 2Hz or in-between.
The exact numbers like 2 and 15hz or whether both on and off have to achieve certain time periods depend on one’s interpretation of the flicker spec. I am not able to make this interpretation with certainty. The spec is listed in voltage transitions per minute so it could be argued that 0.033 on and 0.25 off has a similar flicker severity as 0.14 on and 0.14 off even though 0.14 is in my illegal range above. So the above may be rubbish in detail but the general idea is there!
Poor Mans Simulator. I have attached a simpler simulator for members who have not got access to a variac and all the equipment I used in my video. This is a good way for people who wish to test their projects or design new ones, as it can be used at any time day or night and is not affected by the weather. You can vary the simulated power by just adjusting the volume control on the amplifier. Do not use amplifiers that have bridge outputs. These are often used in cars to get over the low supply voltage.
BBTV - I think you have a slight slip in the junction box - live return from the AVO to extension ?
This project and you guys are amazing!
I haven't powered up an Arduino yet and the PV is being installed in October! - I just can't wait to get stuck in!
I have a slight problem - the loads (under-floor heating and immersion are some distance from the meter position and I have sub- main distribution to two consumer units). I guess that remote current monitoring could be used like emonTx but the control loop obviously needs to be tight. Has this kind of operation been ruled out? Or maybe no-one has got around to thinking about it yet?
The best place to extend is between the controller (Arduino, whatever) and the triac switch. Keep the opto-isolated trigger and the high voltage wiring with the triac, and bring back a twisted pair (bell-wire?) to the Arduino.
Writing an algorithm which avoids flicker at certain frequencies is surely the easy part. The hard bit is deciding what particular rates of switching need to be avoided. If the mains impedance is such that lights visibly 'flick' when a 3kW load in the premises is switched on/off, I imagine that almost any rate of change could be regarded as an irritation.
Burst mode switching, in whole cycles, has lots of benefits including minimal EMC disturbance, fast response time, and the ability to work really well within the flexibility that's allowed by most meters. But there is a characteristic tendency for lights to flicker.
On the other hand, phase-angle control causes no flicker, but there are many other complications which then need to be taken into account. In the absence of a professional (£££) AC controller, the EMC requirements would no doubt be very challenging to meet when using just a triac or any similar low cost approach.
BBTV: Poor Mans Simulator.
Sorry, Brian, I've not grasped the point of this yet. Is it to simulate additional power from the PV or is it for some other purpose? Does the audio affect the outcome, rather like disco lighting ;)
By "this kind of operation" I was really thinking wireless..... but I may have to do as you suggest.
Is firing in half cycles legal as long as you use an equal number of positive and negative cycles spaced over time to make the long term DC component zero? Also is there a spec for amount of DC allowed over a short period as there will be an imbalance if measured over a short window?
Redrawn Poor Mans Simulator. Thank you RobP for pointing out the graphical error. The attached has now been corrected.
Sorry if I didn't make it clear Robin. This simulator is exactly the same as the previous one except it doesn't use a variac. If you look at the block diagram you will see that no audio is fed into the amp only a 50HZ waveform from the voltage reference transformer that fed the An2 pin on the Arduino. I did set this up and it does work. I only put this idea on the forum to help other members like myself test their own projects as it is far more accurate than just plugging in different wattage bulbs.
I think you could use wireless (*) to transmit firing data, but unless the cable run is prohibitively complicated/ruins too much decoration, I'd go for the simple hard-wired approach (KISS and all that).
(*) You only need 1 bit to say fire or don't fire next cycle, but there's a lot of message overhead and a limit to how much you can use the channel (I think something like 2% of the time), so research and sums need doing.
I wouldn't try to use wireless to transmit voltage and current readings to a controller that implements the control algorithm. That would certainly bust the protocol.
I think the limits on harmonic generation are the killer for firing on half-cycles. You get even harmonics and the limits for those are significantly lower than the adjacent odd harmonic (e.g 1.08 A of 2nd harmonic compared to 2.3 A of 3rd).
Brian’s ideas for simulation could prove very useful, particularly for one (such as I) that is considering the application of two loads like immersion and under-floor heating.
I am also interested in Robert’s comments on wireless load control and shall probably look into this - once I get started. (But I have a LOT of catching up to do.) My loads are coming off separate consumer units 12m apart!
My biggest concern however is the safety and regulatory implications that might arise for anyone attempting to carry this project forward into a saleable product. The cost of Product Liability and Professional Indemnity Insurance would likely kill it dead in the water!
For those interested in triacs and snubbers, I found the Sharp S216S02 Zero Crossing SSR data sheet of interest (downloadable from Farnell). But I suspect this device (with heatsink even) might get too hot in this application.
In this regard, using a block like the SSR-40 DA seems a very sensible move.
Re: SSR-40 DA
These work fine, but don't expect them to comply with any european CE regulations, so could prove an issue should one explode in your house and your insurance company asks what it is.
That might be true at middling mark space ratios but say you fire at –ve half cycle, 4.5 cycles gap, +ve half cycle, 4.5 cycles gap, repeated, to get a 10% mark space ratio. The fundamental frequency is 10Hz. Will it then produce significant even order harmonics as the first one of these is at 100Hz, assuming the benchmark is harmonics of 50Hz and not harmonics of the actual fundamental?
LTSpice to the rescue - like this?
Here's what you get:
I'm not sure what to make of that! One thing's a certainty - a filter to take out the 5.5 Hz component isn't going to be easy.
"the Sharp S216S02 Zero Crossing SSR .... might get too hot in this application."
? ? ? It dissipates 14 W at 12 A (Fig.6 of the data sheet). It will only get too hot if you don't heatsink it properly - and it's not difficult to get rid of 14 W. Fig.2. gives you some ideas if you don't want to do the sums/can't get data on a heatsink.
N.B. In the absence of any mention of an I2t rating, you'd better assume it won't survive blowing the fuse/tripping the breaker in the event of a fault in the load.
Rob P consumer unit problems. Rob you say that you have two consumer units 12 meters apart. I assume that they are both connected to a common point e.g. the supply meter.
If this is correct then hopefully you have the cables from your consumer units going via junction blocks to the supply meter as two single 25mm cables and two going from the meter to the 100A incoming suppliers fuse in which case you can fit the split core transformer to any one of the four cables. If you don’t have a single entry cable but two 25mm cables going to a single connection on the meter then you will need to put the split core transformer around both cables.
This could prove to be a problem unless you can find a split core transformer that is big enough to fit over them. An alternative would be to have two transformers, one on each cable. The two transformers should then be connected to a summing amplifier (see attached schematic) on the Arduino interface pcb - note both CTs should be fitted so that they are in phase with each other.
You also mention connecting to your immersion and under-floor heating. I do not think it would be advisable to dump power into both these loads at the same time as this would exacerbate the flicker problem experienced by some members.
I think you are quite right to have concerns about the safety and regulatory implications. This is why I have not gone down the discrete component triac route, instead I am using the SSR-40 DA unit that will require a heat sink and suitable enclosure. To comply with current regulations this should be installed by a registered electrician. If this is not done, then if problems occur, there could be serious implications.
When the SSR is connected, it is just a simple matter of running a bell wire (observe polarity) back to the Arduino interface pcb - (see attached schematic and my video at http://www.youtube.com/watch?v=QeU6lzl4rVs.
I have found that though the specification for SSR-40 DA states that the input voltage range for the SSR is 3v to 32v, that 10V gives a more stable operation.
Thanks for your post... most interesting to see what you have been doing
What sketch are you running with your circuit. You have 2 CT's.. Robins MKII only uses one!
Ah! I can see that you are summing the two together! for RobP
Why do you use bold face? It hurts my eyes! (It doesn't really hurt, it's just a lot harder to read).
He's probably doing it for me! As it is, I generally spend a large portion of the day looking through a magnifying glass!
The consumer units are each fed via 16mm2 SWA's from the MDU that contains a 63A Switch Fuse on each. At the front end on 25mm2 is a 100mA 'S' type RCD (time delayed) acting as Main Switch.
One is not able to do much these days to domestic fixed installations without up-to-date C&G qualifications and notifying Building Control.
A solution (at least for the immersion heater) could however be applied by most householders, I think, if it is inserted in the immersion heater flexible next to the tank. Mine is going inside a well earthed Aluminium Box.
If I decide to do anything about the under-floor heating then I shall have to either notify Building Control or call upon a friendly registered electrician - since I no longer am.
The lack of I2t data for that Sharp S216S02 Zero Crossing SSR had not escaped my attention either. Sometimes they only give you the good bits and what is not said is more important! If you think it will do in a fire resistant enclosure, it is cheap enough it can be sacrificed!!
Mark Carter regarding the 2 CTs on the schematic. I only use one CT with Robins MK2 PV controller sketch and my interface circuit.
The reason I uploaded the schematic showing two CTs was for RobP problem where he has two consumer units 12 meters apart. Without seeing the installation it is difficult to assess the best approach. In most cases one CT is all that would be required. But there are some situations where two CTs would be more practical.
"If you think it will do in a fire resistant enclosure, it is cheap enough it can be sacrificed!! "
The worst you will get is a few bits of hot shrapnel flying around. But most likely there'll be either an open or short circuit between pins 1 & 2. Just make sure any metal close by is either related to the live side or earthed.
These work fine, but don't expect them to comply with any European CE regulations, so could prove an issue should one explode in your house and your insurance company asks what it is."
I think you will find they are CE compliment, that's why they have CE marked on them.
The point is the whole device needs to be CE compliant, and it never will be.
I used to work on equipment that had 40+ amps running through SSRs and never had one "explode" they occasionally went phutt and smelled a bit odd. If you really want to play safe, use a triac & opto couple at least if they explode they aren't encapsulated in hard epoxy, wait a second, that's where we started from.
Thank you Brian for your extra effort with the 2x CT's.
Sorry I forgot to say it earlier.
Tweets by @Openenergymon
Open-source tools for energy monitoring and analysis. This project uses the GNU General Public Licence