4
\$\begingroup\$

I'm currently messing around with infrared LEDs and controlling my TV and various other devices from it. I have the spec and want to write a short Python script to generate these codes, and thus turn my computer/phone into a universal IR remote. I also have a receiver LED which I can use to record signals using my sound card.

I initially decided to use the GPIO pins of my Raspberry Pi and modulate them for the required amount of time, but it turns out that there's too much context switching latency to do this. I installed a LIRC kernel module which works fine, but now I want to go further.

I want to use my line out/headphone jack to drive an infrared LED. However, I'm really not very good at EE, and I don't have the tools to check the voltages. I read on another post here that the line out generates 1.something volts, and that I need to add a resistor so it has some impedance to avoid frying the sound card, but I can't figure out the values.

My LED requires 1.5 V max, but I understand I can push more if it's only for a pulse. I'll be generating the waveforms, so is there a dB level I could generate to give me adequate power to drive the LED, but not burn it? What's the voltage of my sound card at peak level?

Thanks!

\$\endgroup\$
  • \$\begingroup\$ Your audio line out is probably not a great choice because it doesn't produce dc levels - there is a capacitor that stops dc levels hurting the speaker or headphones. Why are you not using an IO line from your RPi? \$\endgroup\$ – Andy aka Jun 8 '13 at 16:19
  • \$\begingroup\$ from the great and all knowing wiki -The reference voltage for the decibel volt (0 dBV) is 1 VRMS, which is the voltage required to produce 1 milliwatt [mW] of power across a 1 kilohm [kΩ] load.[1] The reference voltage for the decibel unloaded (0 dBu) is the voltage required to produce 1 mW of power across a 600 Ω load (approximately 0.7746 VRMS) - Don't think the output has oomph to drive an LED. \$\endgroup\$ – JIm Dearden Jun 8 '13 at 17:34
  • \$\begingroup\$ @Andyaka, as I said above, the latency is too much to generate the proper IR pulses. \$\endgroup\$ – Stavros Korokithakis Jun 8 '13 at 19:37
  • \$\begingroup\$ @JImDearden, hmm, I found this page which says it should be possible, but I did everything there and couldn't make it work, so maybe you're right... There's also a page that uses an iPhone to do it, and I've read somewhere that the iPhone produces 5V peak-to-peak, but my Galaxy Nexus couldn't make the LEDs light up either... \$\endgroup\$ – Stavros Korokithakis Jun 8 '13 at 19:39
  • 1
    \$\begingroup\$ @Andyaka Because the audio port isn't subject to kernel timings, otherwise you wouldn't be able to play any sound. \$\endgroup\$ – Stavros Korokithakis Jun 9 '13 at 17:40
8
\$\begingroup\$

Further to my comment (above) I've been thinking about how the original circuit works. The sound card outputs a 19kHz signal and we require a 38kHz signal (carrier) for the IR controller.

In the original circuit this is achieved by connecting the LEDs in parallel so each will output on the other half wave effectively doubling the frequency and hoping the output of the soundcard was enough to drive them.

The circuit I've come up with achieves the same (doubling frequency) effect using an NPN and PNP transistor. The AC signal is split between the two capacitors which isolate the DC input on each of the transistors. TR1 will not conduct on the positive half cycle. D1 limits the reverse voltage on the base emitter junction. On the negative half cylce it turns TR1 on and LED 1 should flash.

Similary TR2 is turned off by a negative half cycle but turned on by the positive, giving a 38 kHz flash rate between the two LEDs from a 19kHz input.

The input signal needs to exceed +/- 0.6V which should be possible from the sound card.

If not a third transistor at the input could be used to amplify the signal level. Software stays the same. The 3V could be taken from a couple of AA cels or a 3V button cell or the 3v3 from the pi. Current taken is about 22mA when operating. With no input everything switches off so the circuit won't require an on/off switch. enter image description here

\$\endgroup\$
  • \$\begingroup\$ This transmits a constant alternating infrared pulse at 38kHz, I can see that; but how does data get modulated onto it? \$\endgroup\$ – Andy aka Jun 9 '13 at 15:32
  • 1
    \$\begingroup\$ @Andyaka - As I understand it this is handled by the software that outputs the 19kHz signal from the sound card - it produces a series of on/off bursts of 19kHz according to the pattern required to control a device. (aleady sorted by Stavros) Sound cards would be pushed produce the 38kHz tone directly hence the need to double the frequency. In the original solution the output from the sound card was directly driving two IR LEDs connected back to back with the 19kHz signal. I'll add a little bit extra to the diagram to make this clear. \$\endgroup\$ – JIm Dearden Jun 9 '13 at 15:59
  • \$\begingroup\$ No need I understood your circuit idea completely I just didn't understand how the data was modulated. You've explained +1 \$\endgroup\$ – Andy aka Jun 9 '13 at 16:22
  • \$\begingroup\$ Oh wow, that's fantastic. Thank you very much, +1 for sheer effort. I'll try it out and see if I can make it work, thanks again! \$\endgroup\$ – Stavros Korokithakis Jun 9 '13 at 20:32
0
\$\begingroup\$

The way IR LED is driven from headphone socket is by connecting a low voltage IR LED 1.5V ish across the Left and Right outputs and the channels are driven anti-phase so the output voltage is doubled as the amplifiers operate in bridge tied load. NO ground connection is used. If you try and play stereo or mono music with IR LED connected it will not illumnate since most if not all the signal is in-phase between left and right channel.

The signal HAS to be out of phase and only one polarity will illuminate the LED.

There is no issue with DC decoupling capacitors since the IR LED is never needed to stay on continuously.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.