loading
It is really easy to control an Arduino using an infrared remote. There is one particular remote that is available from multiple sources and is really quite cheap, they look and operate in a very similar way.

NEOMART Raspberry Pi HX1838 Infrared Remote Control Ir Receiver Module DIY Kit.  Amazon
Kootek Raspberry Pi Infrared Remote Control Ir Receiver Module DIY Kit. Amazon
KIT,IR REMOTE,IR RECIVER,ARDUI,COMPATIBLE  Jameco

The problem is that documentation seems to be scarce for these particular remotes. Here is how I figured out how to use them.
 

Step 1: Assemble Circuit

You will need one Arduino for this. I used a UNO, but just about any Arduino should work. First wire up the infrared receiver that came with your kit. There are 3 wires, PWR, GND, and SIG, I used port 11 for SIG. Note! some readers have reported that their sensor has different wiring, double check it yourself.

<p>The sketch won't compile:</p><p>It gets the following errors:</p><p>sketch_jul31b:3: error: 'IRrecv' does not name a type</p><p>sketch_jul31b:4: error: 'decode_results' does not name a type</p><p>sketch_jul31b.ino: In function 'void setup()':</p><p>sketch_jul31b:9: error: 'irrecv' was not declared in this scope</p><p>sketch_jul31b.ino: In function 'void loop()':</p><p>sketch_jul31b:14: error: 'irrecv' was not declared in this scope</p><p>sketch_jul31b:14: error: 'results' was not declared in this scope</p><p>The code:</p><p>#include &lt;IRemote.h&gt;</p><pre>int RECV_PIN = 11;<br>IRrecv irrecv(RECV_PIN);<br>decode_results results;<br><br>void <strong>setup</strong>()<br>{<br><strong> Serial</strong>.begin(9600);<br> irrecv.enableIRIn(); // Start the receiver<br>}<br><br>void <strong>loop</strong>()<br>{<br> if (irrecv.decode(&amp;results))<br> {<br><strong> Serial</strong>.println(results.value, HEX);<br> irrecv.resume(); // Receive the next value<br> }<br>}</pre>
<p>do you have the library installed for it and included for the IR receiver at the top of the code?</p>
<p>if the IRremote is used these errors don't appear. If IRemote is used the above errors appear</p>
<p>c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: sketch_sep04a.cpp.elf section .text will not fit in region text</p><p>c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: region text overflowed by 722 bytes</p><p>I got am error like this? what can i do? how i solve this? my board is arduino with atmega8 (FREEDUINO)</p>
<p>Hi @thunderboympm</p><p>You made mistake in writing the header file,</p><p>If you see your attached image, you have written &quot;#include&lt;IRremote.h&gt;&quot;</p><p>Correct it by writing; &quot;#include&lt;IRemote.h&gt;</p><p>Happy :-)</p>
<p>What can I do if i want to Compare two IR received Strings ??? </p>
<p>Wow great tutorial.</p><p>I have one question, do somebody know how it's possible that i get only numbers, like 808, 26, 7 and i dont get hex codes.</p>
<p>Didn't get anything on the serial monitor... Then i realized i had forgotten to change the pin you read on. Haha!</p>
<p>Great tutorial! I broke apart a small IR Helicopter toy I had around. I used its IR sensor for this tutorial. What's strange, is the IR Sensor won't detect any signal from it's original remote, but it reads signals from any other TV remotes I got hanging around.</p><p>Anyone has any clue what I can be missing?</p><p>The Remote has 3 &quot;chanels&quot; or 3 comm protocols so that you can fly up to 3 of these things without the signals interfering, but the IR sensor won't pick up any kind of signal whatsoever!</p><p>Cheers again for this great piece of info!</p>
<p>OK I have got this remote and it is the king of weird codes. Heres what I get when a press the power button and hold it for sometime-</p><p>C722B335</p><p>8651F175</p><p>D440F4BA</p><p>673D41A</p><p>D440F4BA</p><p>673D41A</p><p>C722B335</p><p>673D41A</p><p>C722B335</p><p>673D41A</p><p>D440F4BA</p><p>673D41A</p><p>C722B335</p><p>673D41A</p><p>Heres what i get when I press it shortly so that i get only one reading per press-</p><p>D440F4BA</p><p>EDB7BF84</p><p>C722B335</p><p>7B33B312</p><p>C722B335</p><p>EDB7BF84</p><p>D440F4BA</p><p>EDB7BF84</p><p>C722B335</p><p>8651F175</p><p>C722B335</p><p>EDB7BF84</p><p>D440F4BA</p><p>EDB7BF84</p><p>C722B335</p><p>EDB7BF84</p><p>C722B335</p><p>F8D5FDE7</p><p>D440F4BA</p><p>EDB7BF84</p><p>I have previously cloned Sony, Samsung and LG remotes, but this DTH remote is a b**ch. The company isn't international and I live in India, so I can't find a module for it. Any help would be welcome.</p><p>Thanks</p>
<p>YES. I also at times get these codes. I dont understand WHY. sometimes i get correct code and sometimes I get these codes. Such an un-reliable remote.</p>
<p>I was also having this issue, I however realised it was because of the batteries in the remote were dying. Swapped them for new ones and they now detect a steady hex!</p>
<p>Don't want to resurrect a dead horse and then beat him - this post is a bit old.</p><p>But my ten cents....</p><p>.....is that maybe the codes ARE actually the same on each press, but perhaps the arduino gets lost in the the bits and doesn't catch where start and end is. Especially if you're holding the button down, then it just gets a really long set of pulses and doesn't know whats going on....whereas the TV or aircon knows what to look for among the mess...</p><p>Aircon to self:&quot;oh look! A power on/off command! That must be it! What are the chances of it being something else...?&quot;</p><p>Arduino:&quot;..............................ugh...........................oh man................wha?..........................................gaaaaaaaaaa! TMI! TMI! TMI! It doesn't make any sense! Why are you doing this to me!?&quot;</p><p>Among the frequency of pulsing, start bits, stop bits, and length of the train of pulses that is a single signal, maybe it just is too much for it sometimes.</p><p>So what I mean is, it might not be as bad as you think. Maybe code can fix it, or maybe some cheap logic analyzer can help you see what's going on.</p>
<p>IR remote does not display in the serial monitor IRreceive I think I uploaded the code that nothing is wrong as well, but when I stick my hand into IRreceiver monitor displays the serial code ..</p>
<p>Hi I need to resolve is there who can help me</p><p>Thank you</p>
<p>delete the robort ir library its creating the problem</p>
<p>you have open arduino librarys in your case, E:\arduino-nightly\libraries and delete this library (RobotIRremote). close arduino and open again &amp; Ready :) </p>
<p>Works like a charm(and yes, it's not connected atm)</p>
<p>Nice and easy, works also with my Android phone as a remote!!</p>
<p>I'm getting a compiling error: 'TKD2 was not declared in this scope'. Anyone know how to fix this? Thanks</p>
<p>How did you solve that problem, because I encounter this</p><p>Thanks</p>
<p>Nice Abstract. </p>
Thanks a lot.... I have been breaking my head to understand IR buttons coding. Helped a lot.
<p>Mine too. This guy is so bad, he should atleast have decency to update his tutorial and mention about it. I fried mine also.</p>
<p>How can you take this and make it do something when you press a button. Such as Print a line or run a motor?</p>
<p>Yes I have programmed it to receive code from a Sony remote and move a servo</p>
Can you post that if pressed code?
Do you have a program to connect motors to arduino and control them using IR remote?
<p>my code for one led and remote control of MP3 player.</p>
<p>#include &lt;IRremote.h&gt; // libraria IR control remoto.</p><p>int RECV_PIN = 11;// pin donde recibiremos la se&ntilde;al</p><p>#define ON 0xFFA25D // direccion es FFA25D pero se le agrega el 0x </p><p>// porque asi se le dice al arduino que es HEXADECIMAL.</p><p>#define OFF 0xFF629D // tecla control stop</p><p>unsigned int led = 13;</p><p>boolean estado = false;</p><p>IRrecv irrecv(RECV_PIN); //</p><p>decode_results results;</p><p>// aca guardamos el dato que nos del el IR</p><p>void setup()</p><p>{</p><p> //Serial.begin(9600);</p><p> irrecv.enableIRIn(); // Inicia el IR in</p><p> pinMode(led,OUTPUT); // configuramos el led como salida</p><p>}</p><p>void loop() {</p><p> // si el IR recibe una se&ntilde;al se habilita la funcion.</p><p> if (irrecv.decode(&amp;results)) {</p><p>switch (results.value)</p><p>// si el resultado obtenido esta en el case se ejecuta</p><p>{</p><p> case ON:</p><p> // en el caso que sea la direccion 0xFFA25D</p><p> // se ejecuta lo siguient</p><p> if (estado ? false : true){</p><p> // si es estado del es false se ejecuta</p><p> // y se asigna al estado true. </p><p> estado = true;</p><p> digitalWrite(led,estado);</p><p> }else </p><p> {</p><p> //sino se le asigna false nuevamente para que el led</p><p> // permanezca apagado</p><p> estado = false;</p><p> digitalWrite(led,estado);</p><p> }</p><p> break;</p><p>}</p><p>delay(200); // 1/5 second delay for arbitrary clicks. Will implement debounce later.</p><p>irrecv.resume(); // Receive the next value</p><p> }</p><p>}</p>
<p>Will any IRreceiver work with any remote? OR do I need a specific one? I've been trying to do this project, however my receiver and my remote don't seem to be working. Is there a way that my project could have failed?</p>
<p>work with any Remote control I tested the skecth but I have to delete de RobotIRemote (included as default ) <br>this is my code:<br>apagar = FFA25D</p><p>stop = FF629D</p><p>mute = FFE21D</p><p>mode = FF22DD</p><p>back-row = FF02FD</p><p>EQ = FFC23D</p><p>back = FFE01F</p><p>adelante = FFA857</p><p>play/stop = FF906F</p><p>vol+ = FF6897</p><p>vol- = FF9867</p><p>Numero 0 = FFB04F</p><p>Numero 1 = FF30CF</p><p>Numero 2 = FF18E7</p><p>Numero 3 = FF7A85</p><p>Numero 4 = FF10EF</p><p>Numero 5 = FF38C7</p><p>Numero 6 = FF5AA5</p><p>Numero 7 = FF42BD</p><p>Numero 8 = FF4AB5</p><p>Numero 9 = FF52A</p>
<p>PLEASE HELP THIS IS URGENT</p>
<p>Nope! As long as it is using the standard infrared remote wavelength (television, stereo, anything else pretty much), your Arduino should pick it up.</p>
<p>i am getting error while compiling the code, can anyone help me </p>
<p>It says &quot;#include &lt;IRemote.h&gt; but the &quot;r&quot; of &quot;remote&quot; is missing.</p><p>it must be: #include &lt;IRremote.h&gt;</p>
My IR receiver is dead : The +5V pin was on the right and the GND pin was in the middle...
<p>Check this before connecting anything to power and your arduino. As there have been a few who have blown their IR receivers. It shows the various pin sets for the different IR receivers. </p><p><a href="https://arduino-info.wikispaces.com/IR-RemoteControl" rel="nofollow">https://arduino-info.wikispaces.com/IR-RemoteContr...</a></p><p> Hope it helps you all prevent damage to your equipment.</p>
<p>Hello der. Found sumthng new for dis. Check it out.</p><p><a href="http://vaaiibhav.me/how-to-use-arduino-with-infrared-remote-control/" rel="nofollow">http://vaaiibhav.me/how-to-use-arduino-with-infrar...</a></p>
<p>1. Use this library instead!</p><p><a href="https://github.com/z3t0/Arduino-IRremote" rel="nofollow">https://github.com/z3t0/Arduino-IRremote</a></p><p>2. The code in the instructable is miswritten</p><p>#include &lt;IRemote.h&gt; -&gt; #include &lt;IRremote.h&gt;</p><p>3. and check the legs!</p><p><a href="https://arduino-info.wikispaces.com/file/view/IR-Receiver-AX-1838HS.pdf" rel="nofollow">https://arduino-info.wikispaces.com/file/view/IR-R...</a></p><p>Thanks for the instructable. It was fun to build.<br></p><p>#include &lt;IRemote.h&gt;</p>
<p>hi im new to all this and i just got a beginner kit and i put the IR project together, but i cant find a example or code to verify and upload can someone help me please?</p>
<p>hi im new to all this and i just got a beginner kit and i put the IR project together, but i cant find a example or code to verify and upload can someone help me please?</p>
<p>ADVICE, for those who burned the reciever is good to know that:<br> a) Is very important to check the datasheet of the component before adding power supply because some brands design ther reciver with different settigs<br> b) It probally burned because (this happened to me) the schematich that appears on this tutorial the VCC and GND are upsidedown<br> c) If one of your components heats up YOU MUST DISCONNECT IT INMEDIATLY<br> d) Even though Arduino is a microcontroller with a stable design, it's not inmune to <br> interference that's why one button can give you up to tow difference values</p>
<p>You killed my receciver it is so hot now!!!!!!!! I'm so angry</p>
<p>I think you've killed it by yourself... Same i did wrong the first time. Probably you have forgotten you're resistance. Didn't that wrong? Say it and I can maybe help you with a solution. Grz</p>
Step 1: Assemble Circuit<div>I just blew up my infrared transceiver, thanks a lot. The v+ is the right pin and gnd is the middle pin, great picture -.- ..l..</div>
<p>same here this needs to be fixed before he kills more peoples parts</p>
<p>He killed the only transceiver i've owned too -.-</p>
<p>It is not his fault that you didn't verify the pin layout before connecting. Why don't people want to accept responsibility for their own actions?</p>
<p>killed mine too :(</p>

About This Instructable

307,397views

205favorites

License:

Bio: I am a full time software engineer and enjoy working on various projects in my spare time, especially Arduino, electronics, 3D printing and woodworking.
More by astrodan3:Arduino 6 wire Stepper Motor Tutorial  how to make vermicompost Arduino Infrared Remote tutorial 
Add instructable to: