In Part 1, we covered the basics of
sensors and the characteristics you
must keep in mind when using them in designs. However, there is
an enormous range of specialist sensors developed for specific
applications in the engineering field.
Some of the more commonly used sensors are outline here and fall into
several categories: position and distance sensors, speed sensors,
temperature sensors, strain sensors, humidity sensors and light
sensors.
Position and distance sensors
Potentiometer. A
potentiometer can be used as a simple position sensor. The voltage
output represents the angular setting of the shaft. It has limited
range (about 300°) and is subject to noise and unreliability due to
wear between the wiper contact and the track. There are therefore a
range of more reliable position transducers, which tend to be more
expensive.
 |
| Linear
Potentiometer |
LVDT. A
linear variable differential transformer (LVDT) uses electromagnetic
coils to detect the position of a mild steel rod which forms a mobile
core. The input coils are driven by an AC signal, and the rod position
controls the amount of flux linked to the output coil, giving a
variable peak"to-peak output. It needs a high-frequency AC-supply, and
is relatively complex to construct, but reliable and accurate.
 |
| Rotary
Potentiometer |
Capacitor.
The capacitor principle provides opportunities to measure distance
and level. If considered as a pair of flat plates, separated by an air
gap, a small change in the gap will give a large change in the
capacitance, since they are inversely proportional; if the gap is
doubled, the capacitance is halved. If an insulator is partially
inserted, the capacitance also changes.
 |
| Capacitor
plate separation |
This can make a simple but effective level sensor for insulating
materials such as oil, powder and granules. A pair of vertical plates
is all that is required. However, actually measuring resulting small
changes in capacitance is not so straightforward. A high-frequency
sensing signal may need to be converted into clean direct voltage for
input to a digital controller.
 |
| Capacitor
Dielectric |
Ultrasonic.
Ultrasonic ranging is another technique for distance measurement.
The speed of sound travelling over a few metres and reflecting from a
solid object gives the kind of delay, in milliseconds, which is
suitable for measurement by a hardware timer in a microcontroller. A
short burst of high-frequency sound (e.g. 40 kHz) is transmitted, and
should be finished by the time the reflection returns, avoiding the
signals being confused by the receiver.
Speed sensors
Digital. The speed or position of
a DC motor cannot be controlled accurately without feedback. Digital
feedback from the incremental encoder described above is the most
common method in processor systems, since the output from the
opto-detector is easily converted into a TTL signal. The position
relative to a known start position is calculated by counting the
encoder pulses, and the speed can then readily be determined from the
pulse frequency. This can be used to control the dynamic behaviour of
the motor, by accelerating and decelerating to provide optimum speed,
accuracy and output power.
 |
| Magnetic
flux |
Analogue. For
analogue feedback of speed, a tachogenerator can be used; this is
essentially a permanent magnet DC motor run as a generator. An output
voltage is generated which is proportional to the speed of rotation.
The voltage induced in the armature is proportional to the velocity at
which the windings cut across the field.
If the tachometer is attached to the output shaft of
a motor controlled using PWM, the tachometer voltage can be converted
by the MCU and used to modify the PWM output to the motor, giving
closed loop speed control. Alternatively, an incremental encoder can be
used, and the motor output controlled such that a set input frequency
is obtained from the encoder.
Temperature sensors
Temperature is another commonly required measurement, and there is
variety of temperature sensors available for different applications and
temperature ranges. If measurement or control is needed in the range of
around room temperature, an integrated sensor and amplifier such as the
LM35 is a versatile device which is easy to interface.
 |
| Metal
resistance temperature sensor |
It produces a calibrated output of 10 mV/°C,
starting at 0°C with an output of 0 mV, that is, no offset. This
can be fed directly into the PIC analogue input if the full range of
-50°C to +150°C is used.
This will give a sensor output range
of 2.00 V, or 0.00 V " 1.00 V over the range 0"100°C. For smaller
ranges, an amplifier might be advisable, to make full use of the
resolution of the ADC input. For example, to measure 0"50°C:
Temp range = 50°C
Input range used = 0-2.56 V (8-bit conversion, VREF = 2.56 V)
Let maximum = 2.56
X 20 = 51.2°C
Then conversion factor = 2.56/5.12 = 50 mV/°C
Output of sensor = 10 mV/°C
Gain of amplifier required = 50 mV/10 mV = 5.0
A non-inverting amplifier with a gain of 5 will be
included in the circuit. Note that if a single supply amplifier is
used, the sensor will only go down to about +2°C.
Diode. The
forward volt drop of a silicon diode junction is usually estimated as
0.6 V. However, this depends on the junction temperature; the voltage
falls by 2 mV/°C as the temperature rises, as the charge carriers
gain thermal energy, and need less electrical energy to cross the
junction.
 |
