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 [ 10/12/2015 ]


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. Instructions for deleting this file is in step 3.

This library is for a specific robot 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
<p>JUST PERFECT!!!</p><p>Best Arduino related tutorial and &quot;instructable&quot; that I read so far, (and I assure you I read a lot).</p><p>Well organized, simple, straight forward, contains all what is required and with a light touch of humor.</p>
Thanks! I'm glad to help where I can!
<p>You are amazing, made my work so easy. Thanks alot :)</p>
<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>I tested it. I'm sure it's the easiest way. I used the key 0-9 and display it with a 7 seg.</p>
Hey, FoamboardRC -<br>Okay, I finally got it going! Thanks SO much for your help and patience, and for the really good I'ble. <br>Neil
Np dude! Let me know if you have any further trouble!
<p>Nice! Now I use my DVD remote to control my iTunes player on my Mac :D</p>
<p>Brilliant tutorial! Just one question - does the IR sensor need a pull up resistor?</p>
Lol I don't really know! But I haven't seen anybody else using one :D<br><br>Thanks!
Awwwww, man!! This thing's NEVER gonna end. Somebody put a spell on this project, for sure.<br>RobotIRremote is gone; IRremote is in the libraries folder (Thanks for spelling out the access), and Decode_IR.ino has been downloaded BUT NOW WON'T COMPILE. (&quot;'results' was not declared in this scope/'v' does not name a type&quot;).<br>As I confessed earlier, I'm a newbie, so this's almost certainly my bad, and I'm really self-conscious about asking for help again. (Before writing this I restarted both the Arduino IDA and the computer; I dumped an old copy of IRremote and downloaded a new one; and I sought the counsel of my higher power. Still no love.)<br>So: Haaalp!<br>Thanks, RC.
OK so you got the library problem worked out! Good!<br><br>It seems to be that you have a stray character 'v' somewhere in the code. Send it to me and I'll take a look.
Well, that was stupid. <br>I've been working from the little, yellow- button screen; going full-time screen shows a random 'v' over in the right margin. <br>I'll try the sketch again sometime tomorrow. Thank you, he says humbly.
<p>Awesome just awesome!! My 12 yr old son and I have been playing around with an Arduino for the last week or so with pretty good results but a little boring for him. This project hooked him!! Endless possibilities for controlling stuff with a remote through a relay board. Thank you so much for the great detail!</p>
I'm glad I can help! It's really awesome that you have a 12yrold into this!
<p>Hi FoamboardRC -</p><p>Thanks for putting up an understandable IR remote-decoding I'ble - I've tried several that just weren't.</p><p>I'm still having a bit of trouble (which is probably due to my own lack of experience - I discovered Arduino only a month ago.)</p><p>I've gotten into your step 5, having compiled and uploaded the IRremote sketch and installed an IR receiver on the Arduino, but I'm not getting any Serial Monitor readings.</p><p>I've tried to follow your instructions to the letter, but I know I didn't delete the &quot;Robot|Remote&quot; library, because I couldn't find it. (I've got Arduino 1.6.5, and the &quot;libraries&quot; folder in the &quot;Arduino&quot; folder has got &quot;Robot_IR_Remote&quot; and &quot;IRremote&quot; folders; the Arduino program [Sketch&gt;Include Library] lists &quot;Robot IR Remote&quot;, and [Sketch&gt;Include Library&gt;Manage Libraries] shows that that library is installed.)</p><p>Is &quot;Robot IR Remote&quot; the one I should dump? And, if so, do I remove the entire &quot;Robot_IR_Remote&quot; folder?</p><p>Thanks for your help -</p><p>Dandydog</p>
FosmboardRC -<br>That puppy is GONE! Tracked him down through the many realms you identified and Trashed hm! (I haven't had time to test the sketch yet, but the problem we've been working on is solved.)<br>You're a one-man tech department - thanks so much for your help!<br>Neil
That's awesome! Glad I could help!<br>Np, good luck with your project!
You're doing it right! Yeah delete that whole folder. Again that directory is C:\Program Files (x86)\Arduino\libraries and delete the folder called RobotIRremote. After that restart the Arduino IDE (application) and that library should be gone. Lemme know if you need anymore help!
<br>This project is, like, cursed: Waiting for your response, I installed Apple's new OS, crashing my Mac completely. Naturally, it's happening to everybody else, too, so the earliest appointment I can get is next Tuesday (and yes, you have to bring it in. To the Genius Bar.)<br>I'll let you know how that fix works on Wednesday.<br>Thanks, FoamboardRC.
<p>Haha Ok goodluck. PM me if you get or don't get it to work</p>
Hey, FoamboardRC -<br>Thanks for the quick response (and apologies for using the Comments section to ask for help. (I've got a lot of experience working on cars and auto forums; robotics and Arduino, not so much.)<br><br>I'm still getting nowhere with the IR sketch, though, and - if you're willing - I'd like to ask for some more help.<br>Trying to follow your instructions, I went into the &quot;libraries&quot; folder (I'm on a Mac, so it went Finder (&quot;Arduino&quot;)&gt;&quot;Arduino&quot; folder&gt;&quot;libraries&quot; folder), and dragged the folder &quot;Robot_IR_Remote&quot; to the Trash. I loaded the Arduino program and checked Sketch&gt;Include Library and found that the library &quot;Robot IR Remote&quot; was still listed, so I closed out Arduino and reopened it: &quot;Robor IR Remote&quot; was still listed (Sketch&gt;Include Library); compiling your sketch was successful, but it yielded the same results: no Serial Monitor output. I Restarted the Mac, reloaded Arduino, and got the same results: &quot;Robot IR Remote&quot; is still listed in the Libraries, and accessible by Manage[ing the] Library; the sketch compiles but generates no Serial Monitor data. <br><br>(Possibly significant is the fact that that &quot;Robot_IR_Remote&quot; is absent from the &quot;libraries&quot; folder [as it should be] but &quot;Robot IR Remote&quot; is still listed in the Arduino program Library. Are these in fact 2 different things?)<br><br>This is all probably pretty basic stuff for you, but it's where I'm at right now, and where I am is Stuck. Any help you can offer will be greatly appreciated.<br>Neil<br>
<p>Neil, </p><p>Dude I'm happy to help! Ok sorry I didn't know you were on a mac. If you watch this video it will show you were this troublesome file is. Let me know if you are still having trouble! </p><p>https://youtu.be/j8Bqp1ZIBwk</p><p>Thanks for letting me know about this I'm adding an extra step in this i'ble on where to find this library to delete. </p><p>Hope that works, </p><p>~AJ</p>
<p>your 16? Im 13 and i love doing the same thing! i also program video games in unity and in python.</p>
Haha about to turn 18 now ;)
<p>This is an excellent 'ible. Even better than the old tutorial the IDE had before this update to 1.6.5. </p><p>One thing I'd love though, is your debounce code. With just one button to turn a circuit on or off this works fine, but I still have the occasional glitch where flips between states until I hit the button again.</p>
Awesome! I haven't looked at the code but I think if you add button debounce it should get rid of the glitches. You could also add a 1ms delay in there.
<p>stock denounce code would have been messier than necessary, but upping the delay to .5 seconds smooths over any issues. I'm sure it could go a bit lower, basically jumped straight from .1 to .5 seconds, but this set-up works fine for my project.</p><p>Thanks a ton for the tutorial, pump out more!</p>
<p>Ok gotcha! Glad you worked it out. </p><p>Yeah no problem and thanks!</p><p>I'm trying!</p>
<p>I want to use IR Remote controller as a Input method for password. Say if I press 1,2,3,4 from IR remote Controller and the Arduino will accept this input as a passphrase. In short I don't want to use keypad to enter password i want to use normal IR remote to do same. How can I? Please help me out...</p>
Hey bud, you should ask this in the Arduino forums, I'm sure they'd love to help you out. If you still want me to write some code for you I can do that. Go ahead and PM with details.
<p>This is fantastic and works GREAT! However, Im struggling a bit with the remote Im using. </p><p>Currently im using a 40 button remote that came with my LED tape and I'm using the same IR receiver diode too. <br><br>Problem is, when i watch the serial monitor, the first number changes every time i press the same remote button. And if I'm understanding this correctly, its changing based on my distance from the IR receiver on the arduino. </p><p>For example, for pressing the power button alone, repeatedly gave me 240+ codes, which filtered down to 36 unique codes. Just for the power button.</p><p>Any idea what would cause this?</p>
You really recorded that many? Lol! I don't know what to tell you! You might just have to use another remote. <br><br>Can you send me a sample of these numbers?
<p> Hey,</p><p>I have a problem because, when i compiler it then it's write the sentence:</p><p><br>C:\Program Files (x86)\Arduino\libraries\RobotIRremote\IRremoteTools.cpp:5: error: 'TKD2' was not declared in this scope</p>
You didn't read step 3 you are trying to use the wrong library. You must delete that one. Read the introduction more carefully
<p>This is fantastic and works GREAT! However, Im struggling a bit with the remote Im using. </p><p>Currently im using a 40 button remote that came with my LED tape and I'm using the same IR receiver diode too. <br><br>Problem is, when i watch the serial monitor, the first number changes every time i press the same remote button. And if I'm understanding this correctly, its changing based on my distance from the IR receiver on the arduino. </p><p>For example, for pressing the power button alone, repeatedly gave me 240+ codes, which filtered down to 36 unique codes. Just for the power button.</p><p>Any idea what would cause this?</p>
<p>Hello,<br><br>I did something wrong. I put the middle leg in the 5V and the right leg in the GRD. It didn't work. When I understood that I did something wrong, I put the legs to the right pins but it didn't work too :(<br><br>Do you think that I have fried my IR receiver? And how can I test it to know if the IR receiver is still working?</p>

About This Instructable


324 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: