PICAXE - Infrared Transmitter, 38, 40 and 56 kHz


Introduction.

This is a design which provides a source of a 38, 40 or 56 kHz square wave on output OUT when input GATE is high. When GATE is low, the output is low. A inversion of the output (/OUT) is also available which may be used with a visible LED to assure the unit is operating properly.

The intent of this design is for controlling an infrared signal as outlined in my application note Object Detection using 38 kHz Pulsed Infrared. However, use of this external PIC frees up the PICAXE PWM module and associated timer for other applications. It may also be used with PICAXE's which do not have a PWM module.

The design is implemented using a PIC12F675 or similar 8-pin DIP. The internal RC clock is used which limits the component count to simply a 10K pullup resistor on the /MCLR terminal, and of course the infrared LED and possibly an external transistor driver.

In my discussion of Object Detection, I used the PICAXE PWM module However, the "servo" command also uses the same timer (TIMER2) as that used to control the PWM module and of course, in implementing the 38 kHz source using the PWM module, the PWM module is not available for other applications. This external Infrared Transmitter alleviates these problems.

Detailed Discussion

The frequency is determined by straps on inputs F1 and F0;

   F1     F0           Frequency

   Open   Open         38 kHz
   Open   GRD          40 kHz
   GRD    Open         56 kHz
   GRD    GRD          38 kHz

Note that the straps which determine the frequency is only read when the IR Transmitter is booted, either by applying power or by momentarily grounding the /MCLR input. The PIC then continually reads the Gate input and outputs the appropriate frequency as long as the Gate Input is at a logic one. The state of input GATE is read every period of the burst. Thus, when using 40 KHz, the maximum time to respond to a change on the GATE input is 25 usecs.

When a PICAXE (or any PIC) boots, all outputs are initially at a high impedance prior to assuming a logic zero output state. This momentary high impedance state may be interpreted as a brief logic one on the GATE input of the IR transmitter. If this is a problem, use a pulldown resistor (4.7K to 100K) to ground on the GATE input.

Assembly and Testing

Assemble as shown in Figure #1.

Note that inputs F1 and F0 are open. The design uses internal pullup resistors and thus this is read by the processor as 1 1.

A visible red 5V LED is provided with kit. It is important to note that a 330 (or similar) series resistor is required when using conventional LEDs, including infrared LEDs and failure to use the series resistor will cause the PIC output to fail. This LED incorporates the limiting resistor in the LED package and an external resistor is not required.

Connect the visible LED to the OUT terminal as shown.

Verify that the state of the test LED follows the state of the GATE input. That is, when GATE is at a logic one, the LED will appear to be on. Actually, it is turning on and off at 38 kHz as the duty cycle is 50 percent, the LED is noticeably dimmer than when it is fully on. When the GATE input is at GRD, the LED will be off.

Content of the Kit

The kit includes a programmed 8-terminal PIC, two 10K resistors (pullup to +5 VDC for /MCLR and pulldown to GRD for the GATE input) and a 5VDC visible red LED.

Schematics to compliment this discussion are also provided.

The kit is $3.00.


The following is a revision of the code in my "Object Detection using Pulsed 38 kHz" discussion which may be used with the external IR transmitter.

' IR_2.Bas
'
' copyright, Peter H Anderson, Baltimore, MD, May, '04

     Symbol Gate = 0	' use any output pin


Main:

     High Gate	' turn on IR
     Pause 3

     If Pin0 = 1 Then BeamBroken
     ' else
     Pin0 = 0 ' turn off LED
     GoTo Main_1

BeamBroken:
     Pin0 = 1  ' turn on LED

Main_1:
     Low Gate
     Pause 100
     GoTo Main