| Silicon
diode sensor |
The temperature sensitivity is quite consistent, so
the simple signal diode can be used as a cheap and cheerful alternative
to the specialist sensors, especially if a simple high/low operation
only is needed. A constant current source is advisable, since the
forward volt drop also depends on the current.
Metals. Metals
have a reasonably linear temperature coefficient of resistance over
limited ranges. Metal film resistors are produced which operate up to
about 150°C, with platinum sensors working up to 600°C. The
temperature coefficient is typically around 3"4000 ppm (parts per
million), which is equivalent to 0.3%/°C. If the resistance at the
reference temperature is, say, 1 kohm, the resistance change over
100°C would be 300"400 ohms.
A constant current is needed to convert the
resistance change into a linear voltage change. If a 1 kohm
temperature-sensing resistor is supplied with a constant 1 mA, the
voltage at the reference temperature, 25°C, would be 1.00 V, and
the change at 125°C would be 370 mV, taking it to 1.37 V. An
accuracy of around 3% may be expected.
 |
| Integrated
temperature sensor |
Thermocouple.
Higher temperatures may be measured using a thermocouple. This is
simply a junction of two dissimilar metals, which produces a battery
effect, producing a small EMF. The voltage is proportional to
temperature, but has a large offset, since it depends on absolute
temperature. This is compensated for by a cold junction, connected in
series, with the opposite polarity, and maintained at a known lower
temperature (say 0°C). The difference of voltage is then due to the
temperature difference between the cold and hot junctions.
 |
| Thermocouple |
Thermistor. Thermistors
are made from a single piece of semiconductor material, where the
charge carrier mobility, therefore the resistance, depends on
temperature. The response is exponential, giving a relatively large
change for a small change in temperature, and a particularly high
sensitivity. Unfortunately, it is non-linear, so is difficult to
convert for precise measurement purposes.
 |
| Thermistor |
The thermistor therefore tends to be used as a safety
sensor, to detect if a component such as a motor or transformer is
overheating. The bead type could be used with a comparator to provide
warning of overheating in a microcontroller output load.
Strain sensors.
The strain gauge is simple in principle. A temperature-stable alloy
conductor is folded onto a flexible substrate which lengthens when the
gauge is stretched (strained). The resistance increases as the
conductor becomes longer and thinner.
This can be used to measure small changes in the
shape of mechanical components, and hence the forces exerted upon them.
They are used to measure the behaviour of, for example, bridges and
cranes, under load, often for safety purposes. The strain gauge can
measure displacement by the same means.
 |
| Strain
Guage |
The change in the resistance is rather small, maybe
less than 1%. This sits on top of an unstrained resistance of typically
120 ohms. To detect the change, while eliminating the fixed resistance,
four gauges are connected in a bridge arrangement and a differential
voltage is measured.
The gauges are fixed to opposite sides of the
mechanical component, such that opposing pairs are in compression and
tension. This provides maximum differential voltage for a given strain.
All the gauges are subject to the same temperature, eliminating this
incidental effect on the metal conductors. A constant voltage is
supplied through the bridge, and the difference voltage fed to a high
gain, high input impedance amplifier.
 |
| Pressure
sensor |
Care must be taken in arranging the input
connections, as the gauges will be highly susceptible to interference.
The amplifier should be placed as near as possible to the gauges, and
connected with screened leads, and plenty of signal decoupling. The
output must then be scaled to suit the MCU ADC input.
Pressure can be measured using an array of strain
gauges attached to a diaphragm, which is subjected to the differential
pressure, and the displacement measured. Measurement with respect to
atmosphere is more straightforward, with absolute pressure requiring a
controlled reference. Laser-trimmed piezoresistive gauge elements are
used in low-cost miniature pressure sensors.
Humidity sensors
There are various methods of measuring humidity, which is the
proportion of water vapour in air, quoted as a percentage. The
electrical properties of an absorbent material change with humidity,
and the variation in conductivity or capacitance, can be measured.
 |
| Humidity
sensor |
Low-cost sensors tend to give a small variation in
capacitance, measured in a few picofarads, so a high-frequency
activation signal and sensitive amplifier are needed.
Light sensors
There are numerous sensors for measuring light intensity:
phototransistor, photodiode, light-dependent resistor (LDR, or cadmium
disulphide cell), photovoltaic cell and so on. The phototransistor is
commonly used in digital applications, in opto-isolators, proximity
detectors, wireless data links and slotted wheel detectors. It has
built-in gain, so is more sensitive than the photodiode.
 |
| Light
dependent resistor |
 |
| Phototransistor |
Infra-red (IR) light tends to be used to minimise
interference from visible light sources, such as fluorescent lights,
which nevertheless, can still be a problem.
The LDR is more likely to
be used for visible light, as its response is linear (when plotted log
R vs. log L) over a wide range, and it has a high sensitivity in the
visible frequencies.
The CdS cell is widely used in photographic light
measurement, for these reasons. Conversion into a linear scale is
difficult, because of the wide range of light intensity levels between
dark and sunlight.
Next, in Part 3: Implementing
a sensor/MCU interface.
To read Part 1, go to An
introduction to sensors and their
characteristics
Used
with the permission of the publisher, Newnes/Elsevier, this series of
three articles is based on copyrighted material from "Interfacing
PIC Microcontrollers: Embedded Design by Interactive Simulation," by Martin Bates. The book can be
purchased on line.
Martin Bates is a lecturer in
technology at the Hastings College of Arts and Technology, United
Kingdom