Searching \ for '[EE]: sensor interface' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/io/sensors.htm?key=sensor
Search entire site for: 'sensor interface'.

Exact match. Not showing close matches.
PICList Thread
'[EE]: sensor interface'
2002\03\22@011800 by Aaron K

flavicon
Hi all, I'm pretty familiar with the digital side of things, but I've got a
(small, basic) analog problem to figure out, and was hoping someone could
help.

Basically, I need to interface a couple of sensors to a PIC with A/D. The
PIC and A/D side I can take care of, but these sensors are setup such that
they are a variable resistance to ground. For example, one of them is an
automotive pressure sensor with a 10-187 ohm resistance to ground, and I
would like to convert that to a variable voltage. Oh, and most of the
sensors are linear.

I was thinking about trying to use the sensor as part of a voltage divider
and 2 op amps to offset and amplify the voltage to a 0-5V range, then I
could simply handle the unit conversion in software. This would be the
correct way to do it, right?

I was trying to find a simpler way of interfacing these sensors because I
will have several of them, each with different resistance ranges, so trying
to setup and calibrate the resistance values for each one seems like a big
pain.

Should I just shut up and start trying to setup the op amps for each of
these sensors, or is there an easier way? Maybe someway to utilize the fact
that they are resistance to ground?

Any help or pointers to information is greatly appreciated.

Aaron

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2002\03\22@060918 by Dave Dilatush

picon face
Aaron wrote...

>Basically, I need to interface a couple of sensors to a PIC with A/D. The
>PIC and A/D side I can take care of, but these sensors are setup such that
>they are a variable resistance to ground. For example, one of them is an
>automotive pressure sensor with a 10-187 ohm resistance to ground, and I
>would like to convert that to a variable voltage. Oh, and most of the
>sensors are linear.
>
>I was thinking about trying to use the sensor as part of a voltage divider
>and 2 op amps to offset and amplify the voltage to a 0-5V range, then I
>could simply handle the unit conversion in software. This would be the
>correct way to do it, right?

Yes, that's probably the easiest way to do it--though you could
get by with only one opamp per channel, arranged as a
non-inverting amplifier referenced to ground, if you're willing
to put up with an output range slightly narrower than 0-5V.

{Quote hidden}

I think you're going about it the right way; I can't think of any
other approach that would be much simpler.

HTH...

Dave

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam@spam@mitvma.mit.edu


2002\03\22@091827 by Olin Lathrop

face picon face
> Basically, I need to interface a couple of sensors to a PIC with A/D. The
> PIC and A/D side I can take care of, but these sensors are setup such that
> they are a variable resistance to ground. For example, one of them is an
> automotive pressure sensor with a 10-187 ohm resistance to ground, and I
> would like to convert that to a variable voltage. Oh, and most of the
> sensors are linear.

What resolution do you need?  For example, if 8 bits is enough you can use
1/4 range of a 10 bit A/D, which only requires 0 to 1.25 volts.  Even less
if you only need 6 bits, for example.

What is the maximum current or power rating of the sensors?  For example, if
you wanted the 187 ohms to result in 5V, it would require 28mA and would
dump 134mW into the sensor.  If this is acceptable, you could run a fixed
current thru the sensors and get the desired 0-5 volts out directly.  Since
you have software that can apply corrections, this could be as simple as a
200 ohm resistor to are regulated 10V supply, for example.  If you use the
output of the sensor directly, then be sure to put a 10K ohm resistor
between the sensor and the PIC pin.  Otherwise an open sensor will blow up
the PIC.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinspamKILLspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu


2002\03\22@200501 by Aaron K

flavicon
>What resolution do you need?  For example, if 8 bits is enough you can use
>1/4 range of a 10 bit A/D, which only requires 0 to 1.25 volts.  Even less
>if you only need 6 bits, for example.

8 bits is going to be fine.

>What is the maximum current or power rating of the sensors?

Thats one thing I was unable to detiremine, so I'm going to have to make
some guesses and play it safe. I think a range of 20-30 mA shouldn't be a
problem.

>For example, if
>you wanted the 187 ohms to result in 5V, it would require 28mA and would
>dump 134mW into the sensor.  If this is acceptable, you could run a fixed
>current thru the sensors and get the desired 0-5 volts out directly.

I like the idea of a fixed current source through the sensor, I'll have to
look more into this. One of the original problems I had was keep the current
through the sensor low enough.

>Since
>you have software that can apply corrections, this could be as simple as a
>200 ohm resistor to are regulated 10V supply, for example.

This will be an automotive project, so I'd like to just use my existing +5v
power supply, and not have to add another.

>If you use the
>output of the sensor directly, then be sure to put a 10K ohm resistor
>between the sensor and the PIC pin.  Otherwise an open sensor will blow up
>the PIC.

Thanks for your help!

Aaron

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam_OUTspamTakeThisOuTmitvma.mit.edu


2002\03\23@111708 by Thomas McGahee

flavicon
face
Aaron,

************
A cheap solution that covers the entire sensor range with reasonable
resolution and accuracy, but one that is ***non-linear*** will be shown
first. You would use a calculated lookup table to return the desired result.

Connect the 10-187 ohm sensor in series with a resistor to +5 volts. Make
the series resistance 490 ohms. This will keep the current flow to less than
10 ma.

With the value chosen, the output will be  (5/(490+Rsensor))*Rsensor.
With a sensor range of 10-187 ohms that would give us an output
voltage range from .1 to 1.3811    If you multiply this by 3.6203
using an opamp, then the voltage range would be from .3620 to 5.000 volts
into the A/D.

One problem is that this method does not give a linear result. That
is because the current flow ranges between 10.00 ma and 7.385 ma as the
sensor resistance changes.

*************
A medium cost solution is to replace the 490 ohm series resistor with
a constant current source. For the sake of keeping the examples as
similar as possible, I will chose a 10 ma constant current source.

The output voltage will now range from .100 v. to 1.870 volts.
If we use an opamp to multiply the output by 2.6738 then this will
give us an output of .26738 to 5.000 volts. This output has the
advantage of being perfectly linear.

Because the output voltage from the constant current generator will
only have to go to 1.87 volts, you can use a simple PNP constant
current source. Since you have a fairly good source of +5 volts
available, you can simply use two series resistors to develop a
base to emitter voltage of 1.6 volts. (1.6k in series with 4.4k).
The emitter resistor should be 100 ohms. This will generate 10 ma.

*************
For maximum resolution and stability, consider using a dual constant current
source. That is two PNP transistor constant current sources whose bases
both share the same voltage source. Adjust one of the constant current
sources to provide 10 ma for the 10-187 ohm sensor. The resultant sensor
voltage is connected to the non-inverting input of an instrumentation amp.

The other constant current source can be configured to deliver 1 ma.
Connect it to a 100 ohm resistor connected to ground.
(10 times the low sensor resistance). The resultant voltage is fed to
the inverting input of an instrumentation amp. With a gain of 1 the
output of the amp would be 0-1.77 volts. (187-10=177  177*.010=1.77).

A 10 bit A/D converter will generate a count of 1023 for an input of 5.00 v
if the reference voltage is 5.00 v. It would be more convenient for us if
the binary count was 1000 for an input of 5.000 volts. We can accomplish
this
if we set the gain of the amp to (5.000/1.77)*(1000/1023). This is 2.761.
A sensor resistance of 187 ohms will result in 1.87 volts. The instrument
amp subtracts .1 volts for a differential of 1.77 volts. This is multiplied
by 2.761 which gives us 4.8869 volts into the A/D. The A/D will generate a
binary count of (1023/5.000)*4.8869 = 999.859  which will show up as 999.
If you divide this by 2 (via a shift right) you will get 499 + the .5 that
got right shifted out. So you have a value of 4.995 volts which is within
.1% of the actual value.

This method results in a perfectly linear output that covers the entire
sensor range with maximum resolution and accuracy.

A lookup table or mathematical algorithm can be used to convert the result
to the desired form. You can also adjust the gain of the circuit so that
the resultant binary count from the A/D directly corresponds to the
desired system units.

************

Fr. Thomas McGahee



{Original Message removed}

2002\03\23@120737 by Olin Lathrop

face picon face
> I like the idea of a fixed current source through the sensor, I'll have to
> look more into this. One of the original problems I had was keep the
current
> through the sensor low enough.
>
> >Since
> >you have software that can apply corrections, this could be as simple as
a
> >200 ohm resistor to are regulated 10V supply, for example.
>
> This will be an automotive project, so I'd like to just use my existing
+5v
> power supply, and not have to add another.

If this is automotive, then you must have +12V available.  If you want your
A/D range to be 0-5V, then the current source will need some headroom above
that.  You could filter the 12V supply a little (you will need to do this in
any case because automotive 12V supplies are VERY dirty), and then run a
current source from there to your sensor.  It could be as simple as a
transitor, resistor, and zener, but you aren't going to get 8 bits over
temperature and voltage variation with that.  By the time you create a
current source that is solid to 8 bits, you will end up with a lot of parts.
I think a fixed voltage regulator around 10V with a resistor to your sensor
is going to be easier.  This is definitely a a win if you have more than one
sensor.  You make the nice clean 10V source once, then each new sensor just
needs its own resistor.

I just thought of another idea.  I really like this one.  Should have
thought of it before, duh!  Start by filtering the +12V supply (all
solutions will start with this) with L-R-C.  Now you've got a clean (spikes
removed) but fluctuating voltage.  Assume it will be from 10 to 16 volts.
From there just run the appropriate resistor to each sensor so that the
sensor voltage comes out to 4V or so with max supply and max sensor
resisance.  Now use a simple resistor divider from the filtered 12V to make
the A/D reference voltage for the PIC.  Make sure this is guaranteed to stay
under 5V with max filtered supply voltage.  The fluctuations in the filtered
supply cancel, so there is no need for a regulated voltage or current
source.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinspamspam_OUTembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\03\23@152151 by Dave Dilatush

picon face
part 1 2003 bytes content-type:text/plain; charset=us-ascii (decoded 7bit)

Aaron wrote...

>Basically, I need to interface a couple of sensors to a PIC with A/D. The
>PIC and A/D side I can take care of, but these sensors are setup such that
>they are a variable resistance to ground. For example, one of them is an
>automotive pressure sensor with a 10-187 ohm resistance to ground, and I
>would like to convert that to a variable voltage. Oh, and most of the
>sensors are linear.
>
>I was thinking about trying to use the sensor as part of a voltage divider
>and 2 op amps to offset and amplify the voltage to a 0-5V range, then I
>could simply handle the unit conversion in software. This would be the
>correct way to do it, right?

Expanding on what I wrote yesterday, there is a very easy way to
correct for a voltage divider's nonlinearity that doesn't involve
using constant current sources.  All you need is one extra
resistor.

This linearizing technique is frequently used when interfacing
RTD temperature sensors, and involves positive feedback from the
opamp which is amplifying the voltage divider's output prior to
feeding it to the A/D.

Referring to the attached schematic GIF, Rx is your sensor which,
along with R1, forms the voltage divider which I've shown
operating from your +5V supply, Vcc.

R2 and R3 set the gain of amplifier A1 at K = (R2 + R3)/R2 where
K is whatever you need to get the desired output range.

R4 is the linearizing resistor, with a value equal to R1*R3/R2.

With Vcc = 5V, R1 = R2 = 1K ohms and R3 = R4 = 4K ohms, you get a
linear output of Vout = 0.005 * Vcc * Rx, where Rx is in ohms.
Sensor current is 5 mA, independent of its resistance.

You'll need to use a rail-to-rail opamp like the LMC6484 (CMOS)
or LM6134 (bipolar) if you want to run the opamp from GND and
Vcc; otherwise, if you want to use an LM324 or something like
that you'll need to power it from a higher voltage like your +12V
supply with heavy filtering to get rid of the noise.

HTH...

Dave



part 2 1250 bytes content-type:image/gif; name=linearizer.gif (decode)


part 3 154 bytes
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\03\25@031337 by Aaron K

flavicon
Thanks for everyone's input and help with this! I haven't had the time yet
to go over everything in detail, but what I've recieved will be of great
help.

When I get the project finished, I'll be sure to post a link to the
project's website so anyone that is interested can see it.

Thanks again!

Aaron

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...