In the September 2004 issue, we showed you how to assemble
"Rudolph the Red-Nosed Reindeer". Rudolph is a simple Christmas decoration with
flashing LEDs that can play a variety of tunes, including mobile phone ring
tones. As promised, this month we assemble the infrared remote transmitter and
add the receiver components to Rudolph’s PC board.
Before we describe how to assemble the various pieces, let’s
first take a look at the basics of infrared transmission on the new
PICAXE-08M.
Infrared remote control
The PICAXE-08M includes two commands for sending and receiving
data over an infrared link. The infraout command sends data on pin 7,
whereas the infrain2 command receives data on pin 3. Data is transferred
using a simple modulation technique based on the well-documented Sony Infrared
Remote Control System (SIRCS) protocol.
Fig.1: basics of the SIRCS protocol, showing the composition of each serial transmission. A logic "1" is represented by a 1.2ms burst of the 38kHz carrier, whereas a logic "0" is represented by a shorter 0.6ms burst. Each bit is separated by a gap of 0.6ms.
The SIRCS protocol uses a 38kHz modulated infrared signal
consisting of a start bit (2.4ms) followed by 12 data bits (7 data bits and 5
device ID bits). Logic level "1" is transmitted as a 1.2 ms pulse, logic ‘0’ as
a 0.6ms pulse. Each bit is separated by a 0.6ms gap (see Fig.1).
When used within Sony production devices, the 5 device ID bits
represent the type of equipment (1 = TV, 2 = video, 26 = DVD, etc). The 7 data
bits represent different commands (1 = channel 2, 2 = channel 3, 16 = channel
up, 20 = mute, etc). Within this PICAXE project the Sony-allocated commands are
not relevant, but a full list is provided in the PICAXE manual for those
interested in controlling their own Sony hardware!
Sending data
To transmit infrared data, the PICAXE command is:
infraout device,data
For example, to send the Sony command "TV - mute", the command
would be infraout 1,20. Note that device should always be 1
when used in PICAXE projects and data can only be between 0 and 127, as
the SIRCS protocol only specifies 7-bit capability.
The full program for the transmitter is shown in Fig.6. As
infrared signals are easily corrupted, the data is actually sent 10 times to
increase reliability. This matches commercial remote controls that tend to
transmit the data at 45ms intervals whilst the button is held down.
Note that the program uses codes "1", "2" and "3" for the three
switches, but you can edit these to any number between 0 and 127. This would be
useful when you want to control multiple units in the same room, using different
data commands for each unit.
Building the transmitter
As hinted at in September, the various tunes played by Rudolph
can be triggered remotely using an infrared transmitter. This simple project
uses a PICAXE-08M micro, three push-button switches and an infrared LED to make
a complete hand-held remote, the circuit for which appears in Fig.2. A second
visible LED is included for user feedback.
Fig.2: circuit diagram for the simple infrared transmitter. As no serial link socket is provided, the PICAXE chip must first be plugged into the "Rudolph" PC board (described in September 2004) for programming.
Assembly is very straightforward and should only take a few
minutes. Begin by installing a wire link in the position indicated by a dotted
line on the overlay diagram (Fig.3). An off-cut resistor leg is ideal for the
job. Note that as an IC socket will be mounted over the link, it must be lying
flat on the PC board before soldering.