The receiver part for this driver is described here.


Using the audio driver for transmitting.

Pros:

  • Very simple circuit.
  • No need for a kernel module.

Cons:

  • Doesn't transmit very far without an amplifier (about 3 meters when directly aiming).
  • A reasonably good sound-card is required (cheap cards might not provide enough voltage, or might not be able to output a correct 19 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:

    #!/bin/bash
    while [ true ]; do
    irw || true
    sleep 1
    done

How it works:


The audio driver can send IR signals using a (reasonably good) sound-card and a very simple circuit. It does this by modulating the data onto a sine which is half the carrier frequency (38 kHz is the default if the remote doesn't have a frequency specified). After rectification the sine becomes a full frequency carrier. 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 sound-card, 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 950 nm infra-red LEDs, R1 is a 0.25 watt resistor.

Because LEDs are diodes, they only conduct one way. Since the sound-card outputs a wave that goes both positive and negative, two LEDs are placed anti-parallel, 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 sound-card 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 sound-card, 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 sound-card and set the volume to the maximum level. Start lircd, the -d flag can be used to select the audio device and/or sample-rate, the syntax is api:device[@samplerate[:latency]] or @samplerate[:latency].

Examples:

lircd -d ALSA:default
lircd -d ALSA:default@48000
lircd -d ALSA:default@48000:0.02
lircd -d @48000
lircd -d @48000:0.05

Use irsend to test if it works.

A samplerate of 48 kHz is about the bare minimum needed to make a modulated 19 khz sine, if your soundcard supports 96 kHz, you should use that.

Choosing an audio device:

If you want to use a different soundcard, check the lircd log for lines like these:

Found input device 0 OSS:/dev/dsp
Found input device 1 OSS:/dev/dsp1
Found input device 2 ALSA:SB Audigy 1 [SB0092]: ADC Capture/Standard PCM Playback (hw:0,0)
Found input device 3 ALSA:SB Audigy 1 [SB0092]: Mic Capture (hw:0,1)
Found input device 4 ALSA:SB Audigy 1 [SB0092]: Multichannel Capture/PT Playback (hw:0,2)
Found input device 6 ALSA:HDA ATI SB: HDA Generic (hw:1,0)
Found input device 13 ALSA:spdif
Found input device 14 ALSA:default
Found output device 0 OSS:/dev/dsp
Found output device 1 OSS:/dev/dsp1
Found output device 2 ALSA:SB Audigy 1 [SB0092]: ADC Capture/Standard PCM Playback (hw:0,0)
Found output device 5 ALSA:SB Audigy 1 [SB0092]: Multichannel Playback (hw:0,3)
Found output device 6 ALSA:HDA ATI SB: HDA Generic (hw:1,0)
Found output device 7 ALSA:front
Found output device 8 ALSA:rear
Found output device 9 ALSA:center_lfe
Found output device 10 ALSA:surround41
Found output device 11 ALSA:surround50
Found output device 12 ALSA:iec958
Found output device 13 ALSA:spdif
Found output device 14 ALSA:default
Found output device 15 ALSA:dmix

Now use the string for the device you want to use after the device number as argument for the -d flag like this:
lircd -d "ALSA:HDA ATI SB: HDA Generic (hw:1,0)"

Known issues:

The audio driver uses PortAudio to interface with the sound-card, 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.

Low latency values will cause dropped audio, when this happens lines like this will be printed in the lircd log:

WARNING: Input overflow ALSA:HDA ATI SB: HDA Generic (hw:1,0)@96000:0.02
WARNING: Output underflow ALSA:HDA ATI SB: HDA Generic (hw:1,0)@96000:0.02

To prevent this you can set the niceness of lircd to -20 or increase the latency.



[LIRC homepage]
The LIRC Manual, last update: 10-June-2014