
Parallax, Inc. • IR Buddy Demo Kit (#28016) • 11/2002
Page 10
IR Buddy Application: Intelligent Beam-Break Detection
This application uses two IR Buddies and a BASIC Stamp to form an intelligent IR beam-break detector as
might be used in an alarm system. The first IR Buddy sends a coded message to the second. If the
second does not receive the message properly, an error is generated. If enough errors accumulate, an
alarm output in enabled. Performance can be improved by shielding the IR Buddies from extraneous IR
sources.
The use of the error accumulator allows the system to work in and be fine-tuned for IR-noisy
environments. The use of random coded message prevents defeat – even from a duplicate circuit
because the extreme difficulty of synchronizing the counterfeit circuit with transmit IR Buddy.
' -----[ Title ]----------------------------------------------------------------
'
' IRB Beam Break.BS2
' {$STAMP BS2}
' -----[ I/O Definitions ]------------------------------------------------------
IRbTX CON 15 ' transmitter IRB
IRbRX CON 14 ' receiver IRB
AlarmLED CON 0
' -----[ Constants ]------------------------------------------------------------
IRbRc5Tx CON $74 ' RC-5 protocol TX
IRbRc5Rx CON $72 ' RC-5 protocol RX
IRbMod CON 38 ' modulation freq: 30, 38 or 56
IRb96 CON 84 + $8000 ' 9600 baud, open
IRb48 CON 188 + $8000 ' 4800 baud, open
IRb24 CON 396 + $8000 ' 2400 baud, open
IRbBaud CON IRb96