Instructables

How to Use IR Remotes with Arduino (Current and Updated!!!)

Picture of How to Use IR Remotes with Arduino (Current and Updated!!!)

I'm tired of these complicated tutorials on how to use certain things. I like simple, easy to understand, step by step instructions. My biggest problem was with IR and POV*. I've finally mastered how to control my project with any TV remote in a few minutes. In this i'ble I'm going to show you simple, step by step instructions on how to control just about anything with your IR remote.

By the way this tutorial is new and updated and works! Last update [ 8/1/13 ]


Now I've never tested this process on a windows but I know
that it works on a mac. It should be the same for windows, just delete any mac content in the zip.

 
Remove these adsRemove these ads by Signing Up

Step 1: Ingredients:

Electronics:
  • Arduino
  • Any IR remote
  • IR receiver
  • Breadboard
  • Jumper Cables
  • LED

And here is the Make-To-Learn contest questions! - don't forget to vote!

What did you make?
Well I didn't make anything specific in this instructable but it is more of a guide to how to make your other projects 'wireless'.
My projects works by taking TV remotes and other remotes, converting their signals to numbers, and using them.
How did you make it?
I've been working on trying to use IR remotes. All the tutorials I found didn't really put the all the bits and pieces together for me. My main goal was to make an easy tutorial for others to follow.
Where did you make it?
At my computer. I am now able to control my robots and other stuff, like lights and lighting. For instance, I could make it so that whenever I hit the play button on my DVD player remote, the lights in the room dim, or go out.
What did you learn?
My biggest challenge was finding a IR decoder that worked, and then finding installing the proper library.

Step 2: Downloads

Here is the link to all the downloads in this instructable.
(Sorry for some odd reason the link won't work so just copy and paste it in your browser)

http://www.mediafire.com/download/cv0r5191fvtq0y2/IR_I'ble_Package.zip

1-40 of 118Next »
nreahal made it!5 months ago

Sir,

I am very thankful for your help by these tutorials. I have just received my Arduino NANO in the afternoon and at 9 i have completed my very first Arduino project "led control using ir remote", thanks to your amazing tutorial. In the following images i have been trying to show that when i press volume up it will switch ' on ' the right LED and when i press the volume down button it will switch ' off ' the LED and same has been done to the right one using program up and down of the ir remote.
Thank you once again,
regards

Nishant(INDIA)

:)

20140524_213404.jpg20140524_213431.jpg20140524_213441.jpg20140524_213913.jpg20140524_213922.jpg
FoamboardRC (author)  nreahal1 month ago

Sweet man! Good job! Keep up the good work!

I have made my mom's room room automated. Now its time for the other room you are awesome ;) :) :). Blessings from my mom too. you are awesome :)

FoamboardRC (author)  nreahal1 month ago

Wow thanks! That is soo cool! I keep on telling myself that I should hook up my light and my fan and outlets to IR, but I'm too lazy to get around to it! Good luck!

dankaraji1 month ago

hey man...your instructions were amazing..i finally understood how the whole remote thing works

i have a question though..im actually trying to use the remote control to communicate with my computer keyboard..

i mean for example if i press one button on the remote it would work as if is pressed lets say button (F) on my computer

im new with arduino so i would really appreciate your help...

FoamboardRC (author)  dankaraji27 days ago
Unfortunately dank, I can't help you with that. Ask in the forums. Communication over a USB port is not my area

hello,

this is amazing, really helpfull. but now i got a question. am i able to keep an output high until i realease the button? because every butten gives after the first code the same code if you keep it pressed?

maybe a stupid question, but im a beginner in arduino :P

thank you,

FoamboardRC (author)  Mistercrazyboy21.1 month ago

Hey man! No, the only dumb question is the one not asked.

The first little bit of code I gave works as a toggle, so it stays on. Once you press the button that same pin will stay high until you press it again. Follow the link below. Is that what you wanted?

http://www.mediafire.com/view/hmv13ynbihed0eg/Test_LED.ino

hey man,

thanks a lot for the code, but it isnt really what im looking for, because i would like to power a motor and when i press the button the motor runs and when i release the button the motor stops running.

