Transmit & Receive Infrared Signals With Your PC Serial Port using PIC12F508

Summary of Transmit & Receive Infrared Signals With Your PC Serial Port using PIC12F508


This article details a DIY infrared transceiver project for hobbyists, utilizing a PIC12F508 microcontroller to transmit and receive serial data via a PC's serial port. The system modulates a 40kHz carrier wave for transmission and uses a PNP transistor to invert the IR detector output before interfacing with the computer. While specific components are listed, the design allows for substitutions of similar parts.

Parts used in the Air-Byte IR Transceiver:

  • PIC12F508 microcontroller
  • NPN darlington transistor
  • Infrared LEDs
  • 2N3906 PNP transistor
  • IR detector module
  • Voltage regulator
  • 10K series resistor

We no longer manufacture or sell the original Air-Byte IR transceiver, so we’re releasing the code & circuit design here for hobbyists and students looking to build a simple IR transceiver.

Note that the parts used here are not critical. I.E. the NPN darlington transistor driving the infrared LEDs, PNP transistor used for inverting the IR detector output, voltage regulator, LED’s, and most every other component can be replaced by something similar. However, we do have circuit boards and a full parts kit available for those who may want them.

Air-Bytea

The code or course can easily be modified to work on any PIC microcontroller.

The brain of the Air-Byte transceiver is a tiny 8-pin PIC12F508 microcontroller. Operation is simple. The PIC simply monitors GPIO,0 connected to the PC serial port TX pin #3. When this pin transitions from logic low to logic high, the 12F508 generates the 40kHz IR carrier. During low periods the carrier is suppressed.

This provides a simple method for receiving serial data on one pin, and outputting serial data on another modulated at the IR detectors band-pass frequency. Very simple, yet very effective.

The 2N3906 PNP transistor is used to invert the IR detectors data output. During idle periods, when serial data is not being received, the PC serial port RX pin should idle low. Since the idle output logic of the IR detector is logic 1, the PNP transistor inverter circuit is required. If we were to use a MAX232 RS232 to TTL level converter IC, we could eliminate the PNP inverter circuit, and connect the IR module data output directly to the MAX232.

Most PC serial ports work fine with TTL level serial data input, so we have used the direct interface to cut costs, and reduce circuit size. The 10K series resistor in series with the PC serial port TX pin and PIC serial data input pin is to limit current. This prevents damage to the PIC input from RS232 level voltage from the PC serial port. You’ll see quite a few finished products with this simple serial interface.

For more detail: Transmit & Receive Infrared Signals With Your PC Serial Port using PIC12F508

Quick Solutions to Questions related to Air-Byte IR Transceiver:

  • Why is a PNP transistor used in this circuit?
    The 2N3906 PNP transistor inverts the IR detector output because the idle logic of the IR detector is logic 1 while the PC serial port RX pin should idle low.
  • What happens when the PIC monitors GPIO0 transitioning from low to high?
    The PIC12F508 generates the 40kHz IR carrier during these transitions.
  • Can this code work on other microcontrollers?
    Yes, the code can easily be modified to work on any PIC microcontroller.
  • How does the circuit handle serial data output?
    It outputs serial data on another pin modulated at the IR detectors band-pass frequency.
  • What is the purpose of the 10K series resistor?
    The resistor limits current between the PC serial port TX pin and the PIC input to prevent damage from RS232 level voltages.
  • Why was a direct interface used instead of a MAX232 converter?
    A direct interface was chosen because most PC serial ports work fine with TTL level data, which cuts costs and reduces circuit size.
  • Are the listed parts critical for the project?
    No, most components like the transistors and voltage regulator can be replaced by something similar.

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