several different devices (like a home entertainment system), you want an LED with a wide
viewing angle. It’s also possible to compensate
for a limited viewing angle by connecting
several differently angled LEDs in parallel.
» Determine the encoding type (bi-phase,
space-width, pulse-width, etc).
» Check if there is a start pulse or sequence
of start bits.
» Figure out the timing (how long a signal
is up or down, and if appropriate, the time
to express a logical 0 or 1).
» Go to the SB-Projects knowledge base to
check whether this data matches any
existing protocols.
» Once the encoding and protocol are known,
you can readily begin translating the pulses
into logical 0s and 1s.
To then transmit the data, you need to write
a program that takes the protocol and the
signal’s bit values, and then pulses the LED
on and off appropriately. Precise instructions
depend on the IR protocol for the specific
device you’re mimicking, but Arduino source
code already exists that handles several
popular protocols.
Wavelength: IR LED datasheets will list the
wavelength at which they are brightest. IR
receivers are tuned to wavelengths between
880nm–950nm, so purchase an LED with
a wavelength value in this range.
Once you’ve built your LED circuit (Figure
G), you’ll need some way to drive IR signals
through it. Once again, we’ve created an
Arduino program and example that you can
take advantage of. The sketch TransmitIR
Signal.pde, downloadable at makeprojects.
com/v/30, takes a stream of values over
serial (you can copy and paste the values
directly from the output of our capture
program), and then emits the IR signals
with a 38kHz carrier frequency on pin 11
of the Arduino.
To change the carrier to 56kHz, simply
change the line at the top that defines the
variable OCR2A or OCRA2A. The stream of values
sent over serial represents the time between
signal transitions; for example, a stream of
500,3000,500,1000,1000 turns the signal on
for 500 microseconds, off for 3,000, back
on for 500, off for 1,000, and on for 1,000.
JUST AN IR LED AND A
MICROCONTROLLER
To start applying your new IR codec abilities, see the “Hack Your Remote” project on
page 124, which teaches any device that you
can steer with an IR remote (like a Roomba)
to autonomously follow a flashlight.
DECODING AND
ENCODING SIGNALS
The Arduino examples described here
capture and use data in a raw time mode.
The advantage of this approach is that you
can capture any signal without needing to
know its protocol. The disadvantage is that
each signal is represented by a lot of data —
consider that a raw 32-bit signal will typically
need 128 bytes of data to represent its time
data, versus 4 bytes of data if the protocol
is known.
It’s possible to decode a signal from its plot
and time data. A rough heuristic for doing so
would be to:
FURTHER READING
To aid you in your IR explorations, I’ve
compiled some resources at brainlinksystem.
com/hacking-your-remote-resource-page.
The page includes the 3 Arduino programs
in this article, suggested parts for capture/
transmit circuits, open source Eagle schematics, a layout for a sample (untested)
Arduino shield that can use the programs
I’ve created to capture and transmit, a video
of a Roomba following a flashlight, and links
to even more resources.
It’s everything you need to start your own
IR projects, so go hack that TV!
123 Follow us @make