op amp current sensor - help needed!

Discussion in 'The Projects Forum' started by -SK-, Apr 14, 2009.

  1. -SK-

    Thread Starter Member

    Apr 14, 2009
    25
    0
    Hello,

    I am developing an automatic test rig for some electric machines. One part of this rig is a high-side current sensor that I put together. The schematic is attached.
    How it is supposed to work is that the (rail to rail) op amp sees the voltage on V- (either 6 or 12V), and adjusts its output into the transistor base to shunt away excess current from V+ to make the inputs equal. The extra shunted current is proportional to the drop across the sense resistor, and is grounded through the emitter resistor. I amplify the voltage across that with a simple NI amp and read that voltage.

    I originally built this rig on breadboards, which I still have. The sensor works fine on the breadboard. I recently designed and ordered some PCB prototypes for the rig, and am in the process of finishing up the project.
    However, on the PCB the current sensor circuit does not work properly.
    The sensor seems to work fine when using the 12V supply; the output of the first opamp is between 0.1V and 2V. However, when using the 6V supply the output of the first op amp is always >11V; the transistor saturates and the emitter voltage is also 11V, and as you can imagine the output of the NI amp is therefore railed.

    There is no difference between the components on the breadboard and the pcb, save for part footprints. There is no difference between the routing on the breadboard and the routing on the PCB, save for wires vs. traces.
    I have eliminated ground loops, bad traces, shorts, and bad components as possible problems. I am just at a loss now. Any help is appreciated. Thanks!
    -SK-
     
  2. -SK-

    Thread Starter Member

    Apr 14, 2009
    25
    0
    As a side note, I have read something about op amp output latch-up. Could this be what is happening here?? I picked a rail-to-rail op amp specifically to enable it to handle common mode inputs near its positive supply rail, and the datasheet of the op amp (LT1491) seems to agree with my application. The weird part is that the 'latch-up' is occuring when the measured voltage is half of its positive supply rail, not close to it.
     
  3. Darren Holdstock

    Active Member

    Feb 10, 2009
    262
    11
    Could be an input bias current issue, as the input impedances are mismatched. Unless you're sensing very high currents, the voltage drop across that 0.01 Ω resistor could be swamped by bias offsets. Just for troubleshooting purposes, try raising the value of the sense resistor (say 1 Ω). If the circuit starts to behave, try inserting a 1 kΩ resistor in the inverting input line.

    Kelvin connections are pretty much mandatory to connect to such a small sense resistor, if they're not already present, as the PCB trace resistances will be relatively significant.
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    The LT1490 is not prone to latch-up (phase inversion); this is on the first page of the datasheet.

    Your schematic does not include reference to the voltages you are supplying to the other nodes; V+ is an unknown value. You've shown Vs as being 6v or 12v. Are the +V (Vcc/Vdd) inputs of the opamp being supplied with Vs, V+, or some other voltage?
     
  5. -SK-

    Thread Starter Member

    Apr 14, 2009
    25
    0
    Darren: I use Kelvin connections on the PCB. I will try inserting a 1K resistor in series with the Inv. input. I have been looking at some IC current sensors and internally they seem to be the same as my setup except for 1K's on both inputs.

    Wookie: Sorry for the lack of labelling. Vs (6 or 12V) is what I supply to the device under test. I supply Vdd (positive supply) of the op amp from a separate 12V, and Vss (the negative supply of the op amp) is connected to ground. V+ is something I put so I didn't have to draw a crossed wire; V+ in the schematic is the non-inverting input of the first op-amp, which is connected to the 1K resistor and to the transistor's collector.
     
  6. -SK-

    Thread Starter Member

    Apr 14, 2009
    25
    0
    Darren: I added the 1K resistor on the inverting input; there is no change for 6V (the output is still railed) and at 12V it no longer functions (the output is a constant 3mV no matter what current runs through). I also don't believe this is an input bias current problem, as the circuit works perfectly on the breadboarded edition with a 0.01 sense resistor, and works decently at 12V on the PCB.
     
  7. Darren Holdstock

    Active Member

    Feb 10, 2009
    262
    11
    Hmmm. Time to start probing. SK, could you take some DC voltage readings of the 1st op-amp inputs and the 1st op-amp output, all measured relative to pin 4 (it must be direct to the pin, not a 0V elsewhere). That should provide some valuable clues - there's only a finite number of things it can be.
     
  8. -SK-

    Thread Starter Member

    Apr 14, 2009
    25
    0
    I've got some readings here that I took earlier. The 1K is still on INV input:
    With 6V supplying the load:
    V+1 = 11.05
    V-1 = 6.03
    Vout1 = 11.82

    With 12V for the load:
    V+1 = 11.96
    V-1 = 11.95
    Vout1 = 1.64

    Oddly, with the 1K on the INV input the output suddenly jumped from the 3mV I measured when I first put it on, up to what it is above. Since then, its been slowly falling about 100mV per minute.
     
    Last edited: Apr 15, 2009
  9. Darren Holdstock

    Active Member

    Feb 10, 2009
    262
    11
    OK, the question to ask is: With a 6 V driven load, why is there 11.05 V on V+1? PCB shorts aside, it can only be coming from the transistor, either a base-collector short (unlikely here I think), or the transistor is saturated because the value of that 50 kΩ resistor is too high, and the emitter voltage has run out of headroom. SK, what was the magnitude of the sensed current when you took the above measurements? I'm guessing about 1 A, but it's lost a bit in the resolution of the voltmeter as 1 A only gives 10 mV across 0.01 Ω.

    I'm still not convinced there aren't bias current issues using that little 0.01 Ω sense resistor, but it does seem that's not the main problem at the moment. All the same, it might be useful for diagnostic purposes to crank it up to 1 Ω temporarily, reducing the 50 kΩ to match. It eliminates a potential complication and makes troubleshooting easier.
     
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I did a simulation of the circuit with Linear Technology's free LTSpice program, and ran into some similar problems. Didn't have much time to play with it, but you can download the simulator and play with it. The LTSpice .asc source file is attached; just download it to your LTSpice directory and load it from within LTSpice.

    Note that unless the load is greater than about 30mA, the response will be very non-linear; Vbe and hFE of q1 figure in here.
     
  11. Darren Holdstock

    Active Member

    Feb 10, 2009
    262
    11
    Thanks to SgtWookie for the SPICE file - I've been having a bit of a play with it, and it's quite interesting. Something also to note is that if the voltage on the Q1 emitter tries to go higher than the load voltage then the 1st op-amp output will saturate high.

    SK, here's a quick-and-dirty thing to try: Make the sense resistor 1 Ω and put 100 mA through it, fed from your 6 V source. The voltage at the Q1 emitter should be 5.00 V - if it isn't then there's something fundamentally wrong. Ignore the 2nd op-amp stage and the original spec requirements, this is just for troubleshooting purposes.
     
  12. -SK-

    Thread Starter Member

    Apr 14, 2009
    25
    0
    Darren: I agree that the transistor is saturating. I switched Re to 25kΩ, with no change in the circuit's behavior. I now switched the sense resistor for 1Ω, and reduced Re to 10kΩ. The transistor no longer saturates. This is what I measure.
    6V load:
    @ 23mA
    V+1 = 6.08v
    V-1 = 6.06v
    Vo1 = 0.52v
    emitter voltage= 20mV
    @ 460mA
    V+1 = 6.03v
    V-1 = 5.62v
    Vo1 = 0.5v
    emitter voltage= 10.6mV
    The transistor isn't even switching on. I could play with different values of Re, but I'll probably destroy my board with all the de- and resoldering (surface mount parts).
    I ordered a current monitor IC, the INA139 from TI. I will try to incorporate this in case I can't fix my sensor. Ironically, the internal schematic is nearly identical to my sensor circuit.

    Wookie: Yes the response is not linear. On the breadboarded circuit I did a lagrange interpolation on some points I took and got a very close 2nd order polynomial fit. If I get time today I will acquire a SPICE program and try that simulation.

    Side note: I fired up the breadboard prototype tester (same as the schematic) and connected the same device I tested to get the above values. This is what I saw:
    6V supply, 23mA:
    V+1=6.04V
    V-1=6.03V
    emitter voltage=0.17V

    450mA:
    V+1=6.03V
    V-1=5.99V
    emitter voltage=2.1V

    This is how it should work. I am still really confused as to why the breadboard one works fine; usually PCB stuff works better.

    [​IMG][​IMG][​IMG][​IMG]
     
  13. hOHMer

    New Member

    Apr 15, 2009
    2
    0
    Try modifying the circuit as follows. Swap V+ and V- on the sense resistor, Change the Transistor to a PNP with the emitter going to V-. This will allow you to bias the transistor on regardless of The input voltage. The only thing is that if the input voltage is greater that your opamp supply voltage you may not be able to turn the transistor off. Attached are the drawing and the LTspice circuit. LTspice is free from the Linear Tech website http://www.linear.com/designtools/software/ltspice.jsp
     
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, you need to measure the voltage to ground at either V+1 or V-1, and then measure the difference between V+1 and V-1 using the lowest scale that you can get a complete reading with. 6.06v vs 6.08v just isn't sufficient resolution.
    With 460mA current and that much difference between V+1 and V-1, your 0.01 Ohm resistor is actually about 0.891 Ohms. Perhaps you forgot to calculate the resistance that your selected trace width and copper thickness would have at that kind of current? You could reduce the resistance of the traces significantly by silver-soldering some copper buss wire to them.

    That's a hazard of such experimentation. Right now, you have some known problems. Your breadboard has some unknowns in it too; they're not really designed for lots of current. You may find the "dead bug" prototyping method to be more helpful for your circuit.

    Well, that will remove some of the unknowns, and the circuit itself will certainly be more compact than it is now. But do analyze the trace widths and copper oz on the boards you made; you may very well discover that they are undersized for the load currents you're subjecting them to.

    Wookie: Yes the response is not linear. On the breadboarded circuit I did a lagrange interpolation on some points I took and got a very close 2nd order polynomial fit. If I get time today I will acquire a SPICE program and try that simulation.[/QUOTE]
    Downloadable from Linear.com; see the above link.

    Hmm - looks like your traces on the PCB are either too small, too long, or bad solder joints on the SMT resistor.

    You can't link images to files posted on your computer. You might be able to see them, but no-one else can.

    You need to use the Advanced button, and then click the "Manage Attachments" button on the next page. Then you can upload files to the Board.
     
  15. hOHMer

    New Member

    Apr 15, 2009
    2
    0
    I think your original circuit will work if you power the opamp from the input source. That way you can't drive the base and emtter of he transistor above the input voltage. Once the emitter voltage is driven above the input voltage you won't be able have any collector current shunting away from V+.
     
  16. -SK-

    Thread Starter Member

    Apr 14, 2009
    25
    0
    hOHMer:
    I have tried powering the op amp from whatever the input voltage is (6 or 12) and that does make the circuit work, but with different resulting outputs. If I stick with this approach, I will need to use a different interpolation for each voltage. Whatever it takes to get this to work, I guess.

    Sgt.Wookie:
    I re-checked my pcb trace widths and they are adequately sized. I originally used data on the pcb manufacturer's website to choose trace widths, and after reading your post I rechecked them using the first calculator that came up in google.
    http://circuitcalculator.com/wordpress/2006/01/31/pcb-trace-width-calculator/
    The power trace going to the load is approximately 2 inches long, I used 3 inches in the calculator. Plating is 1oz/ft^2, max current expected is 500mA. Using these values, the calculator gives 11.8 mil trace width for internal, and 4.55mil for exposed trace. I made the trace 30 mils wide.
    Using another calculator from the same site,
    http://circuitcalculator.com/wordpress/2006/01/24/trace-resistance-calculator/
    I determined the resistance of my power trace to be 0.0486Ω.
    That accounts for the extra resistance seen in my measurement. Good suggestion though, I didn't think to double check the trace widths / Ω when I first started troubleshooting.
    Also, disregard the random image link, I did not intend to attach an image. I do know how to attach an image to my forum post. The computer I work on, whenever I use Ctrl+V to paste anything, pastes a screen capture image, or the directory of that image, for some reason.

    In other news, my current sensors came in and I got one set up on a breadboard. I built the circuit given in Fig.1 (page 5) of the INA139 datasheet, using a gain of 100 and a 1Ω sense resistor. This circuit at least gives some kind of output, and it does not saturate to 12V when using 6V supply, but it shows some interesting behavior in that the output voltage slowly drops over a period of minutes. I am just using a resistor in series after the sense resistor to get a constant DC current. I have tried different currents, from 20mA up to 500mA, and the output voltage will start at something reasonable by slowly fall.
    I have left it running for two current values, each time for a few minutes, and I got the following results:
    12V supply, 109mA flowing, output starts at 50mV and falls slowly, stops at 25mV after 2 minutes. From the datasheet , I should be seeing 10.7V out.
    6V supply, 67mA flowing, output started 100mV and fell slowly to 25mV after about 5 mins.

    Is there no such thing as an easy, working current sensor?? I am at my wits end with these....

    EDIT : The problem mentioned above with the INA139 is simply due to me being a moron. This sensor works fine. Since I have to finish this prototype in 2 weeks, I'm going with the INA139 sensor for now. When I'm done the prototype and get some free time, I'd like to come back to this and figure out just what is wrong. Thanks everyone for the suggestions and I hope to have some more info soon.
     
    Last edited: Apr 20, 2009
  17. Darren Holdstock

    Active Member

    Feb 10, 2009
    262
    11
    Those little current sensors are very handy, not for precision work for sure but they're great for most monitoring activities. I haven't used the INA139, but I did use a bunch of INA195 devices in a datalogger design recently. The latter have a common mode input range that stretches from -16 V to +36 V (with a 12 V supply), which is always useful.

    SK, do post your findings on your original circuit - I'm quite curious as to what was going on.
     
Loading...