Shop OBEX P1 Docs P2 Docs Learn Events
Non-Linear amplifying of a LM358 — Parallax Forums

Non-Linear amplifying of a LM358

StefanL38StefanL38 Posts: 2,292
edited 2010-09-19 18:37 in General Discussion
Hello,

I would like to amplify a voltage 0-35 mV with a factor of 100.

For a first test I took a LM358 because I had no other OpAmps handy.

I'm using the standard non-inverting amplifyer-circuit
like shown f.e. here

NonInvert.gif

Then I adjusted the feedback-resistance (around 1 MOhm, R1 10kOhm) that an inputvoltage of 35mV resulted in an outputvoltage of 3.5V.
So that the amplifying-factor is 100

Even if I supplied the LM358 with +-6V the amplifying factor goes down from 100 to 70 for lower voltages.

Remark through supplying the OpAmp LM358 symmetrical with -6V at PIN4
and +6V at PIN 8 the voltage on the input is way of the lower rail.

Still the amplifying-factor is not constant.

Is this common for the OpAmp LM358?
If yes which OpAmp would you recommend for this use?

Would a rail-to-rail-OpAmp like the OPA 347 deliver better results?

Any help to get this thing linear is greatly appreciated

Thanks in advance

Stefan

Comments

  • tdlivingstdlivings Posts: 437
    edited 2010-09-18 15:01
    First thing that stood out to me is the size of the feedback resistor.
    A one Meg could produce an offset as big as your signal. The bias current is 100na max.
    Are you inputing 35mv dc or a peak to peak 35mv. These amps do not get closer than 2 to 3 volts of the supply rail. 35mv x 100 is 3.5 volts and you would be getting close with a 6 volt rail.
    If you are saying you see gain error when you input a dc signal between 0 and 35mv then I would say it is the op offset voltage and offset produced by the bias current flowing thru the resistors adding and subtracting from you signal.
    Try a gain of 10 with 9k to 1k and then you make two the part is a dual and get a gain of 100 (10x10)

    Tom
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-09-19 00:39
    Hello Tom,

    thank you very much for your help.
    So the example-circuits from the datasheet are to use with care
    and have to be tested by me again if they are working good or not.

    OK with a gain-factor of 10 the result is better and I understand the
    offset-voltage problem. Still through the offsetvoltage of 2mV the
    amplifying is not linear yet. I remember dark that some OpAmps have a
    offsetvoltage-compensation. Which type of OpAmp would you recommend
    if I want to have an adjustable offsetvoltage-compensation.

    I know 2mV is already very low. And if I have adjusted my circuit at 20°C
    to offsetvoltage 0,0mV. At 32°C it will have some offset-voltage again
    but that's ok for me.

    best regards

    Stefan
  • tdlivingstdlivings Posts: 437
    edited 2010-09-19 09:54
    What do you mean by not linear yet.

    Are you inputing dc values and measuring the output with a voltmeter?
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-09-19 10:35
    Hi Tom,

    with a gain of 10 the linearity is better but because of the offsetvoltage
    there is still an error.

    Examples:
    3mV results in 20 mV (instead of 30 mV)

    40 mV results in 390 (instead of 400 mV) etc.

    As far as I understand OpAmps know this is because of the offsetvoltage.
    I found explanations and a circuit how to compensate the offsetvoltage
    which requires a dualsupply or a "virtual ground"
    (through a "supplyvoltage-halfing-circuit")

    The whole thing is for measuring current and voltage of a LiPo-accu-charger

    I want to measure the current at the output of the LiPo-charger
    as this charger has also to measure the accu-voltage the error through the voltagedrop across the current-sensing-resistor has to be really small.
    So I'm using 0,1 Ohm.

    The accu-voltage (up to 4.2V and the current-voltage is feeded into a
    MCP3208 ADC which is connected to the propeller-chip for storing current
    and voltage-values over time.

    So it is not a DMM that is measuring the voltages.

    best regards

    Stefan
  • LeonLeon Posts: 7,620
    edited 2010-09-19 10:53
    Have you checked that the ADC is working properly?
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-09-19 11:00
    Hi Leon,

    the ADC is working properly. I checked this with two different DMMs.

    Sorry for not saying that before. I'm still in the stage of testing the amplifyer. As a single component.

    So I have a adjustable voltage-divider connected to a voltage-follower
    to create the 0-35mV. And I'm measuring the voltages with two different DMMs. With the same results. From that I'm pretty sure that the measuring itself is correct.

    best regards

    Stefan
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-19 11:22
    You could try calibrating out the offset voltage by using a MOSFET to short the sense resistor and taking a reading. That will give you a value for the offset voltage, which you can use to correct subsequent current readings.

    -Phil
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-09-19 11:29
    Hi Phil,

    thanks for your idea. If it takes not too much effort for you.

    Can you provide a circuit (even hand-drawn would be enough) and some more explanation how this works?

    best regards

    Stefan
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-19 11:56
    Something like this will give you one calibration point for zero current (i.e. the Y-intercept of the V/I curve):

    attachment.php?attachmentid=73322&stc=1&d=1284921973

    The output voltage may be negative w.r.t. ground, depending on the direction of the offset, so you will have to deal with that. Also, you may still need to calibrate for gain (i.e. the slope of the V/I curve).

    One advantage to using a micro in a device like this is that each unit could be calibrated post-manufacture, with the calibration data stored in flash or EEPROM.

    -Phil
    500 x 220 - 2K
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-09-19 12:11
    Thank you very much for the circuit Phil.

    I thought I'm quite good in understanding electronic circuits but here I'm not sure.

    Read zero is connected to an IO-pin of the MCU?

    Through shortening the sense-resistor the voltage at +Input is zero.
    And then I can measure VOut as the Y-interception of the I-V-line?

    Is this right?

    As R-sense is only 0,1 Ohm. Does the MOS-Fet have a much smaller resistance than 0,1 Ohm that he is able to "shorten" the sense-resistor?

    best regards

    Stefan
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-19 12:31
    Yes to all your questions.

    -Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-19 12:41
    Now that you bring up the MOSFET RDSon figure (which can be in the milliohm region, but still significant compared to the 0.1R sense resistor), I'm thinking this circuit might be better:

    attachment.php?attachmentid=73323&stc=1&d=1284925201

    The micro will have to raise the gate pin high to enable the charger and take a current reading; lower it to read the zero level.

    -Phil
    440 x 294 - 2K
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2010-09-19 17:21
    One trouble is that the offset voltage might be negative, and your MCP3208 ADC will not be able to measure a negative voltage. The low end of the range will be lost. A negative offset is implied by your results,
    3mV results in 20 mV (instead of 30 mV)
    Solve for Vos:
       3mV + Vos * 10 = 20mV     .....     amplifier gain is x10
      ==> Vos = -1mV
    
    You can do the math in software to solve back from the ADC reading to the true input voltage, once you know the offset.

    Nevertheless...

    It is really a good idea to look for a better op-amp. These days, 2mV is not considered "precision" and what you are looking for is just that. You mentioned the OPA347 for its rail to rail i/o, but that is not a good choice, because it is an FET input device with even worse offset, +/- 6mV. A bipolar op-amp will be better. How about the OPA277 with 20 microVolts of Vos? There are others. You do have to pay for the precision. Another solution, if you have a box full of LM358s, is to go through the box until you find one that happens to have zero or a very small positive offset, and use that particular one.

    I would use 10kΩ/100Ω to achieve the x100 ratio, not 1M/10k. There are also bias currents and bias current offsets to consider.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2010-09-19 18:37
    Creating a virtual earth with a voltage divider (and voltage follower) is one solution but since you already have a split supply it would be better to use the split supply.

    I am wondering if earth isn't really earth. At 2mV you don't need much current in a ground wire to produce that sort of voltage drop - thin wires/thin PCB traces and the current drain of an op amp or a few chips could produce that sort of drop.

    So layout becomes important, eg where does earth return current flow from each device.

    A photo of your setup might be helpful.

    One trick I've found when measuring these sorts of voltages is to have the device you are measuring (eg an ADC) and to treat its local ground and signal as a differential voltage. Run both into a differential op amp circuit with some gain http://www.electronics-tutorials.ws/opamp/opamp_5.html In your case you could start with R1 and R3 1k, and R2 and R4 10k and then if it works try increasing the gain to 100.

    Then you don't have to worry so much about whether ground really is ground.

    Addit: 0.1uF bypass caps on every chip will be important too with these sorts of voltages.
Sign In or Register to comment.