Easy infrared UART data link

Posted on Wednesday, August 26th, 2009 in data transfer, techniques by Ian

Here’s an easy way to transfer data with an infrared LED and an infrared remote control demodulator. The example uses an Arduino, but the technique will work with any microcontroller.


The transmitting microcontroller powers an IR LED from a pin configured as a 38KHz pulse-width modulator. Another pin configured as a 2400bps UART switches the IR LED ground pin on and off. This converts the standard UART output into a train of rapidly-blinking light pulses.

The receiver is an IR remote control demodulator connected to a 2400bps UART input pin. The demodulator is specially tuned to detect IR light pulses at 38KHz. It converts the transmission back into a 2400bps UART bitstream.

How would you use a line of sight data link?

Via Make.

This entry was posted on Wednesday, August 26th, 2009 at 4:00 pm and is filed under data transfer, techniques. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

3 Responses to “Easy infrared UART data link”

  1. genn says:

    My IR detector is receiving some garbage values continuously. How to avoid this

    • IP says:

      Although the receiver should be fairly immune to ambient light, this might be your problem. Since this noise comes in as DC, and you are looking for a pulsed signal, you can AC couple your receiver with a capacitor on the ‘out’ pin. Something ~0.1uF will give you an impedance of ~41ohms to a 38KHz signal.

      The output of this receiver is an internally pulled up connector, so a 41ohm output impedance shouldn’t do much of anything in terms of attenuation if you are driving an Arduino or some other MCU…

      Hope this helps!

    • dakini says:

      Exactly… This is what i am also getting. How did you resolve it Sir???

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recent Comments

  • KH: After reading all the comments, I have questions: Does this mean STM32 and AVR boards/parts from dodgy online sellers are suspect? What are your opinions?...
  • Sjaak: They are available with more flash then their ST counterparts which makes them more interesting. You don't have to port the code, but use another...
  • Sjaak: I dunno if you can 'license' register definitions, but I'm not a lawyer. Since the chip is available since 2015 and I haven't heard of...
  • Sjaak: They can be found on taobao or the Chinese markets in Shenzhen.
  • KH: I've been a really good boy, I only buy MCU parts from RS and Farnell. :-)