RS232 – Infra-Red Interface

Summary of RS232 – Infra-Red Interface


This project uses a Microchip PIC microcontroller to bridge a TTL-level RS232 serial interface and a 38 kHz infra-red (IR) receive/transmit interface, allowing capture or emulation of IR remote control bit sequences. The design uses through-hole components on stripboard, a TSOP1738 IR receiver module, a driven IR LED with a transistor and capacitor for adequate current, and assembler PIC firmware including RS232 and IR library functions. Documentation and code, including circuit and layout diagrams and example programs, are available for download.

Parts used in the RS232 - Infra-Red Interface:

  • Microchip PIC microcontroller (DIL package)
  • RS232 connector (TTL-level signals)
  • TSOP1738 Infra-Red receiver module
  • Infra-Red LED (for transmit)
  • Transistor (IR LED driver switch)
  • Decoupling capacitor (for PIC)
  • Capacitor for IR LED drive current
  • Small red indicator LED (shows IR LED operating)
  • Diode (part of ICSP)
  • Resistor (part of ICSP)
  • ICSP socket
  • Stripboard (prototype PCB)
  • Miscellaneous passive components (additional resistors as required)

Description

This project is a Microchip PIC microcontroller with an RS232 serial interface on one side and an Infra-Red receive and transmit interface on the other.

Important – All mention of RS232 on this page actually refers to RS232 waveforms operating at 5V TTL levels not +/-12V levels which would destroy the PIC device. An appropriate converter between the two must be used.RS232 - Infra-Red Interface

By sending commands on the RS232 interface it is possible to receive or transmit a sequence of bits modulated as a series of on/off states in a 38 kHz infra-red carrier signal. Infra-Red remote controls use a carrier signal (typically around 38 kHz) so that there is no confusion with sunlight etc. The carrier is turned on and off to represent the bit sequences at a lower rate, for example 500 Hz).

Either a raw sequence of on/off states can be captured or transmitted or one of a predefined set of remote control formats can be emulated (receive or transmit).

The circuit is built on stripboard with a DIL packaged IC and conventional through-hole passive components. The PCB is glued into the base of a small box for convenience.

The PIC microcontroller is the only IC and mounted approximately in the centre of the PCB. The RS232 connector is on the right with the Infra-Red receiver and LED for transmit on the top. Rather than use a photo-diode and decoding the signal a complete module (in this case a TSOP1738 photo module) is used. This contains all of the circuitry to detect a signal with a carrier frequency of 38 kHz.

PIC Software

The PIC software is written in assembler and this project was the development platform for the Infra-Red library functions.

The complete information for this project is available for download. This includes the library functions for the RS232 and IR interfaces as well as the circuit diagram, layout diagram and various C programs. This project is included in the library of PIC code that is available for download.RS232 - Infra-Red Interface schematic.jpg

The circuit diagram is quite simple with the RS232 interface (a connector), PIC (IC and decoupling capacitor) and ICSP (socket, 1 diode and 1 resistor). For the Infra-Red part it is more complicated. There is a transistor (operating as a switch) and a capacitor to ensure that sufficient current can be switched to drive the LED. Driving the LED with the PIC alone would not allow enough current to transmit a strong Infra-Red signal. There is also a small red LED to show when the Infra-Red one is operating.

This simple PCB layout diagram shows the placement of the components on the stripboard. The view is from the top of the PCB, the same as in the photograph.

 

 

For more detail: RS232 – Infra-Red Interface

Quick Solutions to Questions related to RS232 - Infra-Red Interface:

  • Does the RS232 interface use +/-12V levels?
    No, all mention of RS232 on this page refers to RS232 waveforms operating at 5V TTL levels; a converter is required for +/-12V RS232.
  • What carrier frequency does the IR interface use?
    The IR interface uses a 38 kHz carrier signal.
  • Can the device capture raw IR on/off sequences?
    Yes, by sending commands on the RS232 interface it is possible to receive a raw sequence of on/off states.
  • Can the device emulate predefined remote control formats?
    Yes, it can emulate one of a predefined set of remote control formats for receive or transmit.
  • What module is used for IR reception?
    A TSOP1738 photo module is used for IR reception.
  • Why is a transistor used for driving the IR LED?
    A transistor and capacitor are used so sufficient current can be switched to drive a strong IR LED signal; the PIC alone cannot supply enough current.
  • Where is the PIC mounted on the PCB?
    The PIC is mounted approximately in the centre of the stripboard PCB.
  • Is the PIC software available?
    Yes, the PIC software, RS232 and IR library functions, circuit diagram, layout, and example programs are available for download.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter