How to design a precise infrared motion sensor at low cost
 |
READ THIS TO FIND OUT ABOUT:
 |
- High-accuracy infrared sensor design
- Industrial control systems
- Sensor-array optimisation
|
 |
|
|
Designers of industrial equipment can produce a robust and
precise IR motion detector at far lower cost than commercial offthe-
shelf versions. Tomas Knatterod, Field Applications Engineer,
Future Electronics (Norway) explains.
Motion sensing is commonly used in a variety of industrial and security
applications. Precision motion sensors can often be found in products such as
industrial process equipment, vending machines and recycling sorters.
Highly precise commercial off-the-shelf motion sensors can be found on the
market today for such applications, but they are extremely expensive. If more
than 50 units of such equipment are to be built, it will generally be cheaper to
design a precision motion sensor using components that are freely available
from broadline distributors such as Future Electronics.
There is a wide choice of technologies available for creating a new motion
sensor, and each offers a different combination of cost and performance for
different applications. Of all of them, Infrared (IR) sensor technology usually
offers the lowest-cost solution. This article will focus on the best way to design
a precision IR motion sensor for industrial applications.
Before starting the design of a motion detector, it is important to analyse
certain key factors about the object to be detected and its environment:
- Speed of the object (max/min)
- Size of the object (the largest and smallest two-dimensional area that the detector must monitor)
- Distance from the object to the sensor (max/min)
- Presence of other sources of IR radiation in the detection area (such as human beings or animals) apart from the object to be detected
- Presence of objects or buildings in or near to the detection area that could reflect IR radiation
The presence of other sources of IR radiation can be a critical problem. At
best, this will complicate the design; at worst, it can make the use of an IR
sensor completely impossible.
In this case, the designer should either consider alternative sensing
technologies, or take other measures to stop unwanted sources of IR radiation
from intruding into the detection area. Similarly, the presence of objects that
could reflect IR radiation on to a PIR sensor could prevent its use, or require
complex and difficult signal-processing routines to be developed to filter out
reflected radiation. In a typical industrial application, such as a conveyor belt in
a factory, however, these complications do not arise.
The basic structure of an IR sensor for motion detection
There are three ways to configure an IR motion detector:
- With the transmitters on one side of the detection area, and the receivers on the other side (see Figure 1)
- With both the detectors and receivers on one side of the detection area, and a reflector on the other side
(see Figure 2)
- With a transmitter and a receiver on one side of the detection area, and no reflector so that radiation only reaches the receiver when reflected from an object (see Figure 3)
The third configuration described above can only be used in a system with
just one receiver and transmitter. Such a system is not capable of the accurate
and precise sensing of motion, and is more appropriate for intruder alarms.
In order to design a precision motion detector, it is important to know the
smallest size of the objects to be detected. This is because the IR transmitters
have to sit slightly closer to each other than the smallest possible length of
object to be detected. Knowing this variable, and the width of the detection
area, it is easy to calculate how many IR transceivers are needed:
|
(Detection-area width/minimum size of object to be detected) + 1 ≥
|
|
Number of transceivers and receivers required
|
This formula is valid for motion detector systems both with receivers and
transceivers on the same side of the object to be detected, and with receivers
and transceivers opposite each other.
How the system works
All the receivers are connected to the same ADC. The system switches the
transmitters in sequence, and if a receiver detects no signal when its
transmitter ‘pair’ is active, the system knows that an object is in the detection
area (see Figure 4).
The reason for switching each transmitter in sequence is that this allows
them to be driven at peak current, maximising IR output intensity. In
continuous mode, an IR LED typically operates at 65mA forward current, but in
peak mode forward current can be as much as 1A. In order to maximise the
allowable distance between the transmitter and receiver, then, it is necessary
to run the IR LEDs in peak-current mode.

Fig. 1: precision motion detection system with transmitters
and receivers on opposite sides of the detection area.
Peak mode is shown in the datasheet for most IR LEDs with specified ratings
for pulse width (typically up to 100µs), and duty cycle (typically up to 1%).
It is important to know the maximum speed of the object to be detected,
because this determines the minimum switching time of the LEDs. The
formula below can be used to calculate this minimum switching time. It can
be seen from the formula that when more LEDs are used, the switching
frequency increases:
|
LED switching time =
minimum length of object / maximum speed of object / number of LEDs
|
The application of both formulae can be shown using the following example,
based on detecting boxes passing on a conveyor belt, where the short side of
the box is 17mm long and where the detection area is 7.5cm x 50cm. The
motion detector is positioned so as to detect the shortest side of the box. The
conveyor belt’s maximum speed is 5m/s.
Calculating the number of LEDs and transmitters:
Number of LEDs and receivers required ≥
(Detection area width / minimum size of object to be detected) + 1
Number of LEDs and receivers required > over = (7.5cm/1.7cm) + 1 = 5.4
|
Therefore the system requires 6 LEDs and 6 receivers.
Calculating the LED switching time:
LED switching time =
minimum length of object / maximum speed of object / number of LEDs
0.017[m]/5[m/s]/6 = 0.000566.
|
Therefore the LED switching time in this example will be 566µs.
As the formula shows, the required switching frequency can be
uncomfortably high if a small object is moving at speed. This has important
ramifications for the selection of the microcontroller. In particular, it is
important to choose a microcontroller with a high MIPS rating if the LED
switching frequency is high. This is because it is often necessary to perform
some signal-processing functions on the analogue input signals between each
LED-switching operation.
If the switching time is below 2ms a 32-bit processor is recommended to
handle signal-processing functions. STMicroelectronics’ new STM32 device
uses ARM’s Cortex core and offers sufficient processing performance to suit
these high-frequency applications. NXP’s ARM7 and STMicroelectronics’ STR7
series of 32-bit microcontrollers could also be considered.

