Hi There,
So I've been struggling with this problem for a while, and decided that I should defer to the experts. I've attached a picture of my circuit.
V+ =3.3V
I'm using an ECS1030-L72 Split Core Current Transformer with a 10 Ohm load resistor. My peak volatage coming out of the op amp can't be any higher than 1.2V. I built this in multisim and it worked fine, then I built the same circuit in real life and it doesn't work at all.
Though the CT can measure a max of 30 amps, I don't need to go about 20A rms.
I'm wondering if it might be the LM358 op amp itself? Should I use an LMV358, or maybe an LMV321?
I've seen similar circuits that use a voltage divider, then allow the AC output from the CT to go through the full sine wave, hovering around half of their max input value, but I'm using an XBee chip and I wanted to increase accuracy so I put it through a Voltage Rectifier, allowing the full 1.2V as my max amplitude.
Any help would be greatly appreciated.
Cheers,
Gear
Re: Trouble with CT Sensors
I'm guessing the small swing from your CT output (0.3Vp) is not enough to get past the forward bias voltage of the diodes.
Re: Trouble with CT Sensors
I second that. I don't expect it to work at that voltage either. There's probably nothing wrong with the amplifier itself, if your simulation program misleads you like this, you need a better one, or maybe you're not using it properly.
You need to include the rectifier in the feedback loop so that the op.amp. compensates for the forward drop. Try Google and "perfect rectifier" or "precision rectifier". A full-wave version will cost you two op.amps and some close-tolerance resistors.
But why do you want to rectify the c.t. output anyway? If you use the emonTx input configuration, the rectification is done in the software (though you can still amplify the c.t. output first if you want to).
Re: Trouble with CT Sensors
In running the output from the circuit into a Zigbee Series 2 chip. On the analog inputs, the firmware on the chip will convert the value 0-1.2V to 0.1,023 via the formula
Vin/1.2V = x/1023
By increasing the overall amplitude of the wave and taking sample over the whole wave, it allows for the difference between steps to be half of what it would be if the output swung back and forth over the .6V line.
I hope I explained that well enough...
Anyway, if I'm understanding you properly, I won't be able to use the lm358 op-amp in this circuit, because the ct output is too small. Switching to the LMV358 wouldn't fix this?
Re: Trouble with CT Sensors
What do you plan doing with this I reading at the far end? If you just plan using it to calculate Irms then rectifying it probably doesn't hurt, and as you say increases your A/D resolution. But if you want to be able to calculate real power, then the sign of I is important detail that you'll have lost in the rectification process. There'll be times when I and V are on the same side of 0 (adding to your bill) and times when they're on opposite sides (subtracting from your bill).
I'm guessing by the time your I reading gets to the far end of the XBee link there'll be enough jitter that there'll be no chance of associating it with any particular V reading, in which case Irms is probably the best you can hope for.
Anyway, if I'm understanding you properly, I won't be able to use the lm358 op-amp in this circuit, because the ct output is too small. Switching to the LMV358 wouldn't fix this?
It's more to do with where you've put your diodes then your choice of op-amp. Follow Robert's googling advice and you'll find some circuits that do exactly what you want, and are only slightly more complicated than your current one.
Re: Trouble with CT Sensors
I'm planning to install this into a power strip style device, then sending the data to my computer wirelessly. I only need the current, as all the wall outlets in my house run on 120V Single Phase power, and I'm installing the meter before any power supplies that may be plugged into the strip..
I may as well ask, since I have your attention. Will this work, or do I need a voltage reading as well, then to run a phase-correction algorithm in order to get the wattage going through the circuit? I'm reasonably sure I should be ok with just the current meter, but my professors gave convoluted and unspecific answers (meaning they didn't know either...)
Thanks!
Re: Trouble with CT Sensors
"the LMV358 wouldn't fix this?" No. The principal problem isn't with the op.amp at all. The LM358 will only swing to within 1.5 V of the positive rail, which leaves you with 1.8 V. But as you only want 0 - 1.2 V, that is OK.
The problem is the diodes. If you study the characteristic curve of a diode - the relationship between the voltage across the junction and the current passing through it, you'll find it is highly non-linear - see Fig. 5 here. The section immediately above the diagram explains what is going on. For a common silicon diode, Vd is about 0.65 V. That's what dbC called the forward bias voltage and what I call the forward drop. As you've got two of those - 1.3 V worth - in series with your 0.3 V generator, there is nothing going in to your amplifier which is why you can see nothing out. If you try putting a load on the rectifier in your simulation (say a 10 kOhm resistor between the non-inverting op.amp input and ground), you'll see the output falls to a very low value - probably microvolts. You cannot implicitly trust a simulation - it's a common problem and you need to be very careful to watch out for situations like this one.
Have you read up on "perfect rectifier" or "precision rectifier"? That is going to be your answer. You can have one with gain, so you'll have a perfect full-wave rectifier with gain using two op.amps.
Re: Trouble with CT Sensors
Hmm. While I was writing the above...
What you will read is current (obviously!). If you calculate the rms value of the current and multiply that by the rms voltage, and if the two are in phase, you get power (real power - Watts). If they aren't in phase, you get apparent power, or VA (volt-amperes).
The trouble is, if you have something like a SMPS (in a computer), voltage and current aren't necessarily in phase (the device has a poor power factor) and so the real power - the quantity that the supplier charges you for - will be somewhat less than the apparent power you calculate.
So:
Have you read the Building Blocks articles on AC Power? (I take it you haven't got this far in your studies yet!)
Re: Trouble with CT Sensors
What sort of sampling rate do you hope to achieve on each CT, over the Xbee link?
At 60Hz, your half cycles are going to come around every ~8msecs, and you want to be taking as many samples as you can during that 8msecs.
Re: Trouble with CT Sensors
If you're building this into a power strip, you've got perfectly safe access to break into one of the conductors, so why are you having a split-core c.t.? A ring core should be smaller, cheaper and more accurate.
Re: Trouble with CT Sensors
Awesome, thank you for your help. For whatever reason I didn't really understand the first time the diode thing was explained, now it makes perfect sense.
So I guess here's my next couple questions (if you don't mind)
the XBee limits sample rate to a maximum of 500 sample/second. Are loads (both current and voltage) running off of a standard household socket sinusoidal enough to apply the rms formula in the attachment with a good degree of accuracy if applied over one cycle, a several times a second?
Re: Trouble with CT Sensors
In response to the split core CT question;
Because I have one. If it works with split core, it'll work with a ring core, and I have an extremely limited budget to make this prototype, so I wanted versatility. Once I've nailed it down, I plan to switch to a ring core.
Re: Trouble with CT Sensors
also, just out of curiosity, would I be able to use a voltage divider, positioned between the positive and negative plug terminals, set so that at 120Vrms (max out of the wall), the middle of the divider would only output 1.2V pk? I can't think of any reason this wouldn't work, unless I'm missing something major.... Using the same sampling method/RMS formula, could I figure out the phase angle of the circuit? This seems like a far easier and more straightforward way of measuring the voltage than the ac-ac power adaptor, as long as you know that Vrms is exactly 120V AC.
Sorry, just spit balling. Before I go and blow up a wall socket/burn my apartment down, I wanted to check and see if that's a realistic possibility, or if I'm overlooking something (obviously I'm not dumb enough to do the first test of a prototype in my apartment, that would be insane.... I'll go over to my friend's place and do it there).
P.S. Sorry for the triple post.
Re: Trouble with CT Sensors
Because I have one. A pretty good reason!
(Don't fall into the trap of passing the whole cable through your c.t! It's amazing how often that question crops up.)
the XBee limits sample rate to a maximum of 500 sample/second. Ouch! But are you sure: I read 1000? That's 8 1/3 samples per cycle. I'd say that really isn't good enough even if you're only sampling one quantity (current). If you're measuring voltage at the same time you're down to 4 samples per cycle - not accurate at all, especially as I assume you won't know where in the cycle you are taking the samples. You could very easily construct a spreadsheet (using that formula) to evaluate the extent of the error.
By comparison, the emonTx using interrupts and a free-running ADC can manage around 8 times that.
On that basis, I think you're stuck with apparent power, maybe you want to consider taking the average of voltage and current in hardware before you transmit the values. That could be quite accurate given a resistive (heater) load and possibly quite inaccurate otherwise (though a thorough evaluation of the sources and extent of the inaccuracy for various appliances could earn you bonus points!).
Regarding the voltage: you need to remember first and foremost that you'll be debugging and testing live equipment, so you'll have to be very careful or you will blow up your modules or your computer or yourself. And everything must be double-insulated once it is assembled. Having got that out of the way, you can measure voltage directly, the main point to watch is the voltage rating of the resistors. You should be OK at 120 V, here we struggle and it's necessary to use two or three in series to get the voltage rating. Even so, I'd recommend using two or three same-value resistors in the high-voltage leg. And keep the values as high as reasonably possible to limit the power and temperature rise.
Go and read the Atmel AVR465 App Note (doc2566.pdf). That's all about their processor but it contains a lot of useful data about designing an energy meter (which is essentially what you're doing), including power supplies.
If you're sampling both voltage and current, you measure voltage and current (ideally at the same instant) and you don't use phase angle at all - the average (as I said earlier) is real power.
Re: Trouble with CT Sensors
I only need to put one leg of the cable through the CT, correct?
The XBee chips have a max of 1,000, but when I get into the programming, the best it can do for analog pins is a sample every 50 ms.... shoot, that's only 20 samples a second.... There has to be some way to speed that up. I will look into it. If nothing else, I can throw an AT Mega 644 in there or something and have that run the algorithm and the sampling. I know that there are "programmable" XBee chips as well, though I'm not teribbly familiar with their capabilities.
Here's the brief description given in the terminal program;
Set the IO sampling rate to enable periodic sampling. If set >0, all enabled digital IO and analog inputs will be sampled and transmitted every IR milliseconds.
RANGE:0,0X32-0XFFFF X 1 MS
I did just check, the digital pins can have a sampling rate of up to 1,000 (makes sense, since they only see on/off).
Anyway, I think I could actually do 2 "arcs" as a single cycle for the purposes of the calculation, seeing as they're the absolute value of the amplitude anyway which, when squared will yield the same result. Might help with the lower sampling rates.
Thanks for the safety tips, I will be sure to keep them in mind.
I'll give that a read later this evening and see what it says.
Thanks again, you're a life-saver (potentially literally)
Re: Trouble with CT Sensors
I only need to put one leg of the cable through the CT, correct? Correct. Think about the currents in the cable and the magnetic fields around them, because it's the magnetic field that a c.t. picks up.
Sampling rate: 20/s is the maximum recommended by the designers, I've discovered. That's one every 3 cycles to you (2½ cycles for me). Sample the wave? !!! I think you need to stand back and look at other ways of solving the problem. My first thought is to look at the dedicated meter ICs. Second is to get the rectified averages using analogue electronics. (All 'budget' multimeters display the rectified average reading, scaled to rms for a sine wave.) Either way you'd be transmitting the answer rather than the raw data, and a few times per second should be plenty.
Re: Trouble with CT Sensors
probably better off transmitting the answer, anyway. Less bandwidth. Any chance you have a link to one of the dedicated meter IC's that would work? I poked around but I'm not sure which one to go with, and I'd rather not spend money on one that won't work.
Cheers
Re: Trouble with CT Sensors
Sorry, no. You know now (I think!) what you need, so download some of the data sheets and check to see what is on offer. On the input side you know the voltage and max current that you're interested in, on the output side you know what input your link will accept. One that satisfies both those requirements is looking hopeful. You might even find one that measures the current directly, not needing the c.t.