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 [ 03/31/2015 ]

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.


With the latest release of the Arduino IDE there is a conflicting library that renders this tutorial void. If you'd still like to use this tutorial delete the library called "RobotIRemote". This file will be in the Arduino program.

This library is for a specific robot shield that Arduino/venders sell. Unless you intend on buying that shield you can delete that folder and continue with this set of instructions. You can always download it again later!

Step 1: Ingredients:


  • 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.

<p>This was SOO much better than Adafruits tutorial that has massive arrays you have to capture and then use for each button. Normally they have the BEST stuff for easy understanding. HOWEVER this was by FAR the easiest for my remotes!! The library is about twice the size of the ada one BUT this is so much better I will take the loss on Flash for this ease!! :) <br>I only have one small glitch and it may just have to do with the remote I'm using BUT, if you click the remote too fast the read code loops forever. So the led just flashes all on it's own, until you do a long press on the remote. Again not sure if this is all remotes or just the one I chose. But I plan on adding this to my daughters Tiara project seen below. I want to cram a small tiny remote into a cheap wand, so the wand will control the Crown / Tiara.. Thanks AGAIN!! ~Steve~<iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/qCLX8vt_f0o" width="500"></iframe></p>
Hey thanks so much! I'm really glad that I was able to help you out!<br><br>Yeah actually it does the same thing for everyone. That was the main complaint I got because of the looping- it's not my library!<br><br>The fix is really simple, after the if statement {<br> if (results.value == X) }<br>add a small delay, like { delay(25); }. <br><br>This worked for me to keep it out of the loop, but don't put the delay too high. I forgot the actual milliseconds I used to fix it. If you go too high then sometimes when you press the button at the same time the arduino is frozen because of the delay. If you go too low then it doesn't fix the loop problem. Experiment, you'll get it. <br><br>And very nice project BTW! <br><br>Instead of cramming a remote into a wand you should just send a signal using an ATtiny85/45/44/24/ and the send feature of IR library. <br><br>I'm still here if you need any help with the IR part. . . :D
<p>hi i used:</p><p>results.value=0;</p><p>on the beginning of the void loop... fixed it for me :)</p>
<p>After beating my head against the wall for 20 mins trying to solve the flashing with the delay (Which I could not get to work) I found the PERFECT solution that works 100% everytime Change this line to:</p><p>if (results.value == 16236607) {results.value = 0; //Do something here}<br>By resetting the &quot;results&quot; back to 0 it cures the looping, because it can't &quot;see&quot; the correct value again until it gets the real code again from the sensor.<br>Thanks again you may want to update the code you shared with this correction and the problem is gone for good :) </p>
<p>Duuude of course! I can't believe I didn't think of that! I never actually used the code (like in a project) other than testing it briefly for the i'ble. I'll go back and change it. Thanks! You could get really fancy and go with an ATtiny13-20SU. I just got a shipment of 20 in the mail! :D</p>
<p>Awesome thanks for the hints!! <br>Yeah no clue why I didn't think of just using the ATTiny!?!?!?! Perfect Idea!!!</p>
<p>Really Good Tutorial here bro. Finally made the IR sensor work! :D</p><p>But for some reasons, many of the links are not working properly. If would be awesome if you could fix those. </p><p>Anyway, Thanks for this! Really appreciate it as a beginner with Arduino! :)</p>
Thanks! I'm not sure what you are talking about the links though. I just went through and checked all of them and they are all working. Maybe you might just have to copy the address and paste it in your browser's address bar.
<p>Thanks for the Instructable! I want to turn my amp on and off when my Arduino senses signal from my Sonos. Needed the codes from my remote as I couldn't find them elsewhere. </p>
NP awesome! Good luck with the project!
<p>Sir,</p><p>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 &quot;led control using ir remote&quot;, 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.<br>Thank you once again,<br>regards </p><p>Nishant(INDIA)</p><p>:)</p>
<p>Sweet man! Good job! Keep up the good work!</p>
<p>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 :)</p>
<p>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!</p>
<p>can someone tell me how to use two sensors dedode valeus same time from this code</p><p>/*</p><p> * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv</p><p> * An IR detector/demodulator must be connected to the input RECV_PIN.</p><p> * Version 0.1 July, 2009</p><p> * Copyright 2009 Ken Shirriff</p><p> * http://arcfn.com</p><p> */</p><p>#include &lt;IRremote.h&gt;</p><p>int RECV_PIN = 11;</p><p>IRrecv irrecv(RECV_PIN);</p><p>decode_results results;</p><p>void setup()</p><p>{</p><p> Serial.begin(9600);</p><p> irrecv.enableIRIn(); // Start the receiver</p><p>}</p><p>void loop() {</p><p> if (irrecv.decode(&amp;results)) {</p><p> Serial.println(results.value, HEX);</p><p> irrecv.resume(); // Receive the next value</p><p> }</p><p> delay(100);</p><p>}</p>
<p>thanx alot</p>
<p>Maybe it because I'm using Arduino IDE 1.6.4 but in the sketch in Step 6: Arduino Test Code - when I change the zero to FF30CF I get the error - 'FF30CF' was not declared in this scope. Probably a simple to fix issue? I'm still fairly new to coding in Arduino so I'll do my homework but wanted to point it out. Thank you for a very good Instructable.</p>
<p>I too was getting the &quot;was not declared in this scope&quot; error. Then realised that my remote was transmitting a HEXADECIMAL number like yours. Searched and found that for Arduino code, HEX numbers are entered with a &quot;0x&quot; (that's zero x not oh x) before the number.</p><p>So... enter 0xFF30CF instead of FF30CF. Works for me!</p>
<p>Thanks wildwildbanans! Yeah i found that out not long after i posted that. I found a French electronics blog with that &quot;0x&quot; tip. I don't speak French so it was a nice challenge. :-)</p>
<p>Hi....</p><p>I really liked your Instructable....</p><p>I just wanted to know if somehow I could (or you could) write a program for Uno by which the IR receiver reads 4 distinct frequencies and assigns each frequencies to a number and can display it on a 7-Seg. display with the beep of a piezo buzzer......</p>
I have no clue how to use 7 segment displays. Why don't you ask this on the Arduino forums, they should be able to help you out.
<p>Ok how about just displaying 1/2/3/4 on the serial monitor......</p><p>Could you write a code for that</p>
<p>Just like your ir decoder sketch..... But it displays the no. on the screen instead of the frequencies.....</p>
<p>Go ahead and ask it on the Arduino forums, they'd be much more able to help :D</p>
U are a good teacher. Keep it up! Nice insructables
Thanks man!
<p>Not sure what may be wrong</p><p>Arduino: 1.6.5 (Windows 7), Board: &quot;Arduino Leonardo&quot;</p><p>xxxxxxxxxxx\Documents\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp:5:16: error: 'TKD2' was not declared in this scope</p><p> int RECV_PIN = TKD2; // the pin the IR receiver is connected to</p><p> ^</p><p>Error compiling.</p>
You are trying to use the wrong library. You need to read the beginning of the instructable.
<p>thank's man ! </p><p>do you know how can i manage to copy the signal? </p><p>say i want to make a smart home and with a singel ir sender i need to control several instruments....</p>
<p>hi frnds i made this but..i have a question that if i connect a five volt dc motor directly to the arduino pins so what happen...is arduino damageg</p>
<br> I have <br> a good expierence with Robomart while purchasing Ardiuno Uno first time.First <br> Time I purchased Ardiuno Uno from Robomart and I got some error in executing <br> some code on that then I called in technical support of Robomart on 06:00 AM <br> Seriously he helped me alot. Finally I execute my Ardiuno Code Easily &amp; you can also visit and call them . That people give to response in some seconds. Thanks very much Robomart.com
<p>Sandeep kaur</p> <br> I have <br> a good expierence with Robomart while purchasing Ardiuno Uno first time.First <br> Time I purchased Ardiuno Uno from Robomart and I got some error in executing <br> some code on that then I called in technical support of Robomart on 06:00 AM <br> Seriously he helped me alot. Finally I execute my Ardiuno Code Easily &amp; there is a team for online support any time.Thank <br> Robomart.com
<p>Hi there, thank you for this, but I have one question. How would I have a task loop until a different button is pushed on remote? Im using switchState and have 3 different tasks. I want each task to loop until a different button is pressed. My code so far; </p><p>#include &lt;IRremote.h&gt;<br><br>int IRpin = 11; // pin for the IR sensor<br>int ledPins[] = {3, 4, 5, 7, 6, 8, 9, 12, 10, 13 }; // an array of pin numbers to which LEDs are attached<br>int pinCount = 10; // the number of pins (i.e. the length of the array)<br>int brightness = 0; //How bright the LED is<br>int fadeAmount = 5; //How many points to fade LED by<br>int timer = 60; // The higher the number, the slower the timing.<br><br>IRrecv irrecv(IRpin);<br>decode_results results;<br><br>boolean LEDon = true; // initializing LEDon as true<br><br>void setup()<br>{<br> Serial.begin(9600);<br> irrecv.enableIRIn(); // Start the receiver<br> for (int thisPin = 0; thisPin &lt; pinCount; thisPin++) {<br> pinMode(ledPins[thisPin], OUTPUT); <br> }<br>}<br><br>void loop() <br>{<br> <br> if (irrecv.decode(&amp;results)) <br> {<br> <br> irrecv.resume(); // Receive the next value<br> }<br> <br> switch(results.value)<br> {<br><br> case 29876577:<br> <br> // do this<br> for(int i=0; i&lt;10; i++)<br> analogWrite(ledPins[i], brightness); //Set brightness of RedLED1<br> brightness = brightness + fadeAmount; //Change brightness for nex time through loop<br> <br>if (brightness == 0 || brightness == 255){ // reverse the direction of the fading at the ends of the fade:<br><br> fadeAmount = -fadeAmount;<br>}<br> delay(100);<br> <br> break;<br> <br> case 1632469053:<br> // do another thing<br> for (int thisPin = 0; thisPin &lt; pinCount; thisPin++) { // loop from the lowest pin to the highest:<br> digitalWrite(ledPins[thisPin], HIGH); // turn the pin on:<br> delay(timer); <br> digitalWrite(ledPins[thisPin], LOW); // turn the pin off: <br> }<br> <br> for (int thisPin = pinCount - 1; thisPin &gt;= 0; thisPin--) { // loop from the highest pin to the lowest: <br> digitalWrite(ledPins[thisPin], HIGH); // turn the pin on:<br> delay(timer);<br> digitalWrite(ledPins[thisPin], LOW); // turn the pin off:<br> }<br> break;<br> <br> case 482085517:<br> // feed my dog for me<br> digitalWrite(ledPins[0], HIGH);<br> digitalWrite(ledPins[2], HIGH);<br> digitalWrite(ledPins[4], HIGH);<br> digitalWrite(ledPins[6], HIGH);<br> digitalWrite(ledPins[8], HIGH);<br> delay(100);<br> digitalWrite(ledPins[0], LOW);<br> digitalWrite(ledPins[2], LOW);<br> digitalWrite(ledPins[4], LOW);<br> digitalWrite(ledPins[6], LOW);<br> digitalWrite(ledPins[8], LOW);<br> digitalWrite(ledPins[1], HIGH);<br> digitalWrite(ledPins[3], HIGH);<br> digitalWrite(ledPins[5], HIGH);<br> digitalWrite(ledPins[7], HIGH);<br> digitalWrite(ledPins[9], HIGH);<br> delay(100);<br> digitalWrite(ledPins[1], LOW);<br> digitalWrite(ledPins[3], LOW);<br> digitalWrite(ledPins[5], LOW);<br> digitalWrite(ledPins[7], LOW);<br> digitalWrite(ledPins[9], LOW);<br> break;<br> <br> default:<br> for (int thisPin = 0; thisPin &lt; pinCount; thisPin++) {<br> digitalWrite(ledPins[thisPin], LOW); <br> }<br> }<br>}</p><p>Sadly, when i press button on remote it only does the case 1 time, any ideas please?</p>
<p>Try getting rid of the break; at the end of the statements.</p>
<p>Hey there! I was wondering if there is a way to get the raw data that the IR sensor receives? convert your number codes into Hex codes? </p><p>I want to record the codes with an arduino and use my smartphone to transmit them so i can control my Air conditioning.</p><p>If you can help at all it would be greatly appreciated. </p>
<p>Chat it up on the forums, I can't help :D</p><p>http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html</p>
<p>Maybe it's because I am using Arduino IDE 1.6.4 but when I move on to Step 6: Arduino Test Code and change the zero in the line of code: if (results.value == 0) to FF30CF I get an error - 'FF30CF' was not declared in this scope . Which is probably an easy issue to resolve but I am still an Arduino coding newbie. So time to do my homework. But thank you for a great Instructable.</p>
<p>Hi Friend! I am in a small trouble. I had tried many ways to decode the signals (from adafruit's tutorial to your tutorial and irRemote also) but every time i press a key the decoded data is different.</p>
<p>Use the first number you get.</p><p>If it does not work use all numbers with an or operator in the if statement.</p><p>I hope it works.</p>
It has to be your remote then. Pick up a different remote from the dollar store and try it out!
Thanks friend for quick reply. But i had tried sony, voltas, hathway, samsung remotes but every time generating a different output.<br>
<p>Chat it up on the forums.</p>
I really appreciate when somebody takes the time to share their knowledge. Thank you formboradrc
No problem! I'm glad I can help!
<p>Great tutorial, </p><p>only problem is that the arduino does not register the IR while battery powered, only while it's connected to the pc. Any tips?</p>
uh what kind of battery are you using?<br>

About This Instructable


306 favorites


Bio: ¿Qué tal? I'm 16 and enjoy learning about electronics. I am self-taught. I love programming my Arduino and soldering circuits. My newest hobby is ... More »
More by FoamboardRC: Control Your RC Plane With Your Phone's Acclerometer DIY Receiver Controlled Switch (Cheap and Easy) Complete Guide to Building Your First RC Foamboard Plane
Add instructable to: