# SparkFun Forums

### Convert 0.33 VAC from CT to DC

Have questions about a SparkFun product or board? This is the place to be.

### Convert 0.33 VAC from CT to DC#128877

By Scott216
#128877
I have a Current Transformer (CT) that puts out up to 1/3 volts AC when you have the full amps going through it. I'd like to use an Xbee to measure this, but I need to convert it to a nice DC volts that doesn't go above 3.3 VDC. I'm not sure what circuits I need to do this. I read somewhere that maybe dual Op Amps can do it, one to boost the voltage and another the convert it to DC. I looked around in Wikipedia at voltage doublers and bridge rectifiers, but I wasn't sure if they would work for my application; plus that doesn't help me choose specific diodes and other components, it's just theory. I don't know anything about designing a circuit that will do this. Can anyone help? I'm okay at building electronics if they are from a plan or schematic, but I don't know much about designing them from scratch.

### Re: Convert 0.33 VAC from CT to DC#128879

By leon_heller
#128879
Use one op amp to amplify the AC, and the other as a precision rectifier. A good book such as The Art of Electronics will have the details.

### Re: Convert 0.33 VAC from CT to DC#128882

By Mee_n_Mac
#128882
Scott216 wrote:I have a Current Transformer (CT) that puts out up to 1/3 volts AC when you have the full amps going through it. I'd like to use an Xbee to measure this, but I need to convert it to a nice DC volts that doesn't go above 3.3 VDC. I'm not sure what circuits I need to do this. I read somewhere that maybe dual Op Amps can do it, one to boost the voltage and another the convert it to DC. I looked around in Wikipedia at voltage doublers and bridge rectifiers, but I wasn't sure if they would work for my application; plus that doesn't help me choose specific diodes and other components, it's just theory. I don't know anything about designing a circuit that will do this. Can anyone help? I'm okay at building electronics if they are from a plan or schematic, but I don't know much about designing them from scratch.
I think you need an envelope detector. We'd need to know some more to help you. What's the CT you're using ? What's the frequency of your AC ? How often are you sampling it ? Is your 0.3333 VAC peak or RMS ? I'll assume you want that to map (near) to the max input voltage your Xbee can handle (~3.3 V).

Yes, this is a pretty easy op-amp circuit.

### Re: Convert 0.33 VAC to DC#128911

By Scott216
#128911
The current transformer I'm using is from Dent Instruments. Here's the spec sheet.
http://www.dentinstruments.com/media/50 ... 112310.pdf

I think the 0.33 VAC is RMS, but I'll have to contact their tech support to verify.

I'm going to have the CT around a wire that goes to a 1.5 HP motor. The AC frequency would be 60 Hz. On my Xbee I'm planning on sampling once per second.

The CT I'm using is rated at 50 amps, but most of the time the motor will be pulling around 7. I could get a 20 Amp CT, but the other day my motor stalled and when it did it was pulling 50 amps. If I use the 50 amps CT and my circuit is able to use the full bandwidth of the analog input (1024) I'd have a resolution of 0.05 amps, which is more then enough for me.

### Re: Convert 0.33 VAC from CT to DC#128919

By Mee_n_Mac
#128919
Good info, I'd bet it's 0.333 V RMS as well given the intended usage.

I'll think about it some more but it occurs to me that you might be able to use a totally passive system. That is use a step-up transformer to amplify the output of the CT and then halfwave rectify (a diode) that and then low pass filter (1 resistor, 1 capacitor) the result to get a DC voltage to feed into your Xbee. When you ask about the scale factor (RMS or ?) also enquire how sensitive it is to the load the CT will see on that output. Obviously an op-amp circuit can be made to be a very small load (high resistance).

### Re: Convert 0.33 VAC from CT to DC#128920

By fll-freak
#128920
So your CT already has a burden resistor inside. So the output will be a voltage from 0 to 0.33 based on current flow. But that voltage will be an AC signal at 60Hz. Sampling once a second will not be useful. One (of many) solutions is to first rectify the signal and then amplify it with two opamps. The first used as an "ideal rectifier". The second to provide the correct gain to match your ADC input. Ran across an Arduino project that monitors voltage and current on a home circuit. You might want to pock around and see if you can find it as an example.

### Re: Convert 0.33 VAC to DC#128924

By Scott216
#128924
Mee_n_Mac wrote:Good info, I'd bet it's 0.333 V RMS as well given the intended usage.

I'll think about it some more but it occurs to me that you might be able to use a totally passive system. That is use a step-up transformer to amplify the output of the CT and then halfwave rectify (a diode) that and then low pass filter (1 resistor, 1 capacitor) the result to get a DC voltage to feed into your Xbee. When you ask about the scale factor (RMS or ?) also enquire how sensitive it is to the load the CT will see on that output. Obviously an op-amp circuit can be made to be a very small load (high resistance).

I don't know if I'll get an answer on the sensitivity, but I sent them an email to ask. To be on the safe said I'd assume the CTs voltage is pretty sensitive to the load. Looking around and reading these posts, it's seems a couple op-amps would be a good way to go. I saw on Radio shack they have a quad op-amp (LM324) for just a couple bucks. I would just need someone help me with the circuit design.

### Re: Convert 0.33 VAC to DC#128925

By Scott216
#128925
fll-freak wrote:So your CT already has a burden resistor inside. So the output will be a voltage from 0 to 0.33 based on current flow. But that voltage will be an AC signal at 60Hz. Sampling once a second will not be useful. One (of many) solutions is to first rectify the signal and then amplify it with two opamps. The first used as an "ideal rectifier". The second to provide the correct gain to match your ADC input. Ran across an Arduino project that monitors voltage and current on a home circuit. You might want to pock around and see if you can find it as an example.
You're exactly right. What you are suggesting is what I wanted to do from the outset. I need help designing these circuits. If I have a schematic I have no problem building a circuit, but my design skills are limited to Ohm's Law. I've been looking for examples. I found an non-inverting op-amp circuit here: http://www.falstad.com/circuit/e-amp-noninvert.html
This seems like it would amplify the signal okay. I found a full wave rectifier circuit here:
http://www.falstad.com/circuit/e-amp-fullrect.html. But this output doesn't look very flat. I'm only guessing that these circuits are close to what I need.

### Re: Convert 0.33 VAC from CT to DC#128931

By fll-freak
#128931
The links you pointed to are a good start. You can find an "Ideal rectifier" circuit that just uses one opamp and two diodes. If your rectifier and amp are both "inverting" you will get out a positive waveform. It will not be flat as you suggested, nor a sine wave, but rather "camel humps". Each negative part of the AC wave gets flipped into the positive. You now have a 120Hz wave.

This signal you can "smooth out" with a capacitor. It will never be flat, but it will be very much better.

Your other solution is to sample at a faster rate (say 120Hz for the raw 50Hz signal) and do the RMS calculations in the micro and once a second, output the current. If you are careful, you can amplify your +-0.33 volts into 0 to 3.3. You can do this by making the zero crossing of the sine wave be at 3.3/2 volts. You can do this by tying one of the CT wires to a 50/50 voltage divider across the power rail. The other wire will now swing relative to the mid point. This signal you can amplify and pass to the ADC. The only problem is you loose 1/2 of your dynamic range.

### Re: Convert 0.33 VAC from CT to DC#128933

By Scott216
#128933
fll-freak wrote:The links you pointed to are a good start. You can find an "Ideal rectifier" circuit that just uses one opamp and two diodes. If your rectifier and amp are both "inverting" you will get out a positive waveform. It will not be flat as you suggested, nor a sine wave, but rather "camel humps". Each negative part of the AC wave gets flipped into the positive. You now have a 120Hz wave.

This signal you can "smooth out" with a capacitor. It will never be flat, but it will be very much better.

Your other solution is to sample at a faster rate (say 120Hz for the raw 50Hz signal) and do the RMS calculations in the micro and once a second, output the current. If you are careful, you can amplify your +-0.33 volts into 0 to 3.3. You can do this by making the zero crossing of the sine wave be at 3.3/2 volts. You can do this by tying one of the CT wires to a 50/50 voltage divider across the power rail. The other wire will now swing relative to the mid point. This signal you can amplify and pass to the ADC. The only problem is you loose 1/2 of your dynamic range.

I'm trying to avoid the sampling scenario. I'm using an Xbee to transmit the data wirelessly to my Arduino, so the Xbee would have to have high sampling rate and be able to transmit it. I'm new to using Xbees and I'd like to start out simple.

What kind and size capacitor would I use to smooth out the "camel humps"?

--Scott

### Re: Convert 0.33 VAC from CT to DC#128934

By fll-freak
#128934
I have never been able to spend the time need to understand the whole filter/cap 'thing'. My solution is to try various values till I get one that works. I suspect if you were to post the question about how to filter/smooth a 120Hz camel hump wave form, some electron jockey here could tell you the right value.

### Re: Convert 0.33 VAC from CT to DC#129058

By Mee_n_Mac
#129058
You might want to look at circuit 6A in the following. With a few tweaks, it's what I think you need.

First you get the rectification and gain you need. Adding a low pass filter (or peak picker) will smooth out the "humps". I believe the circuits input resistance is high enough not to upset your CT's scale factor and given you're dealing with 60 Hz signals, "fast" op-amps and high slew rates aren't needed. It will need to be modified to work off a single voltage supply (vs +/- voltages) as I assume you'd run this off the same 3.3 V DC you'd be running your Xbee off of.

So I'd ask what's the min current level you need to measure "accurately" ? What's the max level ? What accuracy (+/- ??? %) do you need between these two levels. What's the resolution needed and what's the max level you need to be able to detect ? You can increase the gain to get finer resolution (and increase the range of currents measured accurately) and allow the op-amp circuit to clip/limit at XX amps, which might be a level below what your CT could output. Given your 1/sec sampling rate I'm assuming you're usuing this to monitor if the motor is running or not or stalled and to perhaps have some idea of power being consumed. As such the circuits time response can be "slow", just a factor or 5 or so faster than the 1 second ... in order to really smooth out the "humps". At worst the "humps" happen every 16.6 msecs (8.3 msec in the circuit below), so a response of 166 msecs would reduce them greatly, leaving only the average DC voltage (= average current to the motor) but still allow the circuit to respond fast enough to changing motor currents to be "caught" by your sampling.

http://sound.westhost.com/appnotes/an001.htm

### Re: Convert 0.33 VAC from CT to DC#129100

By Scott216
#129100
Mee_n_Mac wrote:Good info, I'd bet it's 0.333 V RMS as well given the intended usage.

I'll think about it some more but it occurs to me that you might be able to use a totally passive system. That is use a step-up transformer to amplify the output of the CT and then halfwave rectify (a diode) that and then low pass filter (1 resistor, 1 capacitor) the result to get a DC voltage to feed into your Xbee. When you ask about the scale factor (RMS or ?) also enquire how sensitive it is to the load the CT will see on that output. Obviously an op-amp circuit can be made to be a very small load (high resistance).
Tech support told me that as long as the input resistance is 10,000 ohms or more, the CT accuracy will be fine. The output voltage rating is RMS. It outputs 0.33 volts when 50 amps is going through the CT. The CT will clip the voltage at 0.5 volts if you put more then 50 amps through the CT.

### Re: Convert 0.33 VAC from CT to DC#129110

By Mee_n_Mac
#129110
Scott216 wrote:Tech support told me that as long as the input resistance is 10,000 ohms or more, the CT accuracy will be fine. The output voltage rating is RMS. It outputs 0.33 volts when 50 amps is going through the CT. The CT will clip the voltage at 0.5 volts if you put more then 50 amps through the CT.
Excellent !