thanks a lot for the quick response :D

FoamboardRC (author)  Mistercrazyboy21.1 month ago

Oh I gotcha! Okaydokey, give me a minute to think. . . when you hold down your remote button does it give you a continues value that repeats itself like the one shown in the image of step 5?

What I'm trying to say is when you hold down the button, in the serial monitor, you see an initial number, then another number that repeats itself like this:

16753245
4294967295
4294967295
4294967295

In that case give me a day and I'll cook up some code for you.

okey, no problem. take your time. its amazing that you repeat that quickly and are this motivated to help people. so take your time. compliments for you!

FoamboardRC (author)  Mistercrazyboy21.1 month ago

And thank you very much, I love helping out where I can.

GRRR. . . I spent 2 hours trying to get this code to work, but I can't seem to nail it down! :(

Try asking it in the forums. I can't really get it to work. I got close, but not close enough. Your motor would be pulsing with my code :D

I'll try again after I finish school, but . . . I dunno! It seams so simple!


KevinAI1 month ago

Ok I have been trying every IR Library available and I dont seem to make any work. All I get in the serial monitor is zeros each time I press a button on my remote. My Devices are U-verse box, and Samsung TV

Kevin

FoamboardRC (author)  KevinAI1 month ago

If you've tried all the libraries it's time to start looking for a hardware problem. Check wiring, your Arduino, and try another receiver.

matys2922 months ago

Hello, i have tryed more than 5 remotes and on all im getting numbers everytime i press changed. I tryed on low budget remotes and on expensive one too but same story.. My number is not stable at all :S Please help me

FoamboardRC (author)  matys2921 month ago

Hmm... I would check you wiring, and most definitely your IR receiver. Try a new one and make sure the pinout is correct. They can be tricky at times.

elisegc1 month ago

So helpful. Thank you!

FoamboardRC (author)  elisegc1 month ago
Glad I could help!
steinie447 months ago

The fix:

irrecv.resume(); // Receive the next value

belongs at the end if the

if (irrecv.decode(&results))

here is a example:

[code]
/*
DVR IR Receiver 03 March 2014 JDS
* See: http://www.instructables.com/id/The-Easiest-Way-to-Use-Any-IR-Remote-with-Ardiuno/?ALLSTEPS

The IR sensor's pins are attached to Arduino as so:
Pin 1 to Vout (pin 11 on Arduino)
Pin 2 to GND
Pin 3 to Vcc (+5v from Arduino)
*/

#include <IRremote.h>

int IRpin = 11; // pin for the IR sensor
int LED = 13; // LED pin
IRrecv irrecv(IRpin);
decode_results results;

boolean LEDon = true; // initializing LEDon as true

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
pinMode(LED, OUTPUT);
}

void loop()
{
digitalWrite(LED, LOW);
if (irrecv.decode(&results))
{

// irrecv.resume(); // Receive the next value


switch(results.value)
{
case 16720350:
Serial.println("MULT");
break;

case 16763190:
Serial.println("POWER");
break;

case 16716270:
Serial.println("SEARCH");
break;

case 16714230:
Serial.println("|<");
break;

case 16718310:
Serial.println("||<");
break;

case 16724430:
Serial.println("|>");
break;

case 16728510:
Serial.println(">||");
break;

case 16726470:
Serial.println(">>");
break;

case 16761150:
Serial.println(">|");
break;

case 16771350:
Serial.println("ADD");
break;

case 16746870:
Serial.println("FN");
break;

case 16742790:
Serial.println("MENU");
break;

case 16767270:
Serial.println("Left");
break;

case 16750950:
Serial.println("Right");
break;

case 16755030:
Serial.println("Up");
break;

case 16734630:
Serial.println("Down");
break;

case 16769310:
Serial.println("1");
break;

case 16736670:
Serial.println("2");
break;

case 16752990:
Serial.println("3");
break;

case 16765230:
Serial.println("4");
break;

case 16732590:
Serial.println("5");
break;

case 16748910:
Serial.println("6");
break;

case 16773390:
Serial.println("7");
break;

case 16740750:
Serial.println("8");
break;

case 16757070:
Serial.println("9");
break;

case 16730550:
Serial.println("0");
break;

case 16738710:
Serial.println("ESC");
break;

case 16722390:
Serial.println("-/--");
break;

default:
digitalWrite(LED, HIGH);

}
irrecv.resume(); // Receive the next value
}

}


