Help interfacing Current Transformers to ADC

(1) The inverting op-amp may not work well at ground reference with single supply. It will also not be able to output more than about 4 VDC, and the emitter follower, besides being unnecessary, limits output to a little over

3 volts.

(2) The total of 2K ohm impedance into the A/D, with no capacitor, may pose some problems when sampling occurs. If you must use an op-amp, feed the A/D directly from the output for lowest impedance. The supply for the op-amp should be at least 8 VDC to get a full 0-5 VDC output.

(3) The 10 ohm burden resistor will give 100 mV with 10 amps on the 1000:1 CT secondary. You need to boost that to about 4 volts for the A/D, so a gain of about 40 is required. If R1=100, R2 should be 4K. You can replace R2 with a 5k pot for adjustment.

The main advantages of an op-amp circuit are being able to use a smaller burden resistor to improve linearity, providing lower impedance to the A/D, and being able to use active filtering. The bridge rectifier already trashes the linearity, R3 and R4 adds impedance, and the active filter is only single pole.

Once you have a good reliable analog circuit that you can analyze and understand, your physical design is done, and simple is generally better, unless there is a strong reason for added components, and full understanding of their purpose.

The PIC programming is really not that hard, and the more knowledge you acquire the better. As a programmer, the concepts should not be difficult, although you may be more in tune with object oriented events driven software, rather than low level concepts such as ISRs and real time considerations, where a few microseconds can make a huge difference. I can send you some PIC code that will set up the PRT to make A/D samples at a useful rate, for one channel, and also perform the necessary accumulation and comparisons if you want to add a relay or LED output for an alarm. The code I would provide would be for a PIC12F675, which is a little 8 pin IC with an A/D. It is the same IC that is used in the Microchip PICKIT-2 evaluation kit, which has all you need to breadboard your circuit and program the PIC, for about $30. You can then migrate to a more powerful micro with more A/D and also a serial port or other features. I personally like the PIC18F242 or the newer 18F2420, and I can help provide coding for that. (It also can be used with a C compiler). There may be a PIC better suited to your particular application, and they can be obtained as free samples from the

formatting link
website, along with all kinds of app notes and reference designs. Fear not the mighty PIC!

All resistors and pots can be 1/4 to 1/2 watt. You are looking at no more than 50 mA and 5 volts for all the components combined. If you use a pot, it is best to use the wiper to tap off to the low current measurement circuit. If you use it as a variable resistor (rheostat), tie the wiper arm to one end so the circuit will never be open as the wiper slides on the element.

Good luck,

Paul

Reply to
Paul E. Schoen
Loading thread data ...

Yes. There are several ways to connect a trim pot to this amplifier without having a significant fraction of the CT current passing through the wiper. For instance, you can connect a pot between the input resistor and the feedback resistor and connect the wiper to the

- input. This keeps almost all current out of the wiper.

Reply to
John Popelish

Move D3 to parallel R6.

You might add a 100 ohm pot element between R1 and R2, and connect the wiper to the - input. This keeps all current out of the wiper and allows a 2 to 1 change in the full scale output per amp AC. You can change the value of R2 for larger changes, or to center this adjustment.

R6 absorbs almost all the power from the CT, but its low resistance keeps its power low. Figure I^2/R. So at 30 mA secondary current, the power is only .03^2*10=9 mW. R1 has the same voltage drop with only 1/10th the current, so its power is much lower. R2 has the same current as R1, but 5 volts across it at full scale current, so it dumps a something near .003A*5V=15 mW. I would use 1/4W 1% resistors because they are cheap and stable.

This new circuit with the external burden across the bridge, makes the source no longer a current source to the opamp, but a 10 ohm source. Now the ratio of R1 and R2 program the opamp to act as a voltage amplifier for the voltage across R6. This means that R2 will need to larger, to get the required output voltage.

For instance, if the CT has a ratio of 1000:1, and the primary current is 10 amps, the output current will be 10 mA. That passes through the parallel combination of R1 and R6, or 9.09 ohms, and will produce a .0909 volt drop across R6 and R1. But the current passing through R21 will be only .0909/100 = 909 uA.

That current will also pass through R2, producing the desired output voltage. To make that output 5 volts, R2 must be 5.909uA =5.5k.

This was the desired effect of adding R6. It lowers the current load on the opamp output stage.

If you are not sure, exactly what full scale current ranges you will finally choose, get an assortment of R2 values that cover the possible range in something like 40% steps. This will allow the adjustment pot to cover the entire range with steps in R2.

Reply to
John Popelish

Forgot to add: Once you put a current divider as a burden (add R6), reducing the current the opamp output must carry through R2, you no longer need the emitter follower current booster at the output.

Reply to
John Popelish

Hello John,

That is an interesting method. Got to try that some time but now I am going to be busy with a wireless project for a little.

Those coeffs are a bit on the small side. That is what I try to avoid. I like them to be above 0.05 to maintain dynamic range but that will cost extra stages.

Didn't quote the code but it made me curious: Which processor are you using? Mine usually don't have a HW multiplier and the right and left shift has to be done one step at a time. Looks like yours have a barrel shifter.

