Op-Amp Sensor Conditioning

I’ve been working on a project involving reading a set of resistive flex sensors using the built-in ADC channels of an AVR microcontroller. The flex sensors are just 2-terminal variable resistors, so I initially just hooked up a fixed resistor in series, then used the resulting voltage divider as the input for the ADC. This is working fine, but due to the nature of the divider, the inputs are limited to a given range, and even having optimized it for the most range, I still only get a range of 140 on the ADC, out of a possible 1024. So, I’ve been looking into sensor conditioning, and am trying to figure out how to go about that. The simplest option I’ve found is to use a single-active Wheatstone Bridge fed into an op-amp. My understanding of that setup is that I want to select the other 3 resistors to be roughly equal to one end of the variable resistor’s range. So, for the flex sensors I’m using, which range from ~80K-400K, 82K seems reasonable. Now, ideally, I’d like to get full rail-to-rail output, even if it means clipping the edges of the input range (some input clipping would actually be desirable, since it would give a “dead zone” on either end). However, I’m not entirely solid on op amps, so I have a few questions, mostly about achieving rail-to-rail outputs.

-The op-amp I have selected (Microchip MCP6024, which contains 4 op amps, because I have 4 sensors) is rated for rail-to-rail inputs and outputs. Due to variance in the resistors in the Wheatstone Bridge, especially the flex sensors, it’s possible that, at the low end, there may be a negative voltage differential across the op amp’s inputs, though both voltages will always be positive wrt ground (the Wheatstone Bridge is using the same V+ and ground as the op amp rails). Do I understand correctly that this should result in a 0V output, assuming that the negative rail is tied to ground? I don’t ever want a negative output to occur. If this is not the case, I’ll have to calibrate the fixed resistances (probably by using a potentiometer in place of one of the fixed resistors) so that the differential input is never negative, but then I’d lose the input clipping, which I would have liked.

-On the high end of the outputs, it should be just a matter of selecting a feedback resistor to select the proper gain, right? I get an input range of ~1V, and I want a rail-to-rail output range of 3.3V, so I need roughly a 3.5x gain.

-Is driving an op amp rail-to-rail considered “bad”? Is it harmful to the device, or to other devices in the circuit? The inputs aren’t going to be driven rail-to-rail, but I would like the outputs to be.

The reason I would find input range clipping/clamping desirable is that these flex sensors are connected to the fingers of a glove, and it would be desirable to have “dead zones” at both the “fully flexed” and “fully relaxed” positions.

I’ve attached my current draft schematic for a single sensor. The 80K-400K range on RFLEX is known from measurement (though it varies from one sensor to the next, +/- 10%), so the 82K values for R1-R3 are selected based on that, I haven’t yet calculated the proper value for RF.

Driving this op-amp’s output to its rails does hurt it and shows no bad behavior. Study figure 2-27 in the data sheet.

Your next step is to wire it up and try it out.

Start with 82k for Rf which would give unity gain. then increase Rf to get the desired gain and output.

waltr:
Driving this op-amp’s output to its rails does hurt it and shows no bad behavior. Study figure 2-27 in the data sheet.

Do you mean "doesN'T hurt it? Otherwise this is confusing... :P

waltr:
Your next step is to wire it up and try it out.

Start with 82k for Rf which would give unity gain. then increase Rf to get the desired gain and output.

Yep, just waiting for them to get here, so I figured I'd make the best of the wait and ask these questions.

Oh boy…my bad.

Yes, I did mean to say driving the output to the rails will NOT hurt the op-amp.

qwertymodo:
-On the high end of the outputs, it should be just a matter of selecting a feedback resistor to select the proper gain, right? I get an input range of ~1V, and I want a rail-to-rail output range of 3.3V, so I need roughly a 3.5x gain.

Not quite. The way you have it, the bridge is (almost) balanced with the flex sensor at one end of it's range. That will produce an output from the op-amp that's halfway btw the op-amp's supply voltages, ~1.65v. Given the tolerances and 80k of sensor and op-amp input offset voltage, you may see slightly less than 1.65v.

As you flex the voltage will increase and w/Rf = 82k, full flex (400k) would try to push the output to peg at 3.3v. So you need to think how to re-bias your circuit (and reduce the gain) if you want the full dynamic range.

Here I used Rf = 20k just to show you the bias issue. Note that the simulation shows just above 1.6v @ 80k flex and just under 3.3v @ 400k flex.

(click on to open & enlarge)

I did not use a model of your op-amp, but a generic, “perfect” op-amp. Your results might not be as good as the above.

Would increasing R2 (to ~240K) fix the bias issue by allowing the differential to vary negative-to-positive, rather than 0-to-positive? Also, what program did you use for the simulation?

That helps but not all that much, you span 1.35v to 3.3v. Let me think about it. The program is the free version of LTSpice.

Ok, I’ll probably go ask one of the EE professors and see if they have any ideas. I’m an Embedded Systems major, not EE, so the analog domain isn’t exactly my strong suit…

Another way to do this is to use a constant current source for excitation. Pass a few microamps through the sensor and run the output to an opamp. (See attached)

