Connect with us

LM358 problem

Discussion in 'General Electronics Discussion' started by spencer2004, Dec 9, 2013.

  1. spencer2004

    spencer2004

    17
    0
    May 1, 2013
    Hi, first of all I'd like to say that I am pretty new to electronics and as I have learned everything I know from the internet there are massive gaps in my knowledge so forgive me for using the incorrect terminology, etc.

    I am building an LED tester which logs the current draw of an LED across a pre-set voltage range, to measure the current draw I am measuring the voltage drop across a 0.1 ohm shunt resistor, the voltage drop is amplified by a LM358 op amp with a gain of 30 then read by an Arduino. The problem I have is the op amp does not work correctly for voltage drops below 0.03v which means that I can't measure current draws below 300mA. I measured the output of the op amp with different voltage differences in 0.01v steps and from a voltage difference of 0.03v onwards it works as it should.

    I have checked that I have built the amplifying circuit properly about 10 times, and I have made sure that the LM358 is not defective. The LM358 is powered by a 12V rail.

    I have Googled this a bit and I'm not sure if there is a way to modify the circuit to allow smaller currents to be measured without increasing the resistance of the shunt resistor.

    If someone could give me some guidance on the matter I would be very grateful.
     
  2. OLIVE2222

    OLIVE2222

    690
    25
    Oct 2, 2011
    Hi Spencer and welcome to this forum !

    Look at the LM358 input offest, you will find a 2mV figure to be multiplied by your 30X gain.
    Even with the input grounded you can have 60mV at the output! Low shunt value are often used when significant currents are present to avoid losses. Here you want losses in the led limitation resistances to avoid to burn it! So better to measure the led current at this (precision) limitation resistance. depending on the setup it may even happen that you don't need the LM358 at all.

    Olivier
     
  3. spencer2004

    spencer2004

    17
    0
    May 1, 2013
    Thanks for the quick reply. I did read in to the offset thing but I'm a bit confused as I get around 0.8v on the output when the 2 input voltages are the same or within 0.03V of each other instead of the 0.06V that I should be getting, is this supposed to happen?

    I guess a 1 ohm shunt would be more suited for testing LEDs, plus as you said I won't even need an op amp.
     
  4. OLIVE2222

    OLIVE2222

    690
    25
    Oct 2, 2011
    You don't need a dedicated shunt resistor! You can use the led current limitation resistor as a shunt. If the measured voltage is to high just split the limitation resistor in 2. for example with a bottom resistance of 100 ohms you will have 1,5 volts for 15mA led current, a pretty good value for the Arduino ADC!

    Olivier
     
  5. spencer2004

    spencer2004

    17
    0
    May 1, 2013
    The reason I want to use a small value shunt resistor is because I want to be able to test the current draw high power LEDs at various voltages without any type of current limiting.

    I still don't fully understand why my op amp wont correctly compare and amplify small voltage differences, could someone please explain to me if there is any way around this? Do I need to have a negative voltage rail or something? Is it because the LM358 is cheap and isn't designed for this?
     
  6. OLIVE2222

    OLIVE2222

    690
    25
    Oct 2, 2011
    The op amp is working correctly but the measured value and the offset error become not distinguishable. If you use an higher resistance you still have the offset error but the result is workable 60mV(worstcase) on few volts (and you can cancel the offset in the firmware). They are better op amp at the job, lower offset type, chopper amplifiers, instrument amplifier or dedicated ic for current measurement. You can maybe also have a multiple range design.
    posting your schematic and your min/max current needs can help to narrow down the replies.

    Olivier
     
  7. spencer2004

    spencer2004

    17
    0
    May 1, 2013
    So you're saying that it's better to have higher resistance values for the gain set resistors?

    Here's what I was origionally going for:

    [​IMG]

    The variable voltage source is a LM317 controlled by a filtered PWM signal. I want to be able to measure up to the maximum current output of the LM317 (1.5A) so I chose a gain of 30 which leaves a little room for overhead.
     
  8. spencer2004

    spencer2004

    17
    0
    May 1, 2013
    Ah now I am getting somewhere, I exchanged the gain set resistors for much higher values (6.8K and 220K) and now it is working fine; when the inputs are the same I get about 135mV on the output which divided by the new gain of 32 works out to an input offset of about 4mV which is slightly out of spec but prehaps I need to experement a bit more. It now also outputs as expected with input voltage differences as low as 10mV.

    Thanks for your help Olivier!!
     
  9. OLIVE2222

    OLIVE2222

    690
    25
    Oct 2, 2011
    Nice that is working now! Despite I am not talking about the gain resistor you find out yourself that you need something in the K range for the difference amplifier . To build this difference amplifier you need VERY precise resistor or, again, you will have offset problem. By the way what is the 1.5 Amp led you are using ?

    Olivier
     
  10. spencer2004

    spencer2004

    17
    0
    May 1, 2013
    I don't have a 1.5A LED, I want to use this circuit to test 1W and 3W leds at ranges that exceed their specifications (i.e. exceeding the maximum current draw) to find out how long they can last running beyond the advertised safe limits and how far they can go beyond them. Also I'd like to see how the current draw related to voltage.

    I know that it would be a lot easier to just do this with an LM317 on a breadboard and a multimeter but I wanted to do something involving opamps, current measuring and a microcontroller controled LM317 as I have not done this before.
     
  11. OLIVE2222

    OLIVE2222

    690
    25
    Oct 2, 2011
    Ok I have the full picture now!

    You will learn a lot with your setup, a good hardware/firmware mix.
    Few decades ago my first led learning was done thanks to a radio shack "led value bag" and few led burning on a 9V battery :D
     
  12. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    Do you need the LED's cathode to be connected to 0V?

    If not, you would be better to put the shunt resistor between the cathode and 0V and measure the voltage across it directly.

    That differential amplifier has another source of error in addition to the op-amp's input offset voltage, nicely explained by Olivier: errors due to mismatch in the resistors. These cause errors in gain, and common-mode rejection, meaning that the LED's forward voltage will have an effect on the op-amp's output voltage, even with the same voltage drop across the shunt resistor.

    The way I would do this measurement would be to put the shunt resistor between the cathode and 0V, and feed the shunt resistor voltage through a current-limiting resistor into the ADC input. Also, add a protection diode from the ADC input pin to VCC, or a voltage slightly lower than VCC or the ADC's VREF, so that the input pin protection circuits in the micro will not be stressed if the shunt voltage goes too high.

    The shunt resistor would be chosen to give a voltage drop equal to the ADC's VREF at the maximum current you want to test at. If you want good current measurement accuracy over a wide range of test currents, you could use switchable current shunts, but remember that any resistance in the switch adds to the shunt resistance, unless you use four-terminal resistors.

    Alternatively you can use a switchable-gain amplifier between the shunt and the micro, but you should use a much better op-amp than the LM358. I've used and recommend the Texas Instruments TLE2022 which is a drop-in replacement, but as Olivier mentioned, there are op-amps available with much lower input offset voltages, including "chopper-stabilised" op-amps which are slower than standard op-amps but still fine for your application.
     
  13. mursal

    mursal

    75
    0
    Dec 13, 2013
    Thanks guys, very interesting stuff ....................
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-