Fig. 2: precision motion detection system with transmitters
and receivers on the same side of the detection area.
Cost vs. performance
The most cost-efficient configuration for this IR motion detector is to
place the receivers and the transistors on the same side of the PCB (see
Figure 2), but this adds complication.
In this configuration, IR light needs to be emitted in a straight line through
the detection area, and not scattered outside this line. Any stray light risks
being reflected to a receiver that the transmitter is not paired with.
Z-bend surface-mounted LEDs are useful in this situation. The Z-bend
package is back-mounted, which makes it possible to use the PCB itself to
narrow the angle of the IR light coming out of the transmitter. This also
provides for robust mechanical design, eliminating the need for a glass or
acrylic protective cover.
It is important that the phototransistor receives no light directly from its
paired LED, and only receives light from the reflector. When an LED emits light
through a hole in the PCB, light can pass through the fibres in board material. It
is therefore necessary to metal-plate the holes in which the LEDs are mounted,
and it may be prudent to do the same for the phototransistor holes.
Phototransistors and IR LEDs are often supplied in pairs, where the
phototransistor is optimised for the corresponding LED. Fairchild
Semiconductor, Avago Technologies and Vishay are leading producers of these
components.

Fig. 3: a simple reflective IR system is not capable of precise motion detection.
Almost all the light from an LED goes in a forward direction, at an angle
specified by the manufacturer, but some of the light also comes out from the
side. This means that it is necessary to isolate the sides of the LED and
phototransistor if they are placed close together.
This can be difficult to accomplish. One method commonly adopted is to
vacuum-mount a silicon material that is resistant to IR light around the
phototransistor and the LED. Practical experience, however, suggests that the
LED’s forward light output changes in terms of the angle and intensity when a
silicon material is in contact with it. Mounting an isolator that is made of a
different material is one way around this problem.
The choice of reflector also significantly impacts the performance of the
system. Broadly, the greater the distance between the transmitter and the
reflector, the better the specification of the reflector must be. For practical
purposes, the maximum size of detection area is around 1m across when
using a reflector.
A higher-resolution reflector and better reflector material will significantly
improve the performance of the system. Reflector tape has the advantage of
low cost, but much better performance is achieved using a good industrial
plastic reflector in demanding applications. However, if the detection distance
is less than 40cm, reflector tape is often good enough.
It is obvious, then, that the design of a system with one PCB (transmitters
and receivers on the same side of the detection area) is cheap, but requires
significant trade-offs to be accommodated in the design.
The alternative configuration, shown in Figure 2, with two PCBs and the
transmitters and receivers on opposite sides of the detection area, avoids these
complications, but results in a higher bill of materials. As well as being simpler
to design, the two-board approach also makes it easy to extend the distance
between the receivers and transmitters up to several metres.
When using this two-board configuration, it is possible to run the system
with one microcontroller. This, however, requires a large number of cables to
connect the LEDs and phototransistors, and heightens the risk of noise
distorting the signal. For this reason, it is better to implement this particular
configuration with two microcontrollers: one to control the transmitters, and
one to control the receiving phototransistors. Then the system only requires a
single synchronisation signal between the two microcontrollers, eliminating
the need for multiple cables.
The environment around the detection area
Ideally, no objects will be positioned close to the detection area. An
object near the detection area could create blind spots for the receivers.
To avoid this, any objects that cannot be removed from the detection
zone should be coated with anti-reflective matt paint.
Sunlight and other light sources also often contain IR light. This can create
unwanted noise that can cause detection failures. It is possible to write
software routines to calibrate for sunlight error. This technique involves filtering
out slow IR detection events (because changes in sunlight generally occur
slowly), and only register fast movements in the detection area. Even this,
however, is not perfect, because sunlight and other light sources can flash or
create sudden shadows in certain situations.
Conclusion
By using simple components (LEDs, phototransistors and a
microcontroller) and the careful component mounting techniques
described in this article, it is possible for designers of industrial equipment
to produce a robust and precise IR motion detector at far lower cost than
commercial off-the-shelf versions.

Fig. 4: by switching transmitters in sequence, the system can determine
from the state of the receivers whether an object is in the detection area