38-kHz IR LED Circuit

The very first project I posted to Robot Room involved a 74HC00 NAND infrared oscillator. Nine months have passed and I’d learned a lot.

Infrared circuit lit up

Infrared circuit lit up

The power usage of my original NAND oscillator can be reduced without any loss of drive or functionality:

Even Better

I wrote this web page in March 2001. The circuit presented here is perfectly good for builder the 38 kHz emitter. However, because I get a lot of questions about infrared sensors and detectors, I decided to dedicate two chapters (11 and 12) of my second book, Intermediate Robot Building, to the subject. Therefore, if you’d like more information, including an improved schematic with receivers and detectors, pick up a copy of the book.

Usage

The oscillator will be used to generate a square wave at a desired frequency. The wave is fed into a transistor that drives an infrared LED on and off very rapidly. Because the emissions are infrared and very fast, neither is visible to the human eye.

Inexpensive infrared receiver chips are available at 36 kHz, 38 kHz, and 40 kHz. The receivers are sensitive to oscillations several kilohertz to either side, although reception distance improves with a better signal to start with.

If used for object detection, the signal needs to travel the distance to the object, bounce off the object, and then travel the distance back to the receiver. So, distance becomes a factor.

Because infrared receivers amplify the signal to improve detection, electrical noise generated from the oscillator can leak into the receiver and trigger a false detection. This isn’t a problem for VCRs or most consumer devices as they tend to contain either a transmitter (remote control) or a receiver (CD player), but not both.

Therefore, robot transmitter and receiver circuits must be carefully designed and positioned apart to be useful. Robots that chase electrical ghosts, spin in place, or jerk sporadically are initially amusing, but eventually frustrating.

The lower the power of the circuit, the more likely it will be lower in noise. Also, liberal use of decoupling capacitors and metal shielding helps a lot. Greater distance between the circuits makes an enormous difference.

The Popular 555

The 555 IC is an extremely popular timer. The low-power CMOS versions (TLC555, LMC555, and ICM7555) use less power than the older (555, NE555, LM555) versions and don’t require a capacitor on the control pin. Although pin and functionally compatible, the component values differ between the low-power CMOS and older versions.

Just for fun, I tested three different manufacturers’ CMOS 555 timers. Below are the results at 38 kHz and the prices I paid.

National Semiconductor LMC555 National Semi
LMC555
Texas Instruments TLC555 Texas Instruments
TLC555
Maxim ICM7555 Maxim
ICM7555
Oscillator current when enabled 0.651 milliamps 0.655 milliamps 0.564 milliamps
Oscillator current when disabled 0.166 milliamps 0.142 milliamps 0.078 milliamps
IC Price
(quantity one)
$0.70 $0.78 $2.49
($1.88 from Maxim)

Notice the current usage of for each of these chips is less than one milliamp!

Infrared Emitter 555 Schematic

A portion of the configuration presented here is similar to an example in the Maxim ICM7555 datasheet. In this circuit, the 555 is used in astable multivibrator mode.

Schematic of 36 kHz to 40 kHz oscillator and infrared emitter

Schematic of 36 kHz to 40 kHz oscillator and infrared emitter

Note: An improved circuit with two emitters, two detectors, and two bicolor LED indicators is Figure 11-10 on page 222 of Intermediate Robot Building.

For maximum effect, over 60 milliamps pulses through the infrared LED. Adjust R3 as appropriate for your use and LED specifications.

When calculating current through the resistor, don’t forget to first subtract the voltage drop across the LED and transistor. Let’s say the LED uses 1.8 V (1.6 V to 2.2 V wouldn’t be unheard of). Let’s say the collector-emitter drop of the transistor uses 0.2 V.

5 V (total) - 1.8 V (LED) - 0.2 V (transistor) = 3 V remaining to drop across the resistor.

3 V / 47 ohms is about 64 mA. Because there’s only one path, the current going through the resistor must be the same as what’s going through the LED.

Now for the other trick: the word "pulses". The LED is only on half the time because it is blinking. If you use an ohmmeter, the average current is 32 mA (half).

