Amplifying a mV signal

Discussion in 'General Electronics Chat' started by strantor, Oct 16, 2011.

  1. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    I want to take a 0-500mV signal and turn it into a 0-5V signal. I tried using an opamp with resistor ratio for 100 gain but I just get a constant 2.3V output from the opamp. what am I doing wrong?


    I just picked the opamp in LTspice at random, maybe it's not the right one?


    [​IMG]
     
  2. #12

    Expert

    Nov 30, 2010
    16,252
    6,751
    First, the factor from 500 mv to 5V is 10, not 100 as you said.
    Second, the circuit shows a gain of 1000.
    Have you been up all night?
    You're slipping digits.
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    For one thing, the LT1007 is not a rail-to-rail I/O opamp - even if it were, most opamps tend to be somewhat non-linear near their rails, particularly if the load is heavy (like that 1.2 Ohm R1 & 1.2K R2 - what possessed you to use resistors that low in value?)

    Just grabbing random opamps and stuffing them into a circuit really isn't a good way to select one. The LT1007 is a pretty nice opamp, fast & low noise, but it won't go near the rails.

    I don't see the rest of your schematic. You really ought to attach the .asc file along with the .png image, as a number of us have LTSpice and can give you a hand with your simulations.
     
  4. Adjuster

    Well-Known Member

    Dec 26, 2010
    2,147
    300
    Take another look at the network to the inverting input. The gain may be very much less than I think you imagine it to be, even with a "single supply" amplifier that has common-mode input range extending to the neg rail.
     
    Last edited: Oct 16, 2011
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    One problem that you'll run into is that your sense resistor will only report the current flowing through the load while the MOSFET is turned on, as you're using the MOSFET as a low-side switch. While this doesn't sound like much of a problem at first, unless you use a peak detector on the output from the sense resistor, you won't know what the actual current flow is; the recirculated current through your freewheel diode(s) isn't monitored.

    One way to get around that is to use the MOSFET as a high side switch. Then you can include the sense resistor in the "loop" with the freewheeling diode(s).

    Of course, then you will need to use a high-side driver, or you won't be able to turn on your MOSFET completely.
     
  6. Pencil

    Active Member

    Dec 8, 2009
    271
    38
    Maybe this link will help Importing models into LTspice.

    Look at both pages, good information for using models.

    Hope this is helpful.
     
    strantor likes this.
  7. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    double DOH!


    I didn't know the value of the resistors was important, just the ratio. I just made up values.

    I've never used an opamp before the other day. Had no idea there was such a selection or the differences between them. I picked the LT1007 because LTSpice said it was a "low noise, high speed, precision opamp" which sounded good to me.

    done, attached

    You're probably right; I have no idea, other than what I read here (non-inverting amplifier circuit). I thought the gain was purely a function of the ratio of the 2 resistor.
    good point. I wasn't really considering the current through diode, which I suppose I should as a precaution, but the purpose of the output of the amplifiers is to be feedback to my control circuit. My PWM duty cycle will be determined by current feedback.
    Ok, I am not sure what you guys were talking about performance "next to the rails" - I tried putting 1.2KΩ between V+ and opamp, and between opamp and GND. I changed the values of the resistors to 10K and 100K. I was not able to see the circuit run because of this:
    [​IMG]
    I have been running into this more and more as I use LTSpice. My circuit will simulate just fine, then I go and change something as simple as 1 resistor value and it goes into this never ending "transient analysis" or "N-R iterations" deal and won't simulate. I can usually get it to simulate by changing the run time. for example if it's ".tran .001" I can change it to ".tran .0011" or ".tran .0009" and it will work. now since I made those changes, nothing will let me run the simulation.

    maybe you will have better luck with it.

    Ok, so what I am uploading is the circuit you say in my screenshot, plus the changes I mentioned. it won't simulate on my computer. the circuit is incomplete. once I get the 0-5V output I will be expanding the circuit by comparing the 0-5V output to another 0-5V output. M1 NMOS is what I plan to use (in conjunction with a latch) to break the PWM signal when current limit is reached; right now it is just tied to +12V.
     
    Last edited: Oct 16, 2011
  8. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    You are attenuating the signal not amplifying. The feedback resistor R1 has to be bigger than R2 for amplification.

    What's R3 and R4 for?

    Your signals input reference shouldn't be the opamp's power supply zero. As pointed out the LT1007 is not rail to rail and even if it was, I'm not sure if it wouldn't have non-linear behaviour near zero. If you use a dual supply this will be working.

    Adapt your shunt resistor value to the maximum peak current you expect, this way you can work with bigger signals and may experience less problems with noise later on.
     
  9. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    DOH!
    That was my attempt to "get the the opamp off the rails" - a term I obviously still don't understand

    ok, "not a rail to rail" - what does that mean? What should my second supply voltage be? Or is there a better OPAMP I can use in LTSpice? (maybe one that is "rail to rail", whatever that means)

    Thanks
     
  10. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    with "rail" the supply voltage is meant. open the datasheet of any opamp and you will find a parameter that says "maximum output voltage swing" or something similar. It will tell you how near the output voltage signal can come to the supply voltage rails. For the LT1007 it gives you +-12.5V at RL > 2k at +-15V power supply voltage. That means the lowest voltage at the output is 2.5V above the negative power supply rail at the specified load resistor value.

    For a rail-to-rail it will be in the mV to hundreds of mV range...

    I don't work so much with Spice, so you may be faster finding the apropriate OPAMP.
    For testing purposes take the LT1677, it should work but will still give you an error near zero, the way the circuit is made.

    A negative power supply would only have to be so much negative to overcome that difference the opamp cannot get near the rail voltage.
     
    Last edited: Oct 16, 2011
    strantor likes this.
  11. Pencil

    Active Member

    Dec 8, 2009
    271
    38
    I can't help much but, I cleaned it up
    a bit and did get it to run. Maybe play
    with this until some one else comes along.

    If not helpful, just ignore.

    Check it over carefully.

    EDIT: Changed schematic (added 2 ground symbols).
     
    Last edited: Oct 16, 2011
  12. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    Strantor, is this going to be a project you are going to build? Maybe it would be better to know what controller you are going to use, what voltages are already available in your system etc...
     
  13. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    Ok I added a -3V at the (-) of the opamp and I'm getting a mV signal out now, but it doesn't have the gain I was expecting.

    Holy net label, Pencil!
    That looks much better, thank you!

    Yes I'm building it from the ground up so I'm not really restricted to "what's already available" but it would be nice & simple to have as few different voltages as possible. right now the only controller I know how to use, and what I already have, is Arduino. it has 5V 40ma outputs.
     
  14. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    Ok, so I changed the negative supply to -6V, changed the resistor ratio, and changed the freewheeling diode and now it seems to working almost perfectly. I don't get an exact 1:10 ratio from in to out of the opamp; I get 4.87V out for 442.8V in. What's odd is that the difference (4.428V) does add up to a 1:10 ratio. wierd!
    EDIT: got the difference worked out by changing 1K to 1.1K

    BTW, why was my circuit not simulating before? Pencil, was it because my schematic was so hideous?
     
    Last edited: Oct 16, 2011
  15. Pencil

    Active Member

    Dec 8, 2009
    271
    38
    Actually, I did not change any connections. I changed the
    "simulation parameters". As I am not really one to be teaching
    LTspice (I guess at too many parameters) I won't elaborate, but
    "skipping the initial operating point solution" helps to speed
    things up when it gets complicated. Also very small "Stop time"
    lets you see a trend as to why a longer time takes too long
    to simulate, you may not see what you want, but at least
    you can see something.

    Also, you need to select an Opamp that is suitable for your application.
    Do not take my selection as anything more than a placeholder for
    the simulation. See my other post in this thread about how to
    add the model of your choosing.
     
    Last edited: Oct 17, 2011
  16. colinb

    Active Member

    Jun 15, 2011
    351
    35
    Your problem is you have the amplifier gain equation wrong. It is Av = 1 + (Rf/Rin). This means Av = 1 + (10 000 ohm)/(1000 ohm) = 11, and 442.8 mV * 11 = 4.8708 V. So the circuit is behaving as expected.
     
    strantor likes this.
  17. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    The 1.2k resistance you added between the opamp supply pins and the power rails was not good. That's why it was taking your simulation so long to run.

    I added a -5v supply to the opamp, fixed the feedback using 3k and 27k to get a gain of 10, i decreased the PWM from 99% to 96% because the higher % was just not showing up.

    I just kind of fixed it up so it'll run for you.
     
    strantor likes this.
  18. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    Ok SGT, I took some of your changes and some of Pencil's changes and I added my convaluted current limiting scheme. What I did seems(?) to be doing what it is supposed to. What it is supposed to do, is look at an analog voltage (0-5V) coming from my microcontroller and limit the current based on that. 1V corresponds to 100A, and so on. I have set it to .5V for a 50A limit. As the current climbs and reaches it's limit (50A) in the 99% duty cycle, the MOSFET is shut off for the remainer of the period. At the beginning of the next period, the latch is reset (by the inverse of the 99% duty cycle, a "one-shot" so to speak) and if the current is <50A, the MOSFET is allowed to turn on, unit 50A is reached, at which time the MOSFET is shut off for the remainder of the period, and so on. So, from the simulation I can see that once 50A is reached, something happens, but not what I expected to happen. After the MOSFET turns on the current continues to climb but there are brief moments where it drops down to 50A. I think what is happening is that the MOSFET is too slow to turn off, allowing current to still pass. Do you know of a clever way to make this work?
    RED = gate drive voltage
    GREEN = current through Sense resistor
    BLUE = mV output of sense resistor

    [​IMG]

    As always, thanks for all the great help. I really appreciate it!
     
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Remember what I was saying about not monitoring the current during the time the MOSFET is turned off? The current getting recycled through the diode isn't being measured? (see reply #5).

    Well, that's what you are running into.

    Have a look at the attached. I yanked out the discrete PNP/NPN gate driver and threw in an LTC4440 high-side driver. It's not the solution for you, because the '4440 has an 80v limit - but it's good just to show you how one could do this (implement a high-side driver so that all of the current through the load is measured, whether sourced from the MOSFET or recycled via the diode).

    I removed most of the port type flags for power rails, as they drew attention away from the important I/O signals. I left the +96 port type, because it's HV (even though I lowered it to 75v for the demo).

    Even though this configuration works to limit the current, I'm still not terribly fond of it. The MOSFET array keeps getting turned on for short "blips" when the PWM signal goes high; that will result in power dissipation in the module.

    The diode you chose is woefully inadequate for the simulation - I left it as it is, but you should change it to an MBRB2545CT. That one isn't rated for the voltage either (~75 volts present at times) or current, but at least it'll have much less of a voltage drop across it (the excessive voltage drop during current limiting results in the boost cap being charged to ~20v).
     
    Last edited: Oct 17, 2011
  20. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Oops, I left R1 set to 297k. Change it back to 27k. I had it set to 297k so that it would not take so long to run.
     
Loading...