--
Regards, Joerg

http://www.analogconsultants.com
Reply to
Joerg

OK, I'll jump in on this.

As John Popelish pointed out, you no longer need the transistor _if_you_have_high_resistance_ in your feedback network. You changed my

25K to 250R, doing two bad things: 1) you kept a low feedback resistance, and 2) you have much too low gain (2.5X).

1) The low resistance will make the load on the op amp marginal at best. If you keep the low resistance, you should keep the transistor, but there's no reason at all to have such low resistance, therefore no reason to have the transistor.

2) The point of going to a 10R burden was to lower the burden voltage on the CT. But this means that the 20A full scale you mentioned earlier will give a full scale voltage across your burden of 200mv. 2.5 X 0.2 = 0.5V full scale out of your op amp. Using the correct 2.5K feedback resistor will get your 5V full scale, _and_ lower the current output from the op amp so that you don't need the transistor any more.

Oh, it also means the ripple will be even worse than Jim showed my circuit to have (the much lower RC time constant).

You still have an LM324 op amp, which

1) has rather high offset voltage 2mv -- 5mv 2) can't get within 1.5V of Vcc,

1) 2mv doesn't sound like much at the full scale 200mv, but suppose you have a lightly loaded motor that draws only 2A?

2) The Vcc - 15.V meands you still need the micro protection diodes, since you'll have to have at least 7.2V for the op amp supply. Remember my comment that 5V supply and rail-to-rail outputs avoid a lot of problems?

Understandable. I'm not happy about your learning assembly language on a weird monster like the PIC, but ...

So you want to have a signal conditioner per CT. This explains your reluctance to use the AD8551 -- this, and the fact that the 8551 is not available in DIP, which I recall your having expressed a preference for in an early post. So, we need to find a 5V supply, rail-to-rail I/O, low offset op amp that won't cost an arm and a leg, and is easy to solder to a board.

I'll do some looking -- it's 0300, and I'm quitting for the night. If I don't see any good candidates when I next read the group, I'll do a search and come up with something for you. There are quite a few out there, but they're not the old jellybean types, so you have to look carefully both at the data sheet and at the vendor.

Assuming your 20A full scale, the burden will dissipate

0.2V X 0.2V / 10R = .004W

I don't think you can find a resistor that won't dissipate that comfortably. Everything else dissipates even lower current, so you don't have any problems there.

Reply to
John Perry

At this point I would like to explore building both YOUR proposed circuit, and the one that Jim and the Johns are helping me with. I feel that this will give me a much better feel for what is going on, after all I am in no big hurry and this is as much about learning as it is about building a useable project.

Yes I am an OOP guy for the most part. I code in VB and have done so for a long time. I have worked very little with inline code and realtime apps. Though I was a good assembly programmer, it was 15 years ago and I learned on a VAX using VMS. The only thing left is a scant memory of machine code programming. I also have COBOL nightmares once in a while. As with most everything I do, I am for the most part self taught (though the C++, Assembly and COBOL were taken in college as a Comp Sci student... sadly the profs new less than the students in most cases).

I have great plans to learn uC stuff, but sadly would like to use BASIC (either PICBASIC or BASCOM-AVR). I suppose I need to learn the PIC, but have become greatly interested in the ATMEGA128.

Looking at the Microchip website the PIC16F785 seems to be very well suited to the task at hand.

So yes Paul, I would love to have some help writing code to support your proposed circuit for this project. As I mentioned, it would be nice if we could do this in PICBASIC so that I can follow along more easily. I suppose you will make a good arguement for using C or even Assembly though!

Reply to
beananimal

Yes I now understand that the offset in conjunction with the somewhat poor linearity and overall accuracy will be poor at low primary currents. I am open to other ApAmp considerations to help reign in some of this error.

I can supply the filters with whatever is best suited to reach the desired goal here, that includes changing to +/- supplied filter if need be.

As I mentioned in my reply to Paul, I would much rather use PICBASIC to get started with PIC programming. Maybe that is a backwards idea and will prevent me from leaving the VB mindset.... This is certainly something to think about, but the added complexity gives me a headache! Nothing like having to build a set of jigs to build a machine tool, just to build a better set of jigs to build a better machine tool!

Yes DIP would make my life much easier, but I am aware that as time passes DIP is becoming rather outdated. I suppose at some point I will have to sharpen my soldering skills and get comfortable with SMT stuff.

When we are talking cost of OP-AMPS. I don't mind buying (6) quad amps at a few bucks each. If we have to go with single amps, then we can, and again if htey are a few bucks each that will be OK.

My basic interest in electronics has come from the audio side of things. Over "there" the Burr-Browns are very popular for active filtering for crossover networks and buffers.

Bill

Reply to
beananimal

(snip) Take a look at:

formatting link

It has a maximum 150 uV offset (about 20 times better than an LM324), a common mode input voltage range from the negative rail (Vss) to .9 volts below the positive rail (Vdd -.9), rail to rail output swing (so could do this job supplied by 5 volts) and runs about $2 per quad from Digikey.