Aside: The LED heats up faster than it cools off. As such, it’s not possible to drive 100 mA through a 50 mA LED even though the average current is half. Depending on ambient temperatures, it’s usually safe to drive only 125% or 133% of rated maximum at 50% duty. With smaller duty cycles and frequent pauses, it’s possible to drive a lot more current in very short bursts.

David replies:

Hi Peter,

Good question.

I assume you’re using a decent IR detector module. For example, the Panasonic 38-kHz IC Photodetector (replaced by Vishay TSOP4038). The 4612 has a greater range than the 4602, but is usually not appropriate for robots that also emit 38-kHz IR. The emissions generate electrical noise that causes false detections. However, because your emitter and detector circuits are not connected, the 4612 would be a superior solution for you.

Don’t forget to attach a 0.1 µF capacitor directly across the power leads on the detector module. This dramatically reduces false signals.

As for the emitter portion:

  1. Obtain the datasheet for the infrared LED you’re using. Look for the angle of emission. Common IR LEDs range from 6 to 120 degrees. For remote controls, the angle is usually between 15 and 25 degrees. For an interrupter beam, you want the smallest angle you can get.
  2. Consider using several IR LEDs bunched together. This will improve range. In the 555 circuit, if you drop the R3 resistor value down, you can get a second IR LED in series for free (same current flowing through a pair of LEDs).
  3. Use lenses to focus the beam. This is how detection systems on garage door obstacle detectors achieve such range. This may not be acceptable for your application, because the detector isn’t in a fixed position.
  4. Use a laser pointer to line up the emitter and detector. Even a slight deviation can sap range. Or, instead of a laser pointer, put a light or buzzer on the detector and adjust the emitter until you receive the maximum detection. For your use, you may want to use a collecting lens on the detector only.
  5. Believe it or not, about half an amp (500 mA) pours through the infrared diode of an ordinary remote control! The trick is that the diode is on for 0.000025 seconds or less, with rests of at least that long, spelling out 13 bits before resting for 25 milliseconds or more.

    So, the LED has plenty of time to cool between bursts.If you decide to push more current through your IR LEDs, remember that the resistor (R4) on the base of the transistor needs to be lowered so that the transistor can supply more current. You'll then need to re-tune the variable resistor (R2).

Hope this helps,

David

Theoretical frequency can be calculated by:

f=1/(1.4 RC)

where f is frequency in kilohertz, R is resistance in kilohms, and C is capacitance in microfarads.

38 kilohertz = 1/(1.4 * 18.7969 kilohms * 0.001 microfarads)

Even if you could find a 18796.9 ohm resistor, it turns out the capacitance and resistance of the wiring and the wide tolerance (even at 1%) of the parts means a variable resistor (potentiometer) is a must! Also, the current being used to drive the transistor (Q1) alters the timing a bit.

Using a 1-nF (C1) [1 nF is same as 0.001 µF] capacitor and a 15-kilohm fixed resistor (R1) plus a 5-kilohm potentiometer (R2) does the trick. Not only does the potentiometer allow for hand tuning, but also the frequency can be varied from about 32 kHz up to about 42 kHz. The margin means the desired values of 36 kHz to 40 kHz should be attainable even with variations in parts and wiring.

38-kHz infrared emitter on solderless breadboard

38-kHz infrared emitter on solderless breadboard

Solderless Breadboard

There’s a slight change from the official schematic presented above. On the breadboard, the timing capacitor (C1) is connected to +5 V rather than ground. Testing indicates the same frequency, voltage range, and power consumption regardless. Still, you should use a connection to GND.

Multiturn potentiometer vs. single turn

Multiturn potentiometer vs. single turn

On the left is a multiturn potentiometer. The small brass-colored screw rotates many times to perform the same adjustment as the white single-turn dial on the right. The multiturn allows for more precise adjustments and is less prone to shift out of position. Even if it does shift, less change results because it needs to take multiple turns around.

Multiturn potentiometers are more expensive, but worth it for timing circuits.

Reduced footprint circuit with m&m’s candies to show scale 38-kHz infrared emitter with surface-mount components

Left: Reduced footprint circuit with m&m’s candies to show scale. Right: 38-kHz infrared emitter with surface-mount components

Surface Mount Components

A very small infrared circuit can be created with surface mount components. The power usage and basic functionality is the same. Theoretically the electrical noise should be reduced since through-hole leads can act as transmitter antennas.

A couple of notes:

Toothpicks, silicone adhesive, tweezers, and flux paste

Toothpicks, silicone adhesive, tweezers, and flux paste

I create my surface-mount boards at home. It’s really not difficult. You should try it!

There are a few tricks that help me...

Using a toothpick, I place a small dab of silicone adhesive (which I suspect is just caulk in a smaller, more expensive tube) on each location of the board where a surface-mount component is going to be.

As far as I can tell, silicone is pretty friendly compared to the usual nasty PCB chemicals. The package indicates the material is stable up to 400 degrees Celsius. The wet viscosity holds components in place but allows for nudging. The thickness is perfect for bridging the space between the board and slightly raised component backs.

I then deposit each component using tweezers. After five minutes or so, the components can be soldered without them moving around. If a mistake is discovered, the component can be pulled off easily, as the silicone dries to a pliable, soft, rubbery consistency.

With small components, sometimes solder bridges form and sometimes the core flux misses the mark and cold solder balls or joints form. No problem, just place some flux paste in those locations. Reheat the joints with the tip of the soldering iron and they melt to perfection.

NAND Oscillator vs. 555 Oscillator

In all three of the circuits I’ve designed over the last year, the oscillator and LED are turned off when the “disable” button is pressed. Because the IR LED is driven by a transistor in all three circuits, the frequency isn’t altered by changing the desired brightness (load).

NAND Optimized NAND CMOS 555
Number of IC pins 14 14 (one gate free) 8
Oscillator current when enabled 3 mA 1.5 mA 0.6 mA
Oscillator current when disabled 0.500 milliamps 0.050 milliamps 0.150 milliamps
IC Price
(quantity one)
$0.48 $0.40 $0.70
(LM555 $0.42)
IC Price
(quantity 1000)
$0.16 $0.11 $0.25
(LM555 $0.15)
Additional oscillator components Seven
(1 potentiometer, 2 capacitors, 4 resistors)
Six
(1 potentiometer, 2 capacitors, 3 resistors)
Four
(1 potentiometer, 2 capacitors, 1 resistor)
Duty cycle Approximately 50% Approximately 50% Approximately 50%

The cost of the NAND oscillator is lower, by as much as half. It’s also more likely you’ve got some spare NANDs lying around.

The on current used by the 555 is lower -- going as low as 0.4 mA if a 10-kilohm resistor is used to drive the transistor like the NAND circuits do.

It’s interesting to note that the low quiescent current usage of the NAND chips (as low as 1 µA) is superior to the 555 chips (30 to 100 µA). Perhaps because the NAND isn’t doing anything whereas the 555 still has a pair of voltage comparators at work.

In all cases, the pull-up resistor accounts for a large portion (50 µA or more) of the disabled power usage. If the circuit is going to connect to a microcontroller or other logic chips, then the pull-up resistor may be discarded.

Although current could be reduced further for all three circuits by using a timing capacitor in the picofarad range (rather than 1 nF), the frequency shifts considerably more when touched or even measured.

Measuring a few milliamps of current usage is a little silly in a circuit that’s going to jam 40 milliamps or more through an infrared LED.

I wish I had a way to measure electrical noise, because I suspect the 555-timer chip generates less.

Temperature and aging stability haven’t been tested.

Precision isn’t an issue, as infrared receiver chips tend to be very tolerant. Anyway, all three circuits hover within better than 200 Hz of the intended frequency.

Which Oscillator Is Better?

The 555 circuit uses less power when turned on, but the total power usage of an infrared emitter device easily overshadows any minor power-on savings in the oscillator itself.

The NAND solution is cheaper and basically as easy to construct.

Obviously my optimized NAND circuit is better than my original NAND circuit. However, I can’t say whether my 555 circuit is even better.

Since the 555 is specifically designed for timing and since it has been widely adopted, I assume there are benefits that I haven’t perceived. Most likely the ability to vary duty cycle and other versatility is the real reason the 555 is so popular.

In my quest for an improved circuit, I found yet another off-the-shelf ship that is more capable and requires fewer components for the oscillator than both the 74HC00 and 555. See Chapters 11 and 12 of Intermediate Robot Building.