Measuring +20V - 0 -20V with LM358 dual op amp.

Discussion in 'Analog & Mixed-Signal Design' started by Peterperkins, Nov 5, 2018.

  1. Peterperkins

    Thread Starter New Member

    Nov 5, 2018
    10
    0
    I've knocked up the attached LM358 dual op amp schematic to measure a variable +20 - 0V input and a 0V to -20V input with common (0V)

    The opamp is supposed to scale the signal to a 0-+2.5V range output and in the case of the negative input invert the output to give a positive output.
    It's all powered by a single stable 5v supply.

    The problem i have is that when the positive input is fed with a steady battery 7.2v input voltage the output from the opamp has a regular ripple as shown in the attached scope pic? It's throwing off an adc connected to the opamp output measuring the voltage.

    Is the basic design flawed? Any other ideas to measure (+20V to 0) and (0 to -20V) with an opamp to scale both the outputs to +0-2.5V for my adc?
    The circuit simulates correctly in proteus with the opamp outputs changing in response to input voltage changes.

    Grateful for any feedback. Thanks
     
  2. Bordodynov

    Well-Known Member

    May 20, 2015
    1,911
    578
    See
    2018-11-05_14-50-03.png
     
  3. danadak

    Well-Known Member

    Mar 10, 2018
    1,736
    354
    Cannot read the time base on scope capture, what is the freq ?

    Keep in mind this part will not CM to either rail, input or output.

    Input is Vsupply - 2V, in your case 0 - 3V, output depends on load.
    So you should compute for your conditions to make sure you are
    always in CM range. The min value in is 0 V.


    Regards, Dana.
     
  4. Peterperkins

    Thread Starter New Member

    Nov 5, 2018
    10
    0
    Vertical 500mv per division, so ripple is nearly 500mv...
    Horizontal 10us per division..
     
  5. dendad

    Well-Known Member

    Feb 20, 2016
    2,027
    522
    Do you have any power supply bypassing?
     
  6. Peterperkins

    Thread Starter New Member

    Nov 5, 2018
    10
    0
    Sorry what do you mean?
     
  7. Peterperkins

    Thread Starter New Member

    Nov 5, 2018
    10
    0
    I have a +2.5v fixed ref available on the board..
     
  8. Peterperkins

    Thread Starter New Member

    Nov 5, 2018
    10
    0
    Bordodynov thanks for the diagram. The + side simulates correctly but the - side does not simulate correctly in proteus.
     
  9. dendad

    Well-Known Member

    Feb 20, 2016
    2,027
    522
    Adding capacitors across the power supply pins, close to the device, in this case, the LM358 between pins 5 and 8.
    I use at least a 100nF ceramic and a 10uF tantalum cap. The first thing you need to do in your circuit design is to have good quality power. That is the foundation to build on. Noisy poor power can cause all sorts of problems.
    If the power supply is high impedance, the voltage will change as the current drawn changes. Have a "Google" about power supply bypassing.
     
  10. Peterperkins

    Thread Starter New Member

    Nov 5, 2018
    10
    0
    Thanks I have 100nf caps on the pins, standard practise.. The power supply is not high impedance.. We also have 10uf and 4.7uf on the supply output. It's only powering a pic and this op amp.
     
  11. absf

    Senior Member

    Dec 29, 2010
    1,853
    505
    My proteus has 3 models for LM358. Try using LM358N ( Library = OPAMP) for simulation.
     
  12. absf

    Senior Member

    Dec 29, 2010
    1,853
    505
    See proteus sim

    lm358 v1.PNG
     
  13. Peterperkins

    Thread Starter New Member

    Nov 5, 2018
    10
    0
    Thanks for that but i don't understand why my sim doesn't work...
    I'm trying to use two halves of the dual LM358N the + works but not the negative..
    Any settings in proteus?
    I could not find the symbol you are using for the voltage sources?
    OpAmp Simulation 051118.jpg
     
  14. absf

    Senior Member

    Dec 29, 2010
    1,853
    505
    I am using older version of proteus.
    Did you try with other similar opamps like LM324?

    lm358 v2.PNG
    Voltage source is in the "Simulator Promitives" Library as VSOURCE.
     
  15. Peterperkins

    Thread Starter New Member

    Nov 5, 2018
    10
    0
    Thanks for the ideas but still no luck.

    I have breadboarded the various above circuits with an LM358N.

    The positive side works as expected, but the negative does not and there is a very strange square wave appearing on the negative side.

    Ringing? There is no response to any negative voltage changes..

    Further ideas and design suggestions gratefully received.
     
  16. danadak

    Well-Known Member

    Mar 10, 2018
    1,736
    354
    ADIsimpe -

    upload_2018-11-8_8-51-11.png


    Regards, Dana.
     
    absf likes this.
  17. ebeowulf17

    Well-Known Member

    Aug 12, 2014
    2,448
    440
    Have you tried more than one chip, or just the one? If just one, could you swap which amp is used for negative and positive? I'm just trying to rule out the possibility of a bad op amp channel.
     
    absf likes this.
  18. Peterperkins

    Thread Starter New Member

    Nov 5, 2018
    10
    0
    Thanks for these ideas making some progress now.

    I would like to add some low pass filtering of the highly noisy voltages being measured so they don't upset the opamps.

    I also want to increase the impedance on the shared ground so the noise doesn't come into the ground side of the circuit. .

    Hope that makes sense.. ideas?
     
  19. danadak

    Well-Known Member

    Mar 10, 2018
    1,736
    354
    Not sure what you mean by this ? Normally one thinks of building as low a Z path
    to ground as possible when bypassing and routing current back to source.

    Regards, Dana.
     
  20. ebeowulf17

    Well-Known Member

    Aug 12, 2014
    2,448
    440
    Are you still having the same problem as before, or did you get the negative side working? If it's working now, what fixed it for you? If not, we should probably get to the bottom of that before worrying about filtering.

    That said, a low pass filter should be an easy enough addition. As for adding impedance to the ground, I'm with Dana. I can't imagine that will be helpful. If shared ground connections are causing any sort of interference, it's probably because the ground has too much impedance, not the other way around.

    If it has low enough impedance, it's just always 0V. Current flows through it, but it flows so freely that any voltage change is so small it can be ignored. However, if you increase impedance, that same current flow results in more voltage fluctuation.
     
Loading...