This circuit receives the signal from a IR remote control, like those used to control your TV or DVD player and allows the signal to be repeated in another location.
To get a 40Khz carrier requires an output to be toggled on and off 40,000 times a second, which means the code needs to execute in 1,000,000/40,000 instruction cycles; this gives a very tight 25 instructions in which to do the job. Fortunately it’s an easy job to do so most of the instructions are just used to waste cycles. It’s not easy to get an accurate frequency with so little time and few instructions cycles to play with but the IR receivers will work several Khz either side of their design detection frequency so it’s not a problem.
This code can generate a 40Khz, 38.4Khz or 37Khz carrier with a ~15% duty cycle. The frequencies are configurable in the source code such that once programmed GPIO5 input on the PIC allows the selection of two frequencies. By default the code is set to produce 40Khz and 37Khz carriers which are modulated by the logic level on GPIO2. This would generally be connected to a IR decoder IC.
One thing I did find with the Sony equipment (I haven’t tested it with anything else), 875nM IR LEDs don’t seem to work, but the 950nM one specified works well. (TSUS5400, Mfg Vishay. Available from Farnell, part number 178302)
- Source Code (supports 12F629, 12F675, 12F683 21/06/2009)
- Hex (right-click Save As) for 12F675 / 12F629.
- Hex (right-click Save As) for 12F683
For more detail: IR Remote Control Repeater using PIC12F629