Reply to
John Popelish

This is an MC68332. Since all the registers are 32 bits, small coefficients are not a problem. This is a 0.17 Hz filter clocked at

140 Hz, so the factors get small.

The '332 has a 32x32 multiply which wouldn't add a big speed penalty to this filter. The step response has a small, slow tail as a result of the ideal coefficients being rounded to right-shifts. It wasn't a problem here (it's filtering a displayed, noisy thermocouple temperature) but we had one application (weighing pills) where the settling time mattered, so we changed one of the shifts to a multiply, tweaked the value, and that snapped it right up.

This filter iteration executes in about 9 microseconds on a 16 MHz CPU, as I recall.

John

Reply to
John Larkin

Hello John,

That is a luxury processor when compared to pretty much any of the ones I used.

Well, if I had a Ferrari Testarossa I could be at the next shopping center in three minutes. Once...

--
Regards, Joerg

http://www.analogconsultants.com
Reply to
Joerg

Absolutely. I can't remember the last time I had to do an add-with-carry operation!

John

Reply to
John Larkin

Hello John,

It can be even worse. You find the ideal filter shape and then after lots of shuffling with CSD you discover that the total number of zeros in the coefficients ain't sufficient so it all won't fit.

--
Regards, Joerg

http://www.analogconsultants.com
Reply to
Joerg

Paul

I have decided to go with the PIC18F2420 or 4420 for this project and interface it to the PC via a MAX232. As I mentioned I am interested in learning how to do implement your ideas via the PIC as well as the other circuit that Jim and John and John have helped me create. I will be using PicBasic and have arranged to try a copy of the pro version at a local school (sadly, there are no classes available for me to take or I would). I have read the datasheet and worked out some of the basics. I do have some serious questions regarding what type of Clock setting to use, what A/D setting (TAD and FOSC) to use to ensure that I can communicate with the PC and do the A/D etc.

I have ordered some parts for my prototypes and would like to start working on the PIC portion of this project while I wait for them.

I am sure the uC portion of this project is not appropriate for this group, so we can take it elsewhere or to private mail. Please let me know what your preference is.

Thanks, Bill

Reply to
beananimal

Maybe

formatting link
PIC Simulator IDE is powerful application that supplies PIC developers with user-friendly graphical development environment for Windows with integrated simulator (emulator), Basic compiler, assembler, disassembler and debugger. PIC Simulator IDE currently supports the following microcontrollers from the Microchip PICmicro 12F and 16F product lines: 12F629, 12F675, 12F683,

16F627, 16F627A, 16F628, 16F628A, 16F630, 16F648A, 16F676, 16F684, 16F685, 16F687, 16F688, 16F689, 16F690, 16F72, 16F73, 16F74, 16F76, 16F77, 16F737, 16F747, 16F767, 16F777, 16F83, 16F84, 16F84A, 16F87, 16F88, 16F818, 16F819, 16F870, 16F871, 16F872, 16F873, 16F873A, 16F874, 16F874A, 16F876, 16F876A, 16F877, 16F877A.

You are welcome to download the fully functional evaluation copy of the software on the downloads page. PIC Simulator IDE requires a license to operate after the evaluation period. Personal license for your home computer available for only ?29. For more information please visit the licenses page.

Reply to
Homer J Simpson

I could post the PIC code as text but it would be better to send it as a .TXT file, which you could change to .ASM to assemble using the MPLAB tools supplied by Microchip. I don't know if you can set up ISRs using PICBASIC, and if you can, it would have to be efficiently compiled to work properly. All of my PIC code is in assembly, but it is fairly well commented. Much of it is in the form of subroutines where you might put some data in file registers or a buffer and then get data out (or have it sent out the serial port). My code is for the PIC18F242, but I am setting up my new project with a conditional assembly for both PICs.

My first project with this PIC is the Ortmaster. More details are on my website at

formatting link
and a downloadable version of the Windows portion is available at
formatting link
Basically, this project reads an AC current anywhere from about 5 amps to 5000 amps, sampling it at 2400 times per second, and reads the true RMS value of that current as well as its duration, to an accuracy of better than 1% and time to within about 1 mSec. A previous version used the parallel port in MSDOS to manipulate the hardware. My new version, written in Borland Delphi 4, uses a serial port (through a USB-USART bridge), and a smart board (with the PIC18F242) to take the 10 bit readings through an RS232 port at 57.6 kBaud, in the form of two characters with 5 bits of high-low data and two bits as a data check mechanism.

My newer project is a smart SCR gate firing board which I have discussed in previous posts.

I'll send you an email to get started.

BTW, you will need a way to program the PICs and run and debug the software. I use the MPLAB ICD2, which I think is about $150. You can use the PICKIT2 for simple programming of smaller PICs, but for the PIC18 series you will need something like the ICD2. There may be some less expensive options, especially for just programming, but you will want a debugger to set brealpoints and see what's happening. The software simulator is good, but at some point you will need to get down to a hardware level.

Paul

Reply to
Paul E. Schoen

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.