The CT clamp which comes with the EmonTX kit is rated up to 100A but, of course, our domestic current consumption will rarely get up anywhere near 100A.
As I understand it, we would get more accuracy if we used a CT clamp which more closely matches the load used. Is this correct? And, if so, is anyone aware of a source of split-core CT clamps around the 40Amp mark?
Thanks,
Jack
Re: Smaller current CT?
In short, yes and no. There are c.t's for smaller primary currents, but they tend to have 1 V p-p outputs maximum, which rather negates any advantage that the smaller ratio gives you - unless you run your Arduino with a 1 V reference.
The YHDC 30 A c.t. appears to be the same unit as the 100 A version, but with an added internal burden.
I'm pretty sure a lot of people here would like to have one, if it exists at a reasonable price.
Re: Smaller current CT?
Thanks for the reply. Yeah, I've only been able to find split-core CT clamps with voltage outputs (either 1V or 0.333V). How hard would it be to convert the EmonTX to use a 1V reference or to amplify the input voltage? (I'm sorry, I'm somewhat clueless about analog electronics - I know we can use an op-amp to amplify a voltage but I don't know how easy it is to ensure that amp has a linear response) Actually, here's a great forum topic on the sparkfun forum where someone uses an op-amp with a CT clamp.
Just for reference, here are the split-core CT clamps I found:
The SCT-013-000 is the model used with the EmonTX and produces a 33mA current.[Edited by Robert Wall: This is incorrect, it is 100 A / 50 mA](edit: I've had to remove most the links in order to not trigger the forum's spam filter. I know spam is a PITA to filter but surely it's a mistake to disallow users to post links to on-line shops in a forum where folks discuss DIY electronics projects?)
After monitoring our home's power consumption for a while, I can safely say that we very rarely draw above 5kW (22Amps) so I'd be very, very eager to use a 25 or 30 Amp CT on our main supply (and maybe a 5Amp CT on our lighting circuit)
Re: Smaller current CT?
Sorry Jack, I've had to edit your post. The site you quote is untrustworthy and the particular data I've deleted is simply wrong. See here. Please don't publish false "facts".
As you're adding extra electronics anyway, it would be quite simple to amplify the c.t. output. I've no idea where you get the idea that the output won't be linear, any distortion that the amp adds will be a couple of orders of magnitude less than the c.t's own distortion. The problem you will have is limiting the output to the reference voltage of the ATMega.
Re: Smaller current CT?
Woops, sorry. I had assumed that data from the distributor would be correct (especially given that I'd seen that data from two separate distributors). Sorry (I hate incorrect info as much as anyone!)
OK, great - I might well give that a go if I get time.
I simply didn't know whether it would be linear or not - I felt it best not to assume it would be. But thanks for clarifying that it'll be more than sufficiently linear.
Re: Smaller current CT?
Thinking a bit more about this... I'm thinking of using 2 CT clamps...
The CT clamps SCT-400-005 and SCT-400-025 (both of which are available from Farnell and both produce 0.333V at their rated currents) have an accuracy of +-1% from 10%-130% of their rated current. Which means the 25 Amp version maintains its 1% accuracy from 2.5Amps upwards. 2.5A is still considerably more than our houses uses most of the time (we usually use around 1 Amp). So I'm thinking of using two CT clamps: a 5 Amp and a 50 Amp. The 5 Amp is accurate down to 0.5 Amps whilst the 50 Amp is accurate down to 5Amps. They would each have their own op-amps set to ensure that the ATMEGA never sees > 3.3v (I assume that if the op-amp is powered from a 3.3v source then it'll never be able to produce > 3.3v).The outputs from these op-amps would feed separate analog input pins on the ATMEGA. Then the code just needs some simple logic to decide which of the two op-amps to use (if the 5A input is saturated then use the 50A input).
What worries me now is: what would happen to a 5A CT clamp if exposed to 50 Amps? (assume that nothing bad will happen but I haven't been able to find anything in the spec sheets to tell me either way)
Thanks, Jack
Re: Smaller current CT?
If you give a c.t. too much overcurrent, the core will saturate, and the output levels off. You can see that with the 100 A c.t. when I fed it 250 A. The core warms up, which not good for its life expectancy. I can't quantify that, I don't know what the temperature rating is - the data sheet is secretive in that area. If it got too warm, it could conceivably damage the insulation on the primary winding, which would definitely be not good.
Unless there is no other way, I don't recommend it.
Accuracy: You need to measure one but I would have expected the magnitude of the current to remain a lot better than that to much lower currents, it's probably the phase angle that goes out of tolerance first. I'd expect the behaviour to be very similar to the 100 A version.
I assume that if the op-amp is powered from a 3.3v source then it'll never be able to produce > 3.3v. Correct.
if the 5A input is saturated then use the 50A input. If you still need two c.t's, you could use the same logic as Atmel in their app.note - it's proven.
Re: Smaller current CT?
Thanks for the reply.
Yes, sorry - I should've been explicit about what got me worried about accuracy in the first place.
I have a simple test rig setup (it's far from ideal but it's safe and it appears to work):
The "test rig" consists of a mains extension lead with 40cm of insulation cut away and a chunky meter tail spliced into the live connection (I used a meter tail so I could test the capacitance of the foil "capacitance probe"). My "reference meter" is a WattsUp Pro .NET which claims to have a measurement accuracy of +/- 1.5% (above 60 watts). It reports RMS volts, RMS current, "true RMS watts" (real power, I guess), power factor and apparent power.
As can be seen in the photo, I was testing with my wife's hair dryer which has two speeds. Readings on low speed:
Readings on high speed:
It was the "low speed" data which originally made me worried that maybe the CT clamp was misbehaving at low currents.
But after some more experimentation with high-PF loads (toaster, 75W incandescent lamp, 50W soldering iron, kettle) I'm coming to a different conclusion... I think the emonTX appears to agree very well with the WattsUp for high-PF loads (even small loads like the soldering iron). But low-PF loads confuse it. Which maybe makes me think that it's not the CT that's to blame but, rather, it might be that we're not taking enough samples of the current waveform (or perhaps the CT is distoring the phase angle).
Let me quickly try to increase the sampling of the current waveform and report back...
Re: Smaller current CT?
I very quickly through together some "faster sampling" code. The "faster" code doesn't implement any of the clever tricks discussed elsewhere on the forum, it just doesn't sample voltage.
Here are the results for the "slow" setting of the hair dryer. Remember my reference meter claims we should be measuring 3.6 A.
So faster sampling doesn't appear to improve accuracy in this situation. But now I'm really confused: what's causing the emonTX to underestimate the current so much for the low setting of my wife's hairdryer?! Let me try to dig out a purely resistive 500 W load...
Re: Smaller current CT?
Some more comparisons
(large deviations from WattsUp are marked in red):
RMS amps:
power factors reported by WattsUp.
The WattsUp and emonTX are reporting RMS amps once every second.
(edited to add more details to the descriptions of each appliance to address some of the questions raised in comments below)
Re: Smaller current CT?
Have you tested the accuracy of your WattsUp by comparing it with, for example, the pulses on a utility meter?
P.
Re: Smaller current CT?
That's a good idea but unfortunately that would require turning off every load in our house except our test load, which isn't practical (my wife an 1 year old might complain!). I have compared the WattsUp to an EDF individual appliance monitor and an EDF whole-house meter on my blog and they agree very well (except the WattsUp samples once a second whilst the EDF IAM samples once every 6 seconds).
Re: Smaller current CT?
How did you calibrate your emonTx? (I'm thinking: You might be in the situation where two wrongs make a right - but at one point only).
Re: Smaller current CT?
Slightly surprised by some of your power factors. Soldering iron, for example. I'd have thought that would be purely resistive, so with a PF of 1.0. Likewise your 75W lamp.
Or am I being silly?
P.
Re: Smaller current CT?
Surely he's got a temperature-controlled iron with a thyristor/triac chopped waveform - just like his lamp which he says is on a dimmer? ! ! !
That's the clue - one of them (either emonTx or WattsUp) isn't getting the chopped waveform right.
And betcha the hairdryer does the same.
Re: Smaller current CT?
Yeah, I was surprised by that, too. All the PFs I quoted are taken from the WattsUp (unless otherwise stated).
The soldering iron is a temperature-controller one (the Xytronik 168-3CD) but I would have thought that the heater is either "on" or "off", hence should be purely resistive. I guess the lamp filament is, actually, a very small coil so perhaps that explains the lamp's slight inductance?
Re: Smaller current CT?
Ah! I tested the lamp twice: once on a dimmer (with the dimmer set at about 50%) and once without a dimmer in the circuit. Sorry, I should've made that clearer. I've edited my table to make this explicit.
That's certainly my best guess too. If the emonTX was failing to get the chopped waveform right then I'd expect more rapid sampling to reduce the problem but faster sampling doesn't seem to change the emonTX's reported values. Which perhaps starts to point the finger of blame at the WattsUp?!
I wonder if it's too late to ask for a proper 'scope from Santa?!?!
Re: Smaller current CT?
"slight inductance" - nowhere near enough to give you a p.f. of 0.44 ! Have you worked out what inductance that actually is. I haven't but know it can't be anywhere near enough.
But think about the chopped current wave and the position of the current wave in relation to the voltage wave. As you decrease the conduction angle, the load looks increasingly inductive until at almost zero volts, the current wave is almost 90° phase shifted.
Re: Smaller current CT?
"I wonder if it's too late to ask for a proper 'scope from Santa?!?!"
If a week today you're out of luck, you could improvise with a sound card. See how I tested the c.t's and v.t. for how to do it and precautions.
You must be very careful with earths.
Re: Smaller current CT?
Sorry, I think my table has caused more confusion! To clarify:
When the lamp was connected directly to my test rig (with no dimmer) the Watts Up reports a PF of 0.95. (I would have expected a PF of 1.00)
When the lamp was connected via a cheap dimmer set to about 50% the Watts Up reports a PF of 0.44 (caused by the waveform chopping done by the dimmer)
It was the first situation (with PF = 0.95) where I was surmising that the lamp's slight inductance might be responsible for the PF of 0.95 instead of 1.00. But I really am just guessing.
Re: Smaller current CT?
Some graphs...
I told my emonTX to store 200 current samples in an array and then spit them out to the serial port.
Here's the current waveform as sampled by the emonTX 45 times per cycle... the y-axis are filtered but unscaled current values:
Hair dryer on low setting (note the very odd waveform shape...)
If you recall, the emonTX was reporting lower RMS amps readings for the hair dryer on low setting compared to the WattsUp. I wonder if the WattsUp is failing to take consideration of the very odd negative 180 degrees of the current waveform?
(Or maybe the WattsUp and emonTX disagree over the "polarity" of the current waveform??? I guess most folks assume the current waveform will be the same no matter what the "polarity"; given that it's supposed to be a sine waveEDIT: never mind, obviously the "polarity" doesn't matter for root-mean-squared calcs!)And, just to be sure the HPF wasn't doing anything odd, here's a graph of the raw analogRead() values (unfiltered):
From which I conclude that the HPF isn't distorting the waveform (why should it?)
Hair dryer on high setting (much more sane waveform)...
Re: Smaller current CT?
You are looking at a half-wave rectified wave. The zero ought to be at the 503-504 count level, it has been shifted because neither the c.t. itself nor the h.p filter can preserve the true d.c. level.
Now if you do the maths, you'll see that the emonTx won't be reading the correct value, perhaps that's obvious. There is nothing you can do without using direct connections for both current and voltage inputs, and you can't do this without raising critical concerns over the safety issues.
Re: Smaller current CT?
If you're anywhere near Brighton you can borrow my portable scope for a few days, if you have the time/inclination to study further.
P.
Re: Smaller current CT?
I think I understand what's going on! But not entirely confident.
I'm 99% sure the answer will be no, but: would it help at all to use a hardware HPF?
BTW, I'm actually very impressed with how well the emonTX agrees with the WattsUp for the majority of appliances (the WattsUp .net Pro is a $235 meter - not mine, incidentally!)
I'm going to email WattsUp to ask how rapidly their meter samples the voltage and current waveforms.
That's extremely kind of you but I'm a little distance from you (S.E. London). Also, to be honest, I'm starting to come to the conclusion that, actually, the emonTX does a pretty damn good job out-of-the-box so I should stop tinkering and get on with the main "meat" of my project (implementing a reliable RF protocol and doing the capacitance-probe stuff).
Re: Smaller current CT?
"I think I understand what's going on!"
The h.p. filter passes only high frequencies - by definition. d.c is zero frequency. The c.t. also doesn't pass d.c. - if you connect a car battery between true earth and the emonTx, it won't shift what you measure by 12 V! I think that's pretty intuitive, but if not, you'll just have to believe me. ;-)
But at the same time the h.p. filter allows the wave to balance itself so that the average voltage is zero, so the true zero (the flat base between the half-cycles) gets shifted negatively. You'd see exactly the same thing with a real 'scope if you switch that channel to "ac".
The rms value of the wave is naturally affected by the d.c. component. The best way to see this is to synthesize a sine wave in a spreadsheet and calculate the average and rms values. (Formula to be found in emonLib!).
"would it help at all to use a hardware HPF?"
Sack the 1%, your 99% is spot on. Any h.p. filter will do the same.
The only way to get the right answer would be either to somehow figure out where the true zero is and restore it in software, or (I think) a Hall effect current transducer would do the trick, but would itself have problems with d.c. stability (unless you use some pretty advanced techniques) or have a direct connection (current shunt).
Re: Smaller current CT?
Thinking about your capacitive v.t, you could minimise the external influences by screening it. The capacitance between the pickup foil and the (earthed) screen would - like the cable capacitance - need to be subtracted from the 'bottom' capacitor.
Re: Smaller current CT?
jack_kelly said "never mind, obviously the "polarity" doesn't matter for root-mean-squared calcs!"
This isn't entirely true for the emonTx Jack. There is some leakage of voltage into the current circuit, both from a/c input and from the power supply or PC you are connected to. If this is in phase with the current all the samples will be slightly larger than they should be and so their squared values will be larger too. When the current and voltage are out of phase you get the opposite effect. Try swapping the direction of current flow through the CT when you have a small load like your 75W light bulb and you should see the effect.
The half wave rectified problem is an interesting one, as Robert says, you could probably do some post-processing and determine where 0 should be but it wouldn't work if had other balanced loads too. Maybe I can make a plug for a PLL :). If the load was purely resistive you know the current must be 0 at the voltage zero crossing so using a PLL (or hardware) to find this would enable you to determine the correct current offset. Falls down a bit with inductive loads though. Might even have a play with this myself
Re: Smaller current CT?
"If the load was purely resistive you know the current must be 0 at the voltage zero crossing so using a PLL (or hardware) to find this would enable you to determine the correct current offset. Falls down a bit with inductive loads though."
I'm afraid that I can't see a law for resistive-only loads any time soon - although the power companies would no doubt be over the moon at the thought!
I think Hall effect is the only practical non-invasive way.
Re: Smaller current CT?
This thought kept me up last night! I've implemented a "lobe timing asymmetry detection" algorithm (daft name, I know) which is describe in a new forum topic: Tracking DC-offset using lobe timing instead of an HPF
Re: Smaller current CT?
Moving slightly back to the original topic of this thread...
The graph below of the raw analogRead values when measuring a dimmed lamp (drawing about 0.33 amps) surprised me a bit:
I was surprised that we're only using 5 out of a possible 1024 ADC steps to sample this lamp (I know, I should have been able to work this out). Sure, we won't usually be presenting a mere 0.3 A to our CT clamp when it's connected to our home's incoming mains connection instead of my test rig; but we often will be presenting steps of only 0.3 A (or less) to our CT clamp (e.g. when a lamp is turned on or off). And, in my non-intrusive load monitoring research, these step-changes are really important! This got me thinking again about ways to improve our ADC resolution.
The "standard" answer to improving resolution in a situation like this is, as I understand it, to use an op-amp with switchable gains (where the gain is selected by the processor). The thing that worries me about this solution is that we'd have to re-calibrate our DC-offset after switching gains. This isn't a problem if we switch gains rarely but imagine if we repeatedly and rapidly switched gains (e.g. my bread-maker turns its heater on and off rapidly to control temperature; imagine if the "heater on" state was above the threshold to switch gains whilst the "heater off" state was below that threshold).
It occurred to me that we could double our effective resolution if we full-wave-rectified the input signal before sending it to the ADC. Something like this:
The top graph shows the present situation. A voltage of between 0 to 3.3v is delivered to the ADC. 0v represents the -ve peak whilst 3.3v represents the +ve peak.
The bottom graph shows the basic idea behind my suggestion: that we apply full-wave-rectification (and amplification) to the signal prior to the ADC. We also use a simple bit of hardware to detect whether the original signal is positive or negative and we communicate the sign to the ATMEGA by way of a single digital input. This way we can easily reconstruct the original full-wave signal in software. The ultimate aim is to double our effective resolution. Instead of using 1024 ADC steps to represent the original signal from -ve peak to +ve peak, we can use the full 1024 steps to represent 0 to +ve peak.
Implementing this in hardware would, I imagine, be relatively trivial if it weren't for the fact that diodes have a forward voltage drop, so we certainly can't just pass our CT input through a bridge rectifier. A bit of Googling uncovered the concept of a "precision full-wave rectifier" using 2 op-amps and 2 diodes which appears to compensate for the undesirable attributes of normal diodes. I imagine we would still need to generate a dual-rail (+3.3v, -3.3v) power supply from our battery though.
So I'm now thinking of using a 25Amp CT clamp (outputting 0.333v when presented with 25A) in combination with a precision rectification circuit to increase the resolution of my current sensing circuitry.
Any thoughts?! Has anyone used a "precision full-wave rectifier"? Will it do odd things to the phase or distort the signal in some other way (I assume not)? Is this just a dumb idea that should never see the light of day?!
Re: Smaller current CT?
Another clever idea Jack but this one might be a bit more difficult to implement and may conflict with your LTAD algorithm (no 0 crossings?).
At first I thought it's a lot of trouble just to double the resolution but if you think about it it has much more potential than that. With the rectified signal referenced to ground there is no DC offset so you can set the resolution to anything you want simply by changing Vref. e.g switching to the internal 1.1V band gap reference would triple the resolution.
Re: Smaller current CT?
How do you determine the direction of the current or the power factor/phase angle? I think there is a little ambiguity creeping in.
Re: Smaller current CT?
Oh yeah. I hadn't thought of that! It would be lovely to avoid having to use software tricks (like an HPF or LTAD) to remove the DC offset.
Very nice ;)
I assume the dual-rail power supply is the hardest bit about implementing this circuit (the circuit diagram for the precision full-wave rectifier itself doesn't look too hard to build).
How hard is it to cook up a dual-rail power supply from a battery? I guess the easiest thing is just to use four 1.5v batteries instead of 2 and take a center-tap from the battery pack?
Perhaps we don't even need a dual-rail supply? If we use a total of three op-amps: the first two are the precision full-wave rectifier for the 0.33 v input from the 25amp CT clamp. These, I assume, do need a dual-rail power supply but perhaps we can create a ±1.5v dual-rail supply just by voltage-dividing the 3v supply. Then, once we have our full-wave-rectified signal, we can use a single-rail op-amp (fed from the main +3.3v supply) to amplify the signal to occupy the full input range of the ADC.
Re: Smaller current CT?
Couldn't you extract the polarity of the current from the precision rectifier? There must be a node in there that changes with polarity. This could be extracted, fed into a digital input and used to invert the current value in software.
Once you've got that the power factor/phase angle problem is no different than normal.
Re: Smaller current CT?
There are plenty of chips around that will generate a negative supply from a positive one. I don't think that's an issue.
You'll still need something like your LTAD algorithm because the half-wave case will be rectified at the false 0 point.
Re: Smaller current CT?
Exactly what I was thinking when I wrote the rather hand-wavey sentence "We also use a simple bit of hardware to detect whether the original signal is positive or negative and we communicate the sign to the ATMEGA by way of a single digital input."
Here's the diagram for a precision full-wave rectifier (taken from play-hookey)
If I understand the diagram correctly (which isn't as likely as I might want!) then the output of the left op-amp (after the right diode) is a half-wave rectified signal. So we could take that half-wave signal and amplify it a lot (so it effectively becomes a digital signal) and feed this signal into a digital input on the ATMEGA. This bit can then be used as a "sign bit" in software.
Re: Smaller current CT?
I'm not sure why this would be the case. Please can you baby-step me through the reasoning? (Sorry, I really should know more about AC electronics)
Re: Smaller current CT?
I'm not sure why this would be the case. Please can you baby-step me through the reasoning? (Sorry, I really should know more about AC electronics)
It's really the same reason the HPF has trouble. The CT is a/c coupled so the average voltage on it must always be 0. This means the signal will always swing both positive and negative even if the real current is always positive.
One side of your CT will be the signal into your precision rectifier, the other side will presumably be connected to ground. The signal input will swing positive and negative around the average voltage, which is the point where an LPF would settle.
Re: Smaller current CT?
Ah, I get it - thank you.
Going back to something you said earlier:
Forgive my ignorance but is this switch something that can be done in software? I assume not. (At least, not unless we add a switch that the ATMEGA can control).
Re: Smaller current CT?
Yes, you can change the reference in software. The selection multiplexor is in the ADMUX register (the same register you used to read Vcc and select the input source). You can also select an external reference.
It's all well documented in the ATMega328 data sheet on the Atmel site and all the header files are included in the Arduino environment.
Re: Smaller current CT?
It must be about time for me to RTFM, I guess ;)
Re: Smaller current CT?
Regarding the current rating for CT clamps... say I get a CT clamp with a primary current rating of x amps. I assume that's x amps peak rather than x amps RMS. So if I want to measure a 25A RMS load then I need a 25A x sqrt(2) = 35.4A CT clamp. Is that correct? (The CT clamp data sheet doesn't appear to make this clear. Although most of the CT clamps I've looked at claim to maintain their quoted accuracy from about 10%-130% of its rated current).
Re: Smaller current CT?
No.
Take a look at the test results for the YHDC c.t. All the numbers there are rms unless I state otherwise.
[And I do wish you'd stop calling transformers "clamps" - every time I see that, I think you mean a busbar clamp].
Re: Smaller current CT?
OK. So a "25A" CT means a "25A RMS CT". Thanks for clarifying.
I was under the impression that "CT clamp" is common short hand for "split-core current transformer for fitting round a cable without having to disconnect one end of the cable first". It's not like I'm the only person to call it a "CT clamp" ;)
Re: Smaller current CT?
I've been thinking some more about this "precision rectification" circuit for improving ADC resolution for both V and I samples. Some quick notes:
Re: Smaller current CT?
I did try switching to the internal reference rapidly once with the idea of checking the supply voltage at every sample but it didn't work, it seems you do need a delay. It didn't take this further after I realised that the 3.3V regulator tolerance (1% I think) is better than the band-gap reference (10% ?).
There is a mention somewhere about changing ADMUX after a conversion has started. You can do it quite early as the sample and hold takes place at the start of the process. I'll see if I can find the reference.
Re: Smaller current CT?
MartinR
I think the difference between the regulator output and the band-gap reference is in stability, not precision. As I understand it, the band-gap voltage value is more uncertain initially, but maintains that voltage more precisely in the face of external influences (temperature and supply voltage principally), and time.
Re: Smaller current CT?
Hmmm... all this talk of wobbly voltage references is making me a little nervous... how hard would it be to build a more precise, external voltage reference? (forgive me; I have precisely zero experience with such circuit design). If I were to build an external v ref then I assume I could built two or three switchable precision v refs instead of building a switchable gain amp (assuming I also use precision rectification).
Re: Smaller current CT?
OK. I've done a quick bit of googling! Farnell have a huge number of voltage reference ICs! e.g. this one produces 3V +/- 0.2% given an input voltage of 3.1 - 5.5v. Tolerances down to 0.05% seem pretty common too. I'm starting to quite like the idea of using two or three different external voltage references (e.g. 1v, 2v and 3v) in combination with precision full-wave rectification. TI have a nice introductory PDF on voltage references.
So my hardware design is starting to look something like this:
Does this sound sensible?! It's starting to look like quite a lot of electronics work!
I guess one danger of using switchable v refs to change ADC range is that if we, say, use a v ref of 0.5V then we'll be amplifying very small inputs to the ATmega, and I suspect the ATmega's IC isn't the quietest environment in the world. So maybe it is better to use a switchable-gain amp instead of switchable v refs.
Re: Smaller current CT?
There is some evidence that many constructors have had noise problems, so I would tread carefully if you are aiming to get accurate readings at low powers. Good PCB layout with good analogue layout practices and close attention to supplies and grounding will be essential.
Re: Smaller current CT?
ok, thanks, in which case I'm leaning towards the idea of using a single precision v ref and a switchable-gain op amp for the CT feeding into a precision full-wave rectifier. That way the low amplitude signals will only exist in the CT, the cable from the CT and the first op-amp. The full-wave rectifier and ADC will always see relatively large amplitude signals, so the SNR should be reasonably good.
thanks again for all your help.
Re: Smaller current CT?
By the way, here's my basic maths which suggests I need both precision rectification and switchable-gain op-amp for measuring current...
If I use a 25A CT and precision rectification then those 25A can occupy the full 1024 steps of the ADC. So 1 amp would read 40 on the ADC. Hence a single ADC step would represent 1/40th of an amp or 5 watts. Ideally I'm after a resolution of more like 0.5 watts. Hence I need a variable-gain op amp as well as precision rectification. (of course, this extra resolution will be no use if it's buried in noise!)
Re: Smaller current CT?
I thought you'd decided 25A was RMS so peak will be ~35A so 28 samples?
Re: Smaller current CT?
yes, you're right! even more need for a switchable gain amp!
Re: Smaller current CT?
maybe I should think about just using a high-bit-depth external ADC, like one that fluppie007 mentioned in this comment.
Re: Smaller current CT?
and now I'm thinking of using a raspberry Pi with a USB sound card and the same "sound card scope" circuit that Robert used to test the 100amp CT.
Re: Smaller current CT?
The Zeitnitz sound-card scope works nicely and I made use of this when playing around with direct 'Live' measurements some months ago. At its core, however, it is just another sampling system for which appropriate input circuits have to be provided.
Having worked out how to get raw samples from the Arduino into a spreadsheet (thanks Robert!), good quality test data is now available by this alternative means. These values can then be analysed and displayed in whatever way is appropriate. This approach involves no extra hardware, and takes up no extra bench space
When using the scope, I found I needed to disconnect the Earth lead, otherwise the house kept tripping out :(
Re: Smaller current CT?
This is the' scope i have and would recommend it highly -
http://www.ebay.co.uk/itm/Hantek-DSO2250-PC-Based-USB-digital-oscilloscope-DSO-2250-250MS-s-2CH-/121033693084?pt=BI_Oscilloscopes&hash=item1c2e2b979c
This is also the supplier I got it from with no problems.
As an aside as Robert Wall said earlier the SCT transformers seem to all be the same windings and core wise, the voltage O/P types have burden resistors to suit a given conversion of Amps for 1V o/p so an 030 will give 1V for 30A thats not to say they can't measure higher as the basic one will operate to 100A, you just chose the one that gives the o/p range you need, for domestic measument the 030 works fine giving 1V at 30A. With the 100A you choose the burden to suit, I doubt if will saturate below 100A just give you a higher voltage, a 'scope will show if they are saturating.
The posts around the waveform for the hair drier were quite amusing, The manufacturers seem to plonk a diode in to give half power, thats common (not very good) practice and is used in electric paint strippers etc, in reality you may never be measuring a hairdrier at half load, I use an Eco Eye monitor and it not upset by the wifes hairdryer!
EDIT - If you want to measure 240V mains you will need a x100 probe (around £20 if you shop around eBay)
Re: Smaller current CT?
I use an Eco Eye monitor and it not upset by the wifes hairdryer!
Isn't that because the Eco Eye assumes that all waveforms are sinusoidal, and that the mains voltage is always at a constant level ;)
Re: Smaller current CT?
Robin wrote:
Sorry, I should clarify my last post: I'm now thinking of using a Raspberry Pi plus a 16-bit USB sound card not (just) as a cheap scope, but to actually replace my emonTX. i.e. the RPi will be responsible for measuring my whole-house power consumption. The CT will feed one microphone channel, the voltage measurement device will feed the other channel.
This setup appears to have several advantages over using an ATmega328:
Of course, there down sides. It's a little more expensive and a lot more power-hungry.
Rich wrote:
Very interesting! In which case I'll just stick with the 000 model and provide my own burden resistor.
Would a 'scope probe provide better performance than an AC-to-AC adapter for measuring voltage? I assume so.
Re: Smaller current CT?
"Would a 'scope probe provide better performance than an AC-to-AC adapter for measuring voltage? I assume so."
But remember what I keep on saying about isolation! It's going to be so easy for someone to get badly hurt if you're making direct connections to the mains and something goes wrong or isn't right in the first place.
Did I ever post about a neighbour who had a new electric shower installed by a plumber who though he knew what he was doing? The idiot swapped line and neutral at the Henley Blocks he put in, and every single plug, socket, appliance and wire in the house was only protected from an earth fault by the supplier's 100 A fuse. If one of your students connected to a plug in that house, they could have become a fatality.
Re: Smaller current CT?
Ok, point well made, I'll stick with the AC to AC adapter!
Re: Smaller current CT?
For your application Jack definitely an ac-ac adapter not the probe. I was referring to the 'scope I posted the eBay link to. And as you say the 000 will allow you to experiment with burden value.
Re: Smaller current CT?
I think most of us have gone through the phase of wanting to make direct measurements to the mains so as to really understand what's going on. Yes, it does work, but it's not a practical solution for the long-term. And its a bit scary too!!
Robert deserves a medal for the number of times he's had to haul people away from this particular precipice ...
Re: Smaller current CT?
one issue that is coming to light regarding sound cards is that they include a high pass filter in their input stage with a cut off around 10 to 20 hz. of course, that shouldn't be a problem for measuring 'normal' loads but it might complicate the measurement of half wave appliances (for the same reason that emonlib's hpf gets confused by half wave appliances). i have it on good authority that Santa (well, my PhD supervisor) has bought me a cheap bench scope so I'll be able to do a direct comparison.
Re: Smaller current CT?
and yes, Robert deserves a medal for multiple reasons ;)
Re: Smaller current CT?
incidentally, last year a group at MIT measured I and V in 6 homes at 15khz and published the data.
They used Two 200A TED CTs and Pico TA041 'scope probe to measure voltage (100:1 step down), connected to a National Instruments NI-9239 ADC (24-bit 15kHz)
i guess they are braver than me ;) (because they used a scope probe)
http://redd.csail.mit.edu
Re: Smaller current CT?
Nothing wrong with the correct use of a 'scope probe...............................with a scope. I wouldn't like to try it with a sound card though.
Re: Smaller current CT?
oh, I see. so the scope (or the fancy adc module used by the mit group) handles isolation issues, not the scope probe itself. Thanks, I understand now.
Re: Smaller current CT?
Just to confirm... some probes offer 2kV isolation but I assume that's 2kV between the scope probe's ground connection and the probe's signal connection? I assume the danger arises because the probe doesn't offer any protection of high voltages between earth and either of the probe connections? Is that about right?
Re: Smaller current CT?
"Just to confirm... some probes offer 2kV isolation but I assume that's 2kV between the scope probe's ground connection and the probe's signal connection? I assume the danger arises because the probe doesn't offer any protection of high voltages between earth and either of the probe connections? Is that about right?"
I'm not sure of your terminology here. Most passive 'scope probes that I've come across have a probe tip which is connected to the amplifier input by a screened cable. The cable screen is brought out to an earth clip. The earth clip is connected to the signal common, chassis and the case of the instrument, and that for safety must be earthed via the mains lead.
You can however have (expensive) isolation amplifiers or differential probes (e.g. http://uk.rs-online.com/web/p/oscilloscope-probes/7336145/ which incorporates the probes in one assembly and is battery powered) to go with your 'scope, these in effect contain the same 'front end' as a 'scope but offer isolation between the probe "earth" (now more properly the signal reference or 'common' connection - the black lead in the Agilent example above) and mains earth.
Re: Smaller current CT?
that's great, thanks for the clarification. And happy Christmas!
Re: Smaller current CT?
Hi,
So, I now have a Rigol DS1052E budget 'scope (yay!)
Given Robert's description of passive 'scope probes, I assume it would still be a very bad idea to try to measure the mains voltage waveform using a 100:1 passive probe by connecting the probe tip to live and the probe earth connection to neutral (because there may be a considerable voltage between neutral and earth).
Re: Smaller current CT?
I would agree. Any non-temporary connection to the mains for measurement purposes is unlikely to gain approval in this place!
Re: Smaller current CT?
And "temporary" might mean a few milliseconds while it blows up if you failed to measure and check the voltage first.
Don't ever be tempted to do what was common practice when I was an apprentice - remove the earth connection from the 'scope. Quite a lot of people leaned on the 'scope trolley and if they happened to be wearing leather-soled shoes they removed themselves very sharply with a few colourful words. That's because the electronics "0 V" common rail was actually at mains line potential.
Re: Smaller current CT?
OK!
Robert, how did you connect your sound card to the "mains" when you did your (very helpful) report on the Mascot 9V AC/AC adapter? At first glance, the circuit diagram appears to show that neutral is connected directly to the sound card's signal ground:
I have precisely zero experience with variable transformers so I assume that I'm just getting confused by the notation and that the far left of the diagram is the secondary winding of the transformer rather than a direct connection to live and neutral (and hence you have galvanic isolation from the mains)
Re: Smaller current CT?
When I did this kind of test, my entire rig was tied directly to mains Neutral (hence the absence of any earths in scopes, power supplies etc.)
It did work, and it heated up several tanks of hot water during the summer, but is not to be recommended. Far too scary!!
Re: Smaller current CT?
The diagram is accurate, there is a direct connection to neutral. I very carefully checked that the neutral voltage was indeed very close to earth (we have PME here - TN-C-S system) and then I very carefully checked and double-checked that all other equipment was earth-free and that I would be too whilst doing the measurements. And I did have a double-pole switch that broke both line and neutral, so the neutral connection was only present while I was actually making the measurements.
As Robin says, scary! I would have much preferred to do it in a better, safer way but as I've survived 45 years in the industry, I do think I'm aware of the dangers and took all reasonable precautions. I did mean every word in the warning at the top of the report. There's a big difference between a series of measurements in laboratory conditions spanning a few tens of minutes by someone who is aware of the dangers, and general use.
Re: Smaller current CT?
Jack, might be a bit out of the line of the last posts, but might still be interesting regarding your original idea to have more ADC resolution on the emontx:
I have done a very simple 12 bit ADC addon for the emontx using an MCP3208 (~€3). It fits to the 'jeenode' headers of the emontx. Practical results with an SCT-013-030 current clamp are so that I get a reading of 11.0W +/0.5W for an 11W ESL lamp. I have not done any further testing, for me it was just a proof of concept. Sampling of one channel takes ~10us, so it is around 10 times faster as with the ATmegas internal ADC.
If you (or someone else) are (is) interested, drop me a line.
Re: Smaller current CT?
Jorg, it would be interesting to know how much noise you pick up from the digital circuitry with that, and what the layout of your analogue circuitry is.
Re: Smaller current CT?
That is very interesting, thank you.
My current plan is to try using the line-input of the Intel Atom motherboard (model BOXD2700MUD) that I'm using for data logging. The Intel motherboard with built-in Atom is about £50 so it's quite a bit more expensive than an emonTX or RPi. But I needed an Atom PC for other reasons so it works out very cost effectively for my project.
One nice thing about the motherboard is that it has two stereo 96kHz 20-bit ADCs with built-in HPFs with cut offs around 10Hz. So my hope is that I'll be able to connect my CT and AC-AC adapter "directly" to the line-input of the motherboard (via some resistors and protection diodes but there should be no need for op-amps or bias voltage circuits). If I really wanted to I could sample at 96kHz but that's probably way above the frequency response of either the CT or AC-AC adapter ;). I might experiment with sampling at 96kHz and then down-sample in software to, say, 4kHz by taking the average of every 16 samples, hence increasing the effective SNR (because the averaging process will reduce any normally-distributed noise).
Re: Smaller current CT?
'Layout' is not the right word :-) As said, it was just a proof of concept and I had the chip lying around from an 'ancient' project.
It's all done with single wires on a 'hole matrix' pcb. I have added 10nF on every ADC input and an additional decoupling cap for the adc. These capacitors plus the adc are the only components on the board.
I will try to do a schematic and take some photos this evening.
Robert, how can I give meaningful information about the noise? Give numbers for power reading with input shorted or with CT connected (no load)?
Re: Smaller current CT?
I have drawn a small schematic (in Protel, so the schematic is attached as jpeg).
The code comes in two flavors, compact (MCP_Read()) or fast (MCP_ReadF()). In the fast version the for loop is unrolled, reading takes less than 8us on a 16MHz ATmega.
The ADC uses exactly the original analog circuitry of the emontx, adc channel numbers are the same. So it is very easy to change from internal ADC to external MCP3208 and vice versa. It would also be possible to read one channel with the internal ADC (voltage) and the other with the external MCP (current).
The circuit eats up nearly all the available I/Os. Instead of using IRQ to
readwrite to DIN of the MCP, it would be possible to use DIO4 instead. You either sacrifice the pulse counting capability of the emontx or the DS18B20 temperature input.PS: pictures were so big, I decided not to attach them.Re: Smaller current CT?
Jorg, the only meaningful way of comparing with what has been reported for various builds (emonTx / pcb, Arduino / stripboard etc) would be with a c.t. around a live conductor and connected but with no current drawn, because the usual complaint is "my xxx reads x watts and nothing is switched on". While detailed measurements would be interesting, they would not be very meaningful because we would be comparing against what various users have reported over time - and their setup is often not specified! From the figures you quoted, the performance looks to be about a factor of 4 better than the emonTx / Arduino - as one would expect - and therefore the absolute noise (referred to the load current) is at least 4 times smaller than what we normally see (though as we know, where the zero sits in relation to the quantisation levels plays a part). So if you could note the indicated rms current - maybe a few times over a period to include any drift, that would be excellent, thanks.
Re: Smaller current CT?
I just made a fast test with two different loads, all measurements averaged over 5 seconds. The results were compared to a VC870 digital multimeter with power measurement adapter.
Current and power values to be divided by 2 for the 300W lamp (two loops through current clamp).
Robert, if all this is OT, can you move it to another thread?
Re: Smaller current CT?
Here are some very quick experiments with the 20bit 96kHz ADC on my Intel Atom motherboard.
I used the standard OEM current transformer with a 22 ohm burden resistor (which gives about a 0.89V peak-to-peak output when presented with a 30 amps RMS primary current: 0.89V peak-to-peak is, according to WikiPedia, the standard for line inputs and 30amps RMS is, I believe, the most my house every pulls )
I connected the CT to a test rig with just an 11W CFL plugged in.
In both attached graphs, the lamp is off for the first third of the graph and is then switched on. I haven't calibrated this system yet so the y-axis is arbitrary.
There are two graphs attached. cfl_96kHz.png is the raw sample from the current transformer (after applying a 5Hz HPF in Audacity).
cfl_8kHz is the raw sample down-sampled to 8kHz. Note that the noise is considerably reduced.
This quick test suggests that this sound card ADC has plenty of dynamic range to work as a good energy monitor ;) and that sampling at 96kHz and then down-sampling to 8kHz does get rid of a lot of the noise. (I'm only judging by eye at the moment, no quantitative measurements yet I'm afraid)
Re: Smaller current CT?
Hi. I am also interested in checking the accuracy with the sound card. Currently I'm using the Emontx V3 with adaptor and 100 A CT all from the OEM shop. I have gone through the report on Mascot and ideal AC to AC adaptor in the forum and also this design by Jack Kelly (here https://github.com/JackKelly/snd_card_power_meter). I want to ask some basic things before I proceed
1. Is it possible to try this design safely on a normal breadboard (Considering the current ratings of this circuit)?
2. If I am correct, with Jack's circuit we just have to add fuses (along with resistances and diodes)in the circuit and plugin the AC-AC adapter from shop?
Thanks
Re: Smaller current CT?
I don't see how you could have sufficient current from this that would not be handled by breadboard. The CT output is normally (except if you have a fault downstream) limited to 50 mA per 100 A of primary current, or (from memory) about 200 mA when saturated, and the standard ac adapter has a continuous current of 670 mA and an internal impedance of around 6 Ω that will limit the current from that. "Veroboard" tracks are good to about 2 A for short periods, so the only problem is if you have a fault between the ac adapter input and the 10 kΩ dropper resistor. If that happens, I think (and I'm not going to test it!) that the internal protection in the adapter - a thermal fuse in the primary winding (see the data sheet) - would operate before anything happened to your breadboard.
Re: Smaller current CT?
Ok Thank you. I will try to see the datasheet and test it... TC