I had a somewhat detailed response that got poofed (that's 2x in as many days) when the SF forum went offline. Because there's only so much time in a day let me ask what error are you willing to tolerate ? Are you looking to have the system report a current measurement thats with +/-1% of the true current ? +/-5% ?? +/-?? % ???

Over what range of currents do you want this level of accuracy ? Because of the diodes, small current levels will have more error than larger levels. You can mitigate this somewhat by having a large gain such that the range of levels with "bad" accuracy is reduced. Just as an example, would you care that 0.2 A RMS as reported was really 0.3 A RMS ? What the lower limit that you need to have the above desired level of accuracy for ?

Is there an upper current limit that you need to measure ? By increasing the gain of the circuit, you can get better accuracy (and resolution from the Xbee A/D) but at the cost of dynamic range. Specifically the circuit may clip before the 50 A RMS output of the CT (0.333 V RMS) is reached. Would you care if the max reading was limited to ... say 30 A RMS ? And that any level above that would still be reported as 30 A RMS ? IOW do you want/need the full range up to 50 A RMS or do you just need to know something has gone wrong and the motor is probably stalled ? What level of current does that for you ?

Just to toss out some numbers ... As it stands as posted above the circuit needs to filter out the "humps". If you put a low pass filter (LPF) with a bandwidth (BW) of ~ 1 Hz (that's the 166 msec time constant I mentioned above), any ripple content at 120 Hz component will be reduced by a factor of 200. Now perhaps that's overly conservative (I'll ponder it some more tonight) and a higher BW for the LPF would be OK. To do a LPF you'd put a capacitor in parallel with R5. The cap value would be 16.6 uF if R5 remains at 10K (I don't think it should) to get the 1 Hz BW. Larger R5 values would reduce the cap value needed and increase the gain (which is also needed).

The gain (Vout DC/Vin RMS) of the LPF equipped circuit is nominally 1.414*(2/pi) after rectification and filtering. A 50 A RMS level would result in a 0.333*1.414*2/pi = 300 mV, obviously too low a voltage so more gain in both the 1'st op-amp stage and 2'nd is needed. To prevent unintentional clipping in the 1'st stage the additional gain should be distributed. If you're running this circuit off the 3.3 VDC you're powering the Xbee with (are you ?) then the best you could hope for is a max 3 VDC output. If you want to retain the full range to 50 A RMS that means a gain increase by a factor 10 (easy to do). Increase R2, R3 and R4 ... I can figure out the right amounts when you tell me what the desired dynamic range is. I do have to think about how to connect your CT given the circuit needs to run off a single ended supply voltage (as shown it was running off +V and -V supplies).

Lastly is there going to be a computer or some ability to "massage" the digital data coming from the Xbee before it's final usage (whatever that is) ? I ask because if so then perhaps a lookup table or some other form of error correction could be implemented. For example a reading of ABC counts could be calibrated to be XYZ A RMS. In this way the circuit could be built to "loose" tolerances for gain and perhaps not need offset/bias voltage correction. These could be done in software instead. Then again perhaps you don't need much in the way of accuracy ...

BTW is this a one off prototype thing or are you going to have a PCB made ?

### Re: Convert 0.33 VAC from CT to DC#129143

By Mee_n_Mac
#129143
OK, so I thought a bit more about how to run this circuit (or any other akin to it) off what I think you have easily available for a supply voltage and the problem I thought might be a problem ... might be. Let me explain.

I think you (will) have a 3.3 V DC supply to run the Xbee off of. At first thought it seems natural enough to try to use this to run the op-amp circuit as well. The problem comes in that doing so means the op-amps will need to be biased at 1.65 V. To them it appears that they have +/- 1.65 V rails. Let's say an op-amp can output up to +/- 1.5 V given those rails (really 0.15 to 3.15 V). Now the max voltage feed into the 2'nd op-amp can only be 1.5 V (from the bias voltage) minus a diode drop. With "normal" diodes this drop is ~0.6 V, thus the max voltage to the 2'nd op-amp is 0.9 V (above the bias voltage). If you retain the full 50 A RMS dynamic range, the peak AC voltage out of the CT is 0.333*sqrt(2) = 0.47 V. So the max (AC) gain of op-amp #1 is 0.9/0.47 = 1.9 (~ 5.6 dB) at best. Therefore the 2'nd stage must have the rest of the gain (20 - 5.6 = 14.4 dB). Where does that leave us ?

Well having to add a DC bias network to the CT will mean having to add a bit more gain. I consider 20 dB the max for any 1 stage. While this all might be do-able the real issue is that for most currents below the 50 A RMS level (which is were you'd be operating) the 1'st op-amp is spending a lot of it's time swinging through the diodes non-linear region. That means not so good accuracy and gains that will probably vary with signal level and temperature. I'd have to put the circuit into pSpice to simulate it to see how good/bad the issue is. The author at the URL I provided thought it was good at 20 mv (peak ?) which would correspond to ~ 2 A RMS in your system so perhaps I'm concerned unnecessarily.

What can be done ? Well use germanium or Schottky diodes I suppose. I'm not that familiar with those. Or you can reduce the dynamic range required. Or you could run the op-amps of a split set of voltages (+/- V DC) at something more than 3.3 V DC. That would be a big help. How much would "V" have to be ? I'm not sure right now. Is that even an option ?

BTW I think any rectifier circuit with "normal" diodes trying to run off +3.3 V would have the same issues. I don't think there's a magic solution in a different topology (short of some "exotic" switched one). But perhaps I'm wrong and someone else knows of one ...

BTW2 : Can you see now why I asked what I asked above ?
###### long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

###### Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

###### Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

###### Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]