Using the audio driver for transmitting.


Very simple circuit.
No need for a kernel module.


Doesn't transmit very far without an amplifier (about 3 meters when directly aiming).
A reasonably good soundcard is required (cheap cards might not provide enough voltage, or might not be able to output a correct 18 kHz sine).

It takes some time to set up (50 ms or so) so when no clients are connected to lircd the first transmission will have some higher latency.
A workaround for this is to keep irw running with a bash script like this:

while [ true ]; do
irw || true
sleep 1

How it works:

The audio driver can send IR signals using a (reasonably good) soundcard and a very simple circuit.
It does this by outputting a 18 kHz sine, which after rectification becomes a 36 kHz carrier wave.
The wave is inverted on the right channel, so the left and right channels can be used to double the voltage.

The top wave is how the wave looks when it comes out the soundcard,
the bottom wave is how it looks after rectification, as you can see the frequency is doubled.

The rectification is done using the following circuit:

LED1 and LED2 are 950nm infrared leds, R1 is a 0.25 watt resistor.

Because leds are diodes, they only conduct one way.
Since the soundcard outputs a wave that goes both positive and negative, two leds are placed antiparallel,
that way infrared is emitted on both the positive and negative cycles.

R1 is used to limit the current, this presents a load to the soundcard that is roughly the same as a pair of 32 ohms headphones.
To make the transmission more powerful, you can try lowering the value of R1 (or just short it out),
but this might damage your soundcard, the leds, or both. So try at your own risk!

Another way to make the transmission more powerful is to use a small speaker amplifier (5 watts or less),
in this case a 5 watt resistor should be used for safety. The volume should be adjusted so that the amplifier outputs its full voltage without clipping.

Setting up:

Compile lirc with the audio driver (not the IR diode or alsa ones) and install it as usual.
Connect the circuit to the soundcard and set the volume to the maximum level.
Start lircd, the -d flag can be used to select the audio device and/or samplerate, the syntax is api:device[@samplerate] or @samplerate.

lircd -d ALSA:default
lircd -d ALSA:default@48000
lircd -d @48000.

Use irsend to test if it works.

Known issues:

The audio driver uses portaudio to interface with the soundcard, there seems to be a bug in some later versions
that makes portaudio hang completely, lircd becomes unresponsive and you have to kill it with killall -9 lircd.
To get around this use the portaudio stable release from December 7, 2007.