[/code]

This really helped me. It seems that this solution was overlooked by many other of the posters as it seems this would have helped anyone who had those "stuck"in a loop issues as if your button is being continuously pressed.

Perhaps people don't easily see the change because your example is quite long. :-) anyway, thank man. It really helped me out. Cheers

I meant "many of the other" posters. ;-)

and "thanks" man. Damn you autocorrect!

gsingh242 months ago
AmitC2 months ago

Easy and Simple....very useful ***** five starts

Amr Elsayed3 months ago

can you upload any video to show me how do it practical

kshowell4 months ago

Very helpful Instructable, Thank You

FoamboardRC (author)  kshowell4 months ago
Glad you understood! Yup!
filip_os4 months ago

HI FoamboardRC, i found bug (i guess). I am controlling LED with remote controller with PWM, and i realized something weird. PWM pins 3,5,6,9 and 10 are working OK but pin 11 is not working. If i set value between 0-255 programs stops, and pin gets value 0. Is the problem in the library?

Can you help me with this problem. Than you in advance !

FoamboardRC (author)  filip_os4 months ago

Hey! Sorry I thought I had already replied to this! Sorry! Anyways is it something to do with your Arduino? Try making a standard fade program using PWM and see how that works, and get back with me.

omnacron4 months ago

hello im having a little trouble with trying to get the codes off of my dishnetwork remote. i have everything hooked up correctly and i tested the IR receiver to make sure it work after hours of searching and frustration i finaly found a library and sketch that didnt have errors. but nothing comes up on my serial window i know the remote and the receiver works. any help would be accepted thank yhou

FoamboardRC (author)  omnacron4 months ago

Why don't you give me a link to your code or PM me it and let me check it out?

jhong23884 months ago

can u help me with codes i want to control my servo using ir?

FoamboardRC (author)  jhong23884 months ago
How do you want to control it? Explain. Do you want on button to make it go by increments or you press a button and it assumes a degree of rotation.
kannanravi284 months ago
I am using remote as just like , you have suggested in Spark fun . everything works fine. But if I use ususal TV remote , and press the button , I get continuously same value. First and second numbers are same and it continuous. How to solve this?
FoamboardRC (author)  kannanravi284 months ago

Well then what's the problem? If you get the same number over and over then it'll just repeat the command like it should!

kannanravi284 months ago
I am using remote as just like , you have suggested in Spark fun . everything works fine. But if I use ususal TV remote , and press the button , I get continuously same value. First and second numbers are same and it continuous. How to solve this?
shinystuff5 months ago

Thank you for this tutorial. It really helped me to understand how to work with IR receivers. Very well done! I

FoamboardRC (author)  shinystuff5 months ago

Glad I could help!

kminton38 months ago

I cant get the switch cases to work like the last LED test the LED just stays on and shuts off for a brief moment when i press a remote button heres the code:

#include <IRremote.h>

int IRpin = 11; // pin for the IR sensor

int LED = 13; // LED pin

IRrecv irrecv(IRpin);

decode_results results;

boolean LEDon = true; // initializing LEDon as true

void setup()

{

Serial.begin(9600);

irrecv.enableIRIn(); // Start the receiver

pinMode(LED, OUTPUT);

}

void loop()

{

if (irrecv.decode(&results))

{

irrecv.resume(); // Receive the next value

}

switch(results.value)

{

case 1637875967:

if (LEDon == true) // is LEDon equal to true?

{

LEDon = false;

digitalWrite(LED, HIGH);

delay(100); // keeps the transistion smooth

}

else

{

LEDon = true;

digitalWrite(LED, LOW);

delay(100);

}

FoamboardRC (author)  kminton35 months ago

You are missing all the break statements. add break; at the end of every case statement.

1-40 of 118Next »