Oricom Technologies

Return to:
Projects page.
Infrared (IR) Proximity Detector with Analog Output

|> Overview
|> Circuit Values
|> Signal Measurements
|> Analog Output
|> Beamwidth
|> Object Reflectance

NOTE - the circuit described here
has proved to be very reliable
for object detection, and can
be seen in operation on our
Quadruped Walker Nico-II
- see the [ n-roam1.avi ] movie -

This proximity detector is an extension of IRPD circuits described by Dennis Clark (555 Based IR Proximity Detector and 12C508 IR Obstruction Detector), and by Dave Hylands. Similar devices that have been around for several years, such as Seattle Robotics, and can be traced back to at least the early 1990's in Circuit Cellar magazine.

Dennis's units count background pulses and decide if an object is present based upon a certain degree of increase of pulse activity above this background level. Dave's unit appears to signal an obstacle whenever the detector module output goes low. The present detector differs from the others in that it rejects background activity and noisy reflections by integrating the pulse output of the IR detector module to produce an analog signal, which can easily be converted and thresholded using an A/D converter on a microcontroller.

[IRPD] Circuit Operation. As shown in the diagram at the right, the basic circuit consists of an IR Led pulsed at a frequency near 38 khz, plus an IR detector module, eg Panasonic PNA4602M. The light from the Led bounces off a nearby object, and is picked up by the detector module. A baffle can be placed between the Led and detector module to prevent direct pickup of pulses, or the Led can be partially encased in black heat-shrink tubing to eliminate backwards and sideways radiation.

The PWM signal to the Led has approx 50% duty cycle, and comes from a microcontroller. The output of the PNA4602 module is normally high, but goes low and stays low, when it picks up a steady 38 khz infrared signal. However, the module output will pulse irregularly in the presence of intermittent IR input - such as a reflected signal. To deal with this, the detector signal is integrated using a low-pass filter in a manner similar to converting a regular PWM signal to a DC voltage. The PNA4602 has an output inverter stage with an internal pull-up resistor of about 20 Kohms. The circuit adds another external pull-up (R1), and also low-pass filter R2-C1. The time constant of the overall filter consisting of R1, R2, and C1 is about 2 msec. This filter rejects individual noise pulses, smoothes pulsetrains into a representative voltage, and allows threshold-setting for reliable operation.

Downside - note that the downside to this type of detector is that the PNA4602 module is very sensitive, and will respond to other IR sources modulated at close to 38 khz, such as a TV remote or other robots generating IR signals. In practice, it's preferable to start and stop the Led output, and scan for extraneous IR sources inbetween searching for local obstacles.

<| Circuit Values

The IR Leds used in the circuit were Fairchild QED234 T-1 3/4 devices, with 27 mw/sr output at 940 nm peak wavelength, and the detector module was a Panasonic PNA4602M, which is a 3-pin device slightly smaller than a TO-220 package.

Effective Range. The range of the detector can be controlled in two ways: (a) by using an Led pulse frequency which is off-center from the most sensitive pickup frequency for the detector module, and (b) by adjusting the power output of the Led by adjusting the current flowing through it.

After some experimentation, we ended up using a 34.8 Khz PWM signal, and as shown in the diagram at the right, at this frequency the sensitivity of the 38 khz PNA4602 module is down to about 25% of its peak value. In addition, POT1 was set to about 3.4 Kohms, which limits the current through the Led to about 1 mA. These values give an effective detection range of 4 - 6" for objects with high infrared reflectivity, such as white paper and objects with shiny surfaces - and as shown below, this also allows objects with less IR reflectivity to still be detected at smaller distances.

Variations. Clearly, the detection distance can be adjusted over a wide range of values, from just a couple of inches to well over the 6" set here. Using a PWM frequency closer to 38 Khz and/or more Led current will select a longer range - and vice versa. Also, we haven't specifically examined it, but suspect that setting a longer range [by using more Led power, etc] will also increase the number of noise pulses picked up by the detector due to spurious reflections. In general, this could be a problem with a simple 'yes-no' digital output, but the integrated-analog output used here should reduce the problem somewhat.

