LTspice strain gauge simulation not working

Discussion in 'The Projects Forum' started by moorea21, Sep 14, 2010.

  1. moorea21

    Thread Starter Member

    Sep 5, 2010
    30
    0
    Hi,

    First , thanks to gootee for loads of help on the previous post (still ongoing).
    I'm posting this as a new topic as it is kind of a separate issue, and might be of interest to someone else in future, who wouldn't find it hidden in the previous post.

    I've attached 2 LTspice circuits for an amp for a strain gauge. The first one works fine, simulating the strain gauge's output with voltage V3. The second one has a wheatstone bridge with the resistances present in my strain gauge. But it doesn't work.

    I just get flat horizontal lines, indicating that the voltage doesn't change as R12 goes from 1000 to 1002 ohms. I usually do well with googling a solution, but can't find anything that explains this.

    I've attached models for both the IC's in case that's needed, too.

    Can anyone enlighten me? It looks right, so why doesn't it work?

    Richard B
     
  2. moorea21

    Thread Starter Member

    Sep 5, 2010
    30
    0
    I forgot to mention that this circuit is designed to output a logic 1 (5V) signal when the pressure on the sensor reaches a point determined by the value of R9.

    Thanks,

    Rich B
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Perhaps you didn't notice that you have ground on both sides of R14?

    I suggest that instead of running your power/grounds all over the place, use the ground symbol and net labels, like Vcc. Otherwise, it's easy to get confused as to what is what.
     
  4. moorea21

    Thread Starter Member

    Sep 5, 2010
    30
    0
    Thanks Sgt,

    I had noticed, changed it and then posted the wrong circuit...

    The reason I have drawn in loads of earth leads is to represent the wiring as it appears for real. I don't know if it's a valid reason, but I'm thinking that the accuracy with which I define these lines will become important when I start to look more closely at noise. Just a thought.

    I'm guessing you know different!

    The strain gauge circuit on it's own behaves the same way...(attached)

    Is it something I'm doing wrong with LTspice?

    Richard B
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here, try the attached simulation.

    I nudged some things around, and removed the inadvertent ground you had between R13 & R14. I also added a .tran statement, and changed the .STEP statement to actually change the value of R14 from 1000 to 1002 in two steps.

    There are some errors remaining. For example, C5 is causing the output of the instrumentation amplifier to vary Vref.
    You certainly are using low values for resistive dividers. I like to shoot for 0.1mA to 2mA for reference dividers; much lower than that and they are susceptible to noise, higher current simply heats up the resistors.

    It's a good idea to use a small cap to ground to keep the reference voltage relatively quiet. Resistors generate noise, like a garden hose nozzle. Adding a bypass cap to ground is like throwing the garden hose nozzle in a bucket of water.
    [eta]
    Oops, we cross-posted. Try mine anyway.
     
  6. moorea21

    Thread Starter Member

    Sep 5, 2010
    30
    0
    Thanks Sarg,

    Erm, yet again I have to ask something because I can't find it, but how do I get to see values for R12 (the one being varied) against voltage at 'out' and 'LogicOut'? I was hoping to be able to check what the resistance of R12 would be when LogicOut flips from 0 to 5V, with the reference voltage as it is. BTW I changed R2 to 100, rather than {R}. I think assigning the variable to 2 resistors came from me wrongly assigning it to R2 in the first instance.

    Can't find anything that shows how to get Vout against R12; am I asking the impossible? Sorry to have to ask,but this has got me stumped.

    Would you suggest I put a bypass capacitor (2.2nH?) from 'ref ' to gnd rather than the R6/R7/C5 arrangement? As I'm not sure what frequencies I need to attenuate, I can't work it out mathematically,and I think the choice should be one made due to experience rather than my muddy guesswork.

    Anyway, thanks for your guidance, we're getting there!

    Rich
     
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here, give the attached a shot.

    Just plot OUT, REF, and LogicOut.

    I increased the gain of the instrumentation amplifier, by increasing R2 to 1k.

    I also increased a number of other values just to keep the resistors from soaking up all the power in the circuit. Changed the .step parameter, ditched the .tran and went back to .op.
     
  8. moorea21

    Thread Starter Member

    Sep 5, 2010
    30
    0
    Hi Sgt,

    Increasing R2 actually decreases the gain on this chip. I changed the parametric start/stop values to 1000 and 1002, as these are the values that I observed with my strain gauge. Also, the feedback loop across LM339 was making Vout non linear across the range I need to measure, so I removed it.

    Decreasing gain from 495 to 412 by increasing R2 from 100 to 120 ohms causes Vout to have a linear output across my key range of R12 = 1000-1001.6 ohms, corresponding to a +2mV difference in output from the strain gauge's sense outputs.

    I noticed power consumption of R9/R10 decreases (when LogicOut =5V) if their values increase. Is this what you meant by increasing most R's by x10?
    Current file attached, although it may tell you it can't find some symbols...

    Thanks,

    Richard B
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I see. I just wanted to get SOMETHING working, though.
    Yes, I noticed that - but if you want to avoid the comparator switching back and fourth rapidly (oscillating) at the threshold, you will need to add some hysteresis.

    I guess it would've helped if I'd read the datasheet for the amp, eh? :rolleyes:

    Yes; just getting their current within the range of 0.1mA to 2mA. As I mentioned before, caps to ground at those junctions will help a great deal to keep the reference levels stable. 10nF to 100nF would be good.

    It seemed to work fine; I'd already downloaded the models and symbols.

    Be aware though; you will likely have problems if you don't provide hysteresis feedback from LogicOut.
     
  10. moorea21

    Thread Starter Member

    Sep 5, 2010
    30
    0
    Hi Sarg,

    Think I'm fussing too much about linearity: it's bound to increase the rate of change of voltage at whatever the reference voltage is; it was just such a pretty curve!

    I looked up how to calculate hysteresis values for comparators, and didn't really get it. What might help is if you could walk through the process you went through to arrive at the value of 220K, if you don't mind taking the time.

    I think I may have a functional circuit at this point; probably won't win any awards, but may get the job done...

    Thanks again for the help, maybe one day I can return the favour,

    Rich B
     
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    When the output oscillates [eta - with the real parts], you'll be pulling your hair out.

    Read through this:
    http://www.maxim-ic.com/app-notes/index.mvp/id/3616

    Sorry, but I simply have no time to do that now.

    Glad something's working at least.

    Experiment with various values for feedback resistors.
     
    Last edited: Sep 15, 2010
  12. moorea21

    Thread Starter Member

    Sep 5, 2010
    30
    0
    Would it be possible to add a low pass filter after LogicOut, to remove the effects of the comparator oscillations?

    Rich B
     
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    If you wanted to make a potentially bad situation even worse, I suppose you could - but why would you want to?

    Adding a bit of hysteresis will remove ambiguity.
     
Loading...