Mittwoch, 7. Januar 2015

Keyes IR emitter / transmitter with Arduino

Putting an IR transmitter to your Arduino is easy and gives you the power to control your TV, HiFi, Clima controls and basically everything else that has an IR receiver. To do this, signals are modulated so receiver and transmitter need to "speak the same language". The one I am covering has 38 kHz and works fine with my TV & HiFi.

Simply connect the S (Signal) from Keyes to one your Arduino PWM Pins. The default is Pin 3 on the Uno. "-" goes to ground of course.

Now just use the very powerful IRremote library from shirriff.


#include <IRremote.h>

IRsend irsend;

void setup()
{
  irsend.sendNEC(0x20dfc03f, 32); // Volume Up for my LG (42LM660S) TV
}

void loop() {
}

As you see the code is fairly easy too use. Just find out what your target devices Protocol, Code and expected Length is and you are good to go!

Btw: In case you try to see the IR emission using your smartphone. iPhones 5 and up have an IR Filter so you wont see anything with them. Took me an hour or so to figure out the problem was my iPhone and not the circuit ...