<| Signal Measurements

Click for
Block Diagram
of PNA4602

The PNA4602 module itself has an internal integrator, which turns a continuous 38 khz IR pulse input into a constant output = low, or '0'. Therefore, with a strong reflection, the detector module will output a continuous '0' level. However, for objects either far away or with weak reflection, the detector module will only receive a few reflected pulses, and its output will be a series of pulses of varying width and number, depending upon how strong the reflection is. This last situation is shown in the diagram below. Note that this display is a single long trace, which wraps around 8 times on the screen. In this case, the external integrator, consisting of R1-R2-C2, has been disconnected from the module.

Raw Detector Module Output. In the presence of no pickup, the PNA4602 module output is steady high = '1'. A highly-reflective object [ie, the experimenter's hand] is then brought in from far away. As the object comes closer [shown in epochs 0 - 3], pulses start occurring as the reflection gets stronger. The number, length, and shape [negative-going or positive-going] of pulses in the transition zone between steady '1' and steady '0' is roughly related to the distance of the object. When the object is very close, a steady '0' level is output. In epochs 5 - 7, the reverse situation takes place as the object moves away from the detector - steady '0' gives way to pulses, then to a steady '1'.

[PNA4602 output - pulses vs object distance]

Click for
display of
Pulse Chatter
Pulse Chatter. It's not shown well at the display resolution above, but when an object is held fixed at a distance approximately halfway between just-detect and full-on for the detector module, then a continuous pulsetrain at about 2 to 5 Khz is output. Each pulse apparently represents the integration of several IR Led pulses [with ~15 usec length] by the detector module. This pulsetrain makes a nice continuous chatter when listened to on a piezo speaker. The speaker also made a useful aid for mapping the beamwidth, and for measuring detection ranges of various objects, as below.

Maximum Usable Range and Reliable Operation. By adjusting the current to the IR Led, the range of the IRPD can be varied. Less Led current decreases the range, and more current increases it. We found that the circuit is usable out to about 12" or so - however, what happens with the larger Led currents [ie, power output] is that "noisy" background pickup increases dramatically, and this gets especially serious when attempting to adjust the range to more than 12" or so. When listening on the piezo, there is a continuous pulse chatter with larger Led current levels, and if current is increased too much, then background pickup turns on the IR detector module fully, even with no targets in the beam. In contrast, when the current is set so the effective range is 8" or less, there is very little background chatter.

For reliable operation, the system needs a good way to reject or compensate for background pickup at the range selected.

  • One way is to ignore the chatter and simply use a low output from the detector module as indication of target detection. Obviously this will only work well if the range is set very low [ie, low Led current], to where there is essentially no spurious pickup.
  • A better method is to count the background pulses, and then use a threshold criterion regards an increased count above the background level to indicate target detection. See Dennis Clark's circuit. The downside to this is that the controller needs to have good resources [in hardware or software] for counting a lot of pulses, etc.
  • Another method is the one we use here - which is to integrate the IR detector module pulse output, and sample this using an A/D converter. Target detection is indicated when the A/D signal passes some threshold value [see next section]. The advantage is that this approach is easy to implement in software, and has little impact on other operations the controller is performing.

    <| Analog Output

    Integrator Output. The diagram below shows the detector module output integrated by external low-pass filter, R1-R2-C1, as the A/D converter sees it. Of note, individual noise pulses are eliminated, and a monotonic decrease in voltage is seen as the object moves in from afar. The transition zone corresponds to the situation above where the pulses occur. Once the object gets in close, the voltage stabilizes at a low level. The transition from low voltage back to high is the object moving away from the detector.

    This voltage can be measured by the A/D converter, and a threshold value between max and min can be used as a stable measure of object detection. This helps to eliminate the problem seen in the previous diagram, where the microcontroller has to use software routines to reject noise and deal with transition-zone pulses, and decide when a hard response is present. In fact, the signal below is smooth enough, it would probably work just as well if sent into a digital input of a microcontroller instead of to an A/D converter channel.

    [integrator output - voltage vs object distance]

    <| Beamwidth
    1"+/- 26 deg
    2"+/- 17 deg
    3"+/- 14 deg
    4"+/- 10 deg
    5"+/- 7 deg
    6"+/- 2 deg

    The effective beamwidth of the detector was measured using a white card, brought into the field-of-view from the side, at various distances. For these measurements, the Led and detector module beams were essentially parallel, with the two devices 1/2" apart.

    [IRPD beam] All in all, the beamwidth is narrower than we had expected, given that the beamwidth of the PNA4602 module is shown as being +/- 30-40 degrees, and that of the QED234 IR Led as +/- 20 degrees, in their respective datasheets. At about 1/2 the effective range for the given setup, the IRPD-AN beamwidth is only about 25-28 degrees total.

    <| Object Reflectance Characteristics

    objectsize ** detection range
    flat objects
    white paper pad3" x 5"5 - 8"
    lite-brown cardboard box6" x 6"4.5 - 7.5"
    brown fiberboard3" x 9"4 - 6.5"
    shiny black + multi-color
    CDRom cardboard box
    5" x 5.5"3.5 - 6.5"
    mottled blue plastic3" x 5"3.5 - 6"
    shiny metal ruler0.5" x 6"1 - 6"
    clear shiny plastic2" x 4"3 - 4.5"
    shiny green plastic3" x 5"2.5 - 4.5"
    transparent plastic chip tube1" x 6"2.5 - 4.5"
    shiny blue plastic ruler1" x 6"2.5 - 4"
    shiny black plastic2.5" x 6"1 - 3"
    black conductive foam3" x 5"1 - 1.5"
    (weak response)
    cylindrical objects
    shiny white screwdriver handle3/8" x 3"2 - 3.5"
    shiny white ballpoint pen1/4" x 6"2 - 3.5"
    lite-grey marker pen1/2" x 5"2 - 3"
    translucent white plastic cup2.0" x 1.5"2 - 3"
    semi-flat black battery holder1" x 4.5"0.5 - 2"
    mottled black microball pen3/8" x 6" 0.5"
    (weak response)
    ** detection range = min (detector full-on) - max (just-detect)

    Note that the reflected signal from an object is dependent upon a number of factors, and this will affect the nature of the detector module output [eg, pulses in the transition region], and also the distance of reliable detection. Objects with different reflective properties were found to have different detection distances. Relevant factors include:

  • object surface color - eg, white objects are good reflectors, black conductive foam is poor.
  • object surface shininess - eg, shiny surfaces work well, including transparent plastic.
  • size of object - eg, small dark objects must be close, and can be missed.
  • for flat objects - relative angle between plane surface and IR detector beam.
  • speed of movement.
  • extraneous interfering IR signals.

    The table at right shows detection ranges for several common objects. Flat objects were oriented orthogonal to the detector beam. "Just-detect" refers to the distance at which the first few individual detector module output pulses were observed.

    Oblique Objects. When flat objects are oriented at an angle to the detector beam, instead of oriented orthogonally, the responses are generally lower - and the objects must be located slightly closer for full-on detection. The table below shows responses for several of the same objects as before, but angled at 45 deg with respect to the detector beam.

    object45 degree
    detection range
    white paper pad3.5 - 7"
    cardboard box3.5 - 7"
    mottled blue plastic3 - 5"
    shiny green plastic2.5 - 4.5"
    shiny blue plastic ruler2 - 4"

    Summary. Comparing the beamwidth and object reflectivity results indicates that:

  • the IR proximity-object detector will probably work well for detecting large objects with relatively-high IR reflectance - meaning most objects that also appear bright to the eye in the visible spectrum, and that extend beyond the size of the beam.
  • small, bright objects centered within the beam are also detected well.
  • small, dark objects are the most problematical to detect.

    <| TOP

    © Oricom Technologies, Feb 2004, revised July 2004