Simulation not matching reality!

Discussion in 'Electronics Resources' started by bytraper, Apr 26, 2013.

  1. bytraper

    Thread Starter Active Member

    Sep 28, 2010
    126
    4
    I've built a circuit to visually measure load draw from a resistor using a LM3914, but its not quite functioning how I expected it to. I'm not exactly sure what it going wrong and would appreciate any help I could get!

    This is the circuit for measuring voltage from the shunt resistor.
    [​IMG]

    It works by taking the voltage from the resistor and amplifying it. The op-amp is actually a TS921IN not a lm358 (rail to rail) because I have a spare one in another part of the circuit.

    Anyway, In the simulation, it goes smoothly from 1A@0.142v to 35A@3.42v in a nice linear fashion, but in reality on the breadboard it climbs from 0.142v to about 0.600v and as you apply more load it drops to 0.530v and stays there, so it begins to climb normally and then drops and stays dropped at 0.530v!, if you back the load off, it climbs back up to 0.600 and goes down nice and smoothly!

    What am I doing wrong ?
     
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Well first of all simulators are never good for fine tuning a circuit. In the real world there are way to many unknown factors. Like resistors are never exact. Second your circuit is kind of over engineered. You current sense resistor is referenced to ground. So you do not need differential stage. For low currents I think it may be an input offset problem. For the higher current. Check the opamp input voltage range for your supply voltage. Your circuit was also very messy drawn. It is better to use many GND symbols to avoid crossing lines. I have tried to clean up your circuit some.
    But do not worry about that. We all have to learn ;)
     
    Last edited: Apr 26, 2013
  3. bytraper

    Thread Starter Active Member

    Sep 28, 2010
    126
    4
    Thanks! Sometimes I'm thinking so much about the problem, that I draw it with too much haste!
     
  4. Brownout

    Well-Known Member

    Jan 10, 2012
    2,375
    998
    Something is wrong with the circuit you built. Either your current source is doing something weird or there is something going on with your supply voltege (assuming you constructed your circuit correctly) I would repeat the experiment and measure all parmeters, current, voltage across the sense resistor, rail voltage, etc. My guess is you're gonna find one of these parameters out of spec, or else you'll find an error in your circuit constructions.
     
  5. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    I forgot also to say that many opamp models in Spice. Are not optimal. They are kind of OK regarding frequency response. But outside that scope. They are often very idealistic, and far from real.
     
  6. tindel

    Active Member

    Sep 16, 2012
    568
    193
    I agree that any model is only as good as you make them. When you get a opamp spice model from a manufacture, it often has the correct poles and zeros, output and input impedances, power supply currents, and input protections - and that will get a close approximation of the op-amp in the linear mode and non-linear mode. It won't be perfect though. And if you use the part for a specialized purpose - it may or may not simulate the part accurately.

    In this case, your model should simulate the circuit pretty well since you're using it in a linear region. I too would suspect that there is a miswire or something in your test circuit. I'd double check everything. There may be some intricacies between the TS921IN and LM358 that you're not considering too. I didn't look up the datasheets, but it would be worth a look if you still have the problem after double checking the circuit.

    Using the simplified circuit that t06afre supplied may eliminate confusion when breadboarding your circuit.

    Finally, my experience that single rail op-amps work 'funny' when using a single rail and not using a rail splitter for a reference voltage. Food for thought.
     
  7. tindel

    Active Member

    Sep 16, 2012
    568
    193
    Also, your input voltage will be 52.5mV at max load, and less with lower currents. That is very close to ground - the amplifier may not be able to amplify voltages that close to it's supply rail forcing the amplifier to go non-linear in that range.
     
  8. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    Many op amps will oscillate if you do not use a power supply decoupling capacitor. Oscillation can cause very strange behavior. You can't see oscillation without an oscilloscope.
    Add a 0.1uF (100nF) ceramic capacitor from pin 8 to pin 4 (vcc to GND), as close to the IC as possible, with short leads.

    You should actually make a habit of doing this on every IC, analog and digital, in any circuit you build.
     
Loading...