The Lucas Eckels Blog

Sunday, August 23, 2009

Arduino IR transmitter

A while back, I bought a universal remote for the entertainment system. I chose one fancy enough to have learning capability, but not fancy enough to be programmed with a computer.

Annoyingly, the factory and universal remote only had a button to toggle through the various inputs. This gets tedious quickly when you have a few video game consoles. I knew that the TV had discrete codes, which would take you directly to a selected input. But I didn’t have a way to program the remote with these codes.

So I wrote an IR transmitter for Arduino. Then I could use the Arduino to program the remote, and have nice discrete component access straight from the remote that I’m already using. My TV is a Samsung, which uses the . It’s a pretty simple protocol consisting of two address bytes and two command bytes, with a 9 ms burst ahead of it. Ones and zeros are encoded as different pauses after a short burst at 38 kHz. My previous IR project was very helpful for debugging timing issues.

Download the code. The only hardware required is an IR LED attached to pin 13.

posted by Lucas at 7:22 pm  

1 Comment »

  1. A few comments that might help others who look at this…

    This program needs you to key in the OBC codes (in the serial monitor). At first I was typing in the EFC codes that OFA remotes use. They won’t work here.

    Here are the OBC codes for the more useful functions that don’t appear on any keys on your original Samsung TV remote:

    Discrete ON 153
    Discrete OFF 152
    Component 1 134
    Component 2 136
    HDMI 1 233
    HDMI 2 190
    HDMI 3 194
    PC 105
    AV 1 133
    AV 2 237

    These worked on my model LN-Txx61F Samsung TV. Its device code was also 7 like the program has it, but yours might be different. You might run Lucas’ IRMON sketch to find out what it is.

    I had luck programming my learning remote by transmitting the code just once (leaving CONTINUOUS undefined). YMMV. I’m not sure if Samsung complies with the special repeat code in the NEC protocol for when you hold down a key, but this program doesn’t do repeats the NEC way.

    I also moved the IR LED from pin 13 to 2 so I could use a smaller resistor and get a more powerful signal. In the modulate() function, I used PORTD and a mask of 0×04 to control pin 2.

    Note that the NEC protocol specifies that ON_START_TIME is 9000, but Samsung deviates from this and uses 4500.

    Many thanks, Lucas.

    Comment by Glenn — January 31, 2010 @ 9:35 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress