Testing TSOP4038 and PNA4602M Infrared Detectors

Previously, we saw oscilloscope traces of detection delays and intermittent false detection pulses. Before that, we saw detection distances compared between the Panasonic PNA4602 and the Vishay TSOP4038 38kHz infrared detectors. Your results will vary based on the circuitry, objects, emitters, and ambient lighting. What follows is a description of what I used to produce my results.

Test apparatus of a Roundabout circuit board oscilloscope and moveable target

Test apparatus of a Roundabout circuit board oscilloscope and moveable target.

The test holder is repurposed from the GP2D12 infrared distance measurement sensor tests. It consists of a 1.2 meter long ruler and a sliding target made of white ABS plastic that is 15 cm by 15 cm. The flat black table is cleared of all other objects (including the white graph paper background in the photo) before testing.

A Velleman PCS64i oscilloscope is connected to a computer. The scope probes attach to two custom circuit boards based on the Roundabout Motherboard PCB and the Constant Current LED Tester.

38 kHz infrared emitter detector test circuit

38 kHz infrared emitter detector test circuit

Here’s how the total circuit works:

① Voltage regulator power supply with reverse-polarity and overcurrent protection. These safety features are vital when you are switching wires around to perform various tests. Additionally, the on-board regulator and liberal use of various capacitors outputs a steady 5 V that is less likely to produce spurious spikes in the infrared detectors. Note the large copper plane on the motherboard.

② 74AC14 Schmidt-trigger inverter logic chip generates the 38 kilohertz square wave to output to the infrared emitters. The exact frequency is fine-tuned with the blue square multiturn trimpot and checked using a Sinometer VA38 multimeter and the oscilloscope.

③ The 74AC14 has enough power output to drive several LEDs. However, for these tests I didn’t know how many LEDs I would need. Additionally, I couldn’t predict the maximum current and voltage desired. So, the 74AC14 is connected to a NPN bipolar 2222A transistor to provide hundreds of milliamps of current, up to 40 volts.

④ The LED Tester board attaches to the unregulated 9 V voltage on the motherboard. The LM317L adjustable regulator outputs whatever voltage is required to deliver the desired current tuned on the multiturn trimpot. Put together, the LED Tester supplies the positive voltage to the anode of the emitter(s) and the 2222A transistor switches ground on and off to the cathode of the emitter(s). What is nice about this is, I can swap out the number of LEDs and the kinds of LEDs (color, manufacturer) and be assured that the same level of current and the same frequency (38 kHz) are produced.

⑤ Zero to three emitters connected in series using removable wires with sockets on the ends. Notice the red wire (positive) coming from the LED Tester board, the black wire (ground) going to the 2222A transistor, and the two purple wires that connect the LED in the middle.

⑥ The infrared detector wires connect to the motherboard. The power supply is filtered further by a 47 µF capacitor and 47 ohm resistor. The output of the detector feeds into the 74AC14, which buffers and outputs the result to a red/green bicolor LED on the motherboard.

Not only did it save time to reuse the Roundabout circuit board, but also it provides a real-world test of performance. After all, this is the heart of the robot that actually used the PNA4602M.

If you want to learn how to make the power supply, 38 kilohertz generator, 2222A transistor driver, and bicolor LED indicator, pick up a copy of the book Intermediate Robot Building. There are several chapters dedicated to using the PNA4602M for obstacle detection, without the use of a microcontroller. Of course, now you know to use the TSOP4038 detector instead.


The test results will not be reliable if the frequency or duty cycle of the emitters is incorrect. The infrared detectors have some leeway, but show a detection distance drop in half if the frequency is off by 10 percent.

Test apparatus emitting 38 kHz with 50 percent duty cycle

Test apparatus emitting 38 kHz with around a 50 percent duty cycle

The oscilloscope trace above shows the emission frequency and duty cycle are generally accurate and clean of noise.

The final factor is the wavelength (or color) of the emission. The accuracy of the wavelength is based on the component, which in my case is the LN66A IR LED. The manufacturer specifies it has a peak of 950 nanometers. The majority of the emissions are within 920 nm to 1000 nm, which is well within the spectral sensitivity of both infrared detectors.

The test apparatus permits some flexibility with the emitters.

Wired socket connectors permit easy exchange of emitters and reduction in quantity

Wired socket connectors permit easy exchange of emitters and reduction in quantity

The detector is housed within an aluminum baffle. The emitters slide through holes to the left, right, and top. The emitters are not soldered in place, but instead they are electrically connected with wire with female crimp sockets. The long leads in the above photograph are potential RF noise sources, but were cut down to be much shorter during testing.

Instead of socket wires, I could have just as easily used alligator or test hook clips. I made the special wires for two reasons. First, I wanted to avoid a rat’s nest of probe connections since the circuit was already going to have a multimeter, an oscilloscope, and other tools connected to it. Second, I wanted the wires to stay in place when I put the test apparatus away. Not only are test hooks too expensive to sit in storage, but they have a nasty habit of popping off.

Wire with female crimp connector and heat shrink tubing insulator

Wire with female crimp connector and heat shrink tubing insulator

The custom wires are made in six steps:

  1. Cut a length of colored wire (in this case 26 AWG) and strip a bit of insulation off of the end
  2. Get a female crimp connector (in my case, the no longer available Jameco 100765)
  3. With a crimp tool, crimp the middle section around the bare wire and the lower section around the insulated wire
  4. Cut a length of colored heat shrink tubing
  5. Slide the tubing over the connector. I like to leave a little bit exposed at the top, but it is probably safer to go all the way up
  6. Using a paint-stripper heat gun (available at any hardware store), heat the tubing until it shrinks in place. The tubing is an electrical insulator (avoids short circuits) and makes the connector easier to grip.


The testing of the PNA4602M and TSOP4038 detectors was performed with a single infrared LED at 2 mA. The shades were drawn and the room lighting was turned off. This resulted in diffused noon-day ambient lighting conditions of approximately 136 lux.

I also tested with fluorescent room lighting at 200 lux, by itself and in combination with open shades (indirect sunlight) at 220 lux. Admittedly, this is still pretty dark. I guess I need to add lighting to my office.

There was a noticeable but unimportant difference based on lighting conditions. The distance measurements only varied by 1 centimeter for both infrared detectors when comparing the darkest to brightest test results. In other words, they both showed equally good ability at ignoring ambient lighting. However, it should be noted that no infrared remote control detector is going to work in direct sunlight -- the infrared signal is simply too weak compared to the sun.

There were a couple of minor deficiencies found in my setup during pretesting. Go to the next page to find out.