The current is set by R2 and to add more sensors all you need to duplicate are Q1 and R2. The bases can all share the same reference. R2 sets the sensor current and is 0.7V/I. V2 can be a voltage divider buffered by a unity gain opamp.

You can adjust the sensitivity by varying the current (Not too much or the source stops working.) and the opamp gain. Adjust V2 for the offset you want.

You might want a better current source if you need to operate over a wide temperature range.

I though some thing was not right with this circuit. Found out what it is.

the circuit need three more resistor. The four in the bridge are the Voltage sources and not part of the Differential amp circuit. The circuit should look like this:

I used LT Spice to simulate the circuit. Its free from Linear Tech.

waltr:
I though some thing was not right with this circuit. Found out what it is.

the circuit need three more resistor. The four in the bridge are the Voltage sources and not part of the Differential amp circuit. The circuit should look like this:

. . .

I used LT Spice to simulate the circuit. Its free from Linear Tech.

Ding ding ding, we have a winner. :smiley:

I may have to play around with the values a bit more to adjust the dead zones, but that’ll come down to UX testing, and it’s simple enough to do now that I have a circuit that actually does what I want. Thanks guys, you’re amazing.

Yes, It is fun to figure out these.

The circuit UhChem posted is another way of using a resistive sensor and is the recommend circuit for using RTD temperature sensors.

The best circuit for a Bridge is an Instrument Amp. And if being followed by an ADC then an op-amp wired as a low pass (anti-aliasing) filter.

Technically, all we have is a single-resistive-element flex sensor, I only put it into the bridge because of things I had read online suggesting that to be a desirable configuration. I just got the parts in and hooked it up in the circuit I posted above (the LTSpice one, not the OP), and it works great (though, for lack of 270K resistors, I substituted 220K and changed R6 and R7 to 2.2K to compensate, which gave a different curve, but it’s fine for now, and I’ll play around with values later when I have the chance). I do prefer the single voltage-source configuration over UhClem’s version, just for simplicity. The plan is to connect Vout from the op-amp directly into the ADC input, but I’ll try adding a second op-amp for the low-pass filter and see how that turns out. Preferably, though, I’d rather just use a capacitor from Vout to ground for filtering, depending on how well it works.

That’s a plan. If a single cap clears up the signal then that’s good enough and you won’t need an op-amp filter stage.

qwertymodo:
Preferably, though, I’d rather just use a capacitor from Vout to ground for filtering, depending on how well it works.

Perhaps you meant a resistor and cap, as a passive low pass filter.

http://en.wikipedia.org/wiki/Low-pass_f … ealization

Note that a cap in parallel w/the feedback resistor (R5) is an active LPF w/o the need for a 2’nd op-amp.

You can do both the above to get a 2 pole LPF w/o the 2’nd op-amp.

Mee_n_Mac:
Perhaps you meant a resistor and cap, as a passive low pass filter.

Note that a cap in parallel w/the feedback resistor (R5) is an active LPF w/o the need for a 2’nd op-amp.

You can do both the above to get a 2 pole LPF w/o the 2’nd op-amp.

Yeah, I meant resistor + capacitor, but the active filter cap on the feedback is one less resistor, so I’ll probably just do that instead. I don’t really need a second-order filter, so I’d rather not add the extra parts (we’re already at over 30 resistors/caps for the 4 flex sensors). Thanks for all the help.

Ok, so I played around with it some more in LTSpice to try to get rid of the extra 2 resistors (R7 and R8 in my previous LTSpice schematic), and I think I managed to do it. The numbers didn’t make sense until I realized that the voltage divider created by R5 and R6 (in the schematic attached to THIS post, the component numbers are a little different than last time) seems to be acting like a series resistance added to R3, and the value of that series resistance seems to be equal to the value of R5 and R6 in parallel. So, my feedback resistor needs to equal Acl * (R3 + ((R5 * R6) / (R5 + R6))), where Acl is 3-3.5ish, depending on how wide I want the dead zones to be. Does that look right? Also, is that capacitor hooked up correctly for the low-pass filter? If my understanding of the R5 || R6 series resistance behavior is correct, a 100nF capacitor should result in a 1 / (2 * pi * (R1 || R2) * 100n) = ~11-27Hz cutoff (since the series resistance varies with R2, so the cutoff frequency will vary as R2 changes as well), which sounds good… maybe we’d want an even lower cutoff, I don’t know, but I have tons of 100nF caps, so it’s a good starting place.

Re: R5||R6, you have stumbled onto [Thevenin equivalence

The filter frequency is set by C1 and R4. Keep in mind that the lower the frequency cutoff the greater the delay. You can easily simulate the frequency response by swapping R2 for a voltage source. (In series with a 100K or so resistance. See Thevenin.)](Thévenin's theorem - Wikipedia)

UhClem:
Re: R5||R6, you have stumbled onto [Thevenin equivalence[/quote]

Aha, I knew that calculation seemed familiar, though I couldn’t quite place it because it’s been 3 years since I took that particular EE class, and I’m not an EE major, so it’s not something I keep up on… :)](Thévenin's theorem - Wikipedia)