Transmit & Receive
Infrared Signals
With Your PC Serial Port
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.
The code or course can easily be modified to work on any PIC microcontroller.
Assembled Air-Byte IR Transceiver
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.
Air-Byte Schematic
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.
Possible Applications:
Pretty much any device you're using now, that works with a wired serial connection, can be made wireless. PC to PC wireless communications. Controlling your robot from your PC. Controlling serial servo controllers from your PC, and even printing data on a serial LCD via wireless. Build just the receiver section with the IR module and PNP transistor, then connect the output to your Mini SSC-II serial servo controller or serial LCD. Control servos or your LCD direct from your PC serial port via infrared. The possibilities are endless, and it's a fun project.
The Code:
;**************************************************************** ;* Name : AIR_BYTE.ASM * ;* Author : Bruce Reynolds * ;* Notice : Copyright (c) 2007 Reynolds Electronics * ;* : All Rights Reserved * ;* Date : 9/22/2007 * ;* Version : 1.0 * ;* Notes : 40kHz carrier generator for PC IR transceiver * ;* : on Air-Byte transceiver board * ;**************************************************************** list p=12f508 ; list directive to define processor #include <p12f508.inc> ; include device specific header file errorlevel -302, -207 ; suppress useless assembler warnings __CONFIG _CP_OFF & _MCLRE_OFF & _WDT_OFF & _IntRC_OSC MOVWF OSCCAL ; load factory OSCCAL calibration value CLRF GPIO ; GPIO.1 LED drive output OFF MOVLW b'11111101' ; GPIO,0 = IR data in, GPIO,1 = IR data out TRIS GPIO ; All inputs except GPIO.1 ; If input GPIO.0=1 output 40KHz on GPIO.1 ; If input GPIO.0=0 turn OFF carrier on GPIO.1 HOLD40 ; Generates 40KHz carrier based on logic input BCF GPIO,1 ; LED = OFF BTFSS GPIO,0 ; Logic 1 turns ON carrier GOTO $-1 ; Logic 0 turns OFF carrier FREQ1 BSF GPIO,1 ;1uS LED = ON here BTFSS GPIO,0 ;2uS GOTO HOLD40 ;3uS BTFSS GPIO,0 ;4uS 2uS instruction if bit = 1 GOTO HOLD40 ;5uS NOP inserted here if bit = 0 BTFSS GPIO,0 ;6uS GOTO HOLD40 ;7uS BTFSS GPIO,0 ;8uS GOTO HOLD40 ;9uS BTFSS GPIO,0 ;10uS GOTO HOLD40 ;11uS BTFSS GPIO,0 ;12uS GOTO HOLD40 ;13uS BCF GPIO,1 ;14uS LED = OFF here BTFSS GPIO,0 ;15uS GOTO HOLD40 ;16uS BTFSS GPIO,0 ;17uS GOTO HOLD40 ;18uS BTFSS GPIO,0 ;19uS GOTO HOLD40 ;20uS BTFSS GPIO,0 ;21uS GOTO HOLD40 ;22uS BTFSC GPIO,0 ;23uS GOTO FREQ1 ;25uS, GOTO requires 2uS, 25uS total=40KHz BCF GPIO,1 ;else LED = OFF GOTO HOLD40 ;return to monitor input pin ENDFor The Full Schematic in .PDF Format Click HERE
Order a full kit of parts or circuit boards HERE
Regards,
-Bruce
Click HERE to return to