Achieve simple IR-data transmission from a PC's serial port

Vishay TSOP17

Andreas Grün

EDN

Often, you need to transmit a couple of bits or bytes of data to a microcontroller without a direct cable connection. One simple way to achieve this goal is to use a widely available IR receiver, such as a TSOP17xx or similar receiver from Vishay that finds use in IR-remote-control applications, such as TVs and VCRs. These devices are easy to implement because they require no external parts. These receivers usually work with a pulsed 38-kHz carrier and include an amplifier, automatic gain control, and a demodulator.

The main problem for simple applications is building the transmitter, which requires a 38‑kHz start-stop oscillator, additional supply voltage, and modulating pulses in the millisecond and submillisecond range. These factors are difficult to control with PC operating systems. On the other hand, a PC’s serial port at a standard transmission rate of 38,400 bps can generate precise bursts of 38.4-kHz data with a simple frequency doubler and two IR LEDs (Figure 1). When transmitting bytes with an alternating zero/one pattern (hex 55), each hex-55 byte generates a burst of 18 pulses, adding the start and stop bit, and consecutive bytes can generate longer pulses.

Achieve simple IR-data transmission from a PC's serial port
Figure 1. By sending appropriate hex values to a PC’s serial port,
this circuit generates precise bursts of 38.4-kHz data.

The receiver needs pulse trains ranging from 10 to 70 pulses with approximately equal pauses between them; you can easily meet these requirements with this setup. You can generate short pauses by sending hex-0 bytes, although two pulses will transmit for each byte because of the start and stop bits. However, the receiver eliminates these pulses. Stopping the transmission for a time can generate longer pauses. You must occasionally insert longer pauses, depending on the receiver you use. You can achieve data transmission by using short and long bursts and an appropriate protocol.

The circuit in Figure 1 forms a highpass filter with the output impedance of the serial port and the capacitor. The positive pulses drive one IR LED; the negative pulses drive the other. Both should point to the receiver. PC ports usually provide a maximum current of 5 to 20 mA and a voltage of ±15 V, thus having an output resistance in the low-kilohm range. A current-limiting resistor is usually not necessary. A value of 1 to 10 nF for the capacitor works in most cases. The receiver is tolerant. You need to adjust the capacitor’s value for non-PC ports, such as the microcontroller, which have lower impedance. In practical applications, you can reliably achieve a transmission distance of 2 to 4 m with a peak LED current as low as 5 mA if you point the LEDs at the receiver. A sample program for the PC is available.

Materials on the topic

Downloads

EDN