Infrared Security System - Brief Description

 

Transmitter

The transmitter uses an Atmel 90S2313 (because that is what I had). Timer 0 is set for 10 mS. When the timer expires, the Timer 0 interrupt service routine (ISR) sends about 20 cycles of 38 kHz to the IR LED. A 2N2222 NPN transistor drives the LED with around 200 mA of current. Many IR LEDs will accept 1A or more in pulsed operation.

Receiver

My receiver code runs on a 90S2313 as well. The receiver has a timer set for 30 mS. There is a timer ISR. There is an IR remote control receiver module on the INT0 (external interrupt) input of the AVR. The INT0 ISR resets the timer, so that as long as the receiver module sends a low going pulse to the AVR at least every 30 mS, the timer does not expire. If the timer expires, the Timer 0 ISR runs. This ISR puts the microcontroller in an infinite (almost) loop that sends a 4 kHz signal to a piezo element for sound output. A general purpose I/O line is also driven low for interfacing with an alarm system or relay. So how do we get out of this loop? The 4 kHz signal only lasts for 1 or 2 seconds. I use the AVR watchdog timer (WDT) to break out of the loop. During normal operation, I reset the WDT using the wdr instruction. When we enter the loop, there are no wdt instructions. So, after the WDT expires, the whole program resets. I thought this was an interesting way of creating a long timer function without much software overhead.

 

Notes of Importance

Most consumer IR remote controls for TV, VCR, etc use 950 nm IR wavelength. Most IR datacom, including IrDA, use 880 nm. Use a 950 nm LED with the Radio Shack receiver module for best results.

The transmitter may cause erratic operation of IR remote controlled devices in the same room.

The Radio Shack RC module is most sensitive to the 38 kHz carrier frequency. These modules are available from various sources in frequencies of 30, 33, 38, 40, and 56 kHz and possible others. Adjust the transmitter timing loop to give the correct frequency and best sensitivity.

I have achieved separation of over 30 feet without the use of lenses. A daylight filter and shade over the receiver help.

This application can be used for other things as well. How about IR "vision" for a robot? Or detecting presence or motion for an automatic operation. Can jam operation of IR remote controls too. Maybe one day, I'll modify this design to do data communication via the IR link or even voice.

Good Luck!

Click Here to Visit My Full AVR Page with Links to the Source Code for the Infrared Application