Wondering about how to control anything in your house with a simple remote control? It's pretty simple and cheap.

Step 1: Collect Stuff

Here is what you will need:

- Arduino (I use UNO)
- Solderless breadboard
- An infrared receiver
- Solderless wires
- Any kind of remote control

Step 2: Assemble the Receiver

Plug in the ir receiver to the beradboard and connect it to your Arduino.

Connect the right pin to the 5V of the Arduino, the center pin to GND, and the left pin to digital pin 11.

Step 3: The Code

I used the IRremote library for arduino.
You can download it here: IRremote

Close the Arduino IDE and unzip it into the arduino/libraries folder.

Start Arduino IDE and open the IRrecvDemo example sketch. Rewrite "HEX" to "DEC" as the image shows.
Upload the sketch to your board.

Step 4: Identify Remote Buttons

After uploading the program open the serial monitor and start pushing the buttons on your remote. If you have done everything well, you have to see the codes appearing.

Remember which button was pressed and take notes of the codes appearing.
For example:
Code 50088119 appeared and you pressed the On/Off button.
Code 50073839, Open/Close button etc...

Step 5: Control Stuff

Now you know which code the buttons give. To control something you have to write them into the program.

Here is the code you have to use. It's not the best solution I think but it's simple.

    case 50088119:
    // do something
    case 50073839:
    // do something else...

Have fun ;)
<p>this works without the computer connected ?</p>
<p>yup, just give it a power source thru the circular port.</p>
<p>when i try to send the file to my arduino uno, it gives me this error message=</p><p>GetFileAttributesEx C:\Users\user\Downloads\IRremote\IRremote\examples\IRrecvDemo\IRrecvDemo.pde: The system cannot find the file specified.</p><p>Error compiling.</p>
<p>so what do i do?</p>
hi im sorry to bother you again but i was wondering if it is possible to block a certain value from being wrote to the serial<br><br>F7708F<br>F7708F<br>FFFFFFFF<br>FFFFFFFF<br>F7708F<br>F7708F<br>F7708F<br>F7708F<br>F7708F<br>FFFFFFFF<br>F748B7<br>FFFFFFFF<br>F748B7<br>F748B7<br>FFFFFFFF<br>FFFFFFFF<br>i want to block the F's
It is not neccessary but if it disturbs you simply write an if statement to filter the F-s.
i am a little new to arduino and i was using this with winlirc and the config was picking up the F's
<p>Hi, i saw your post and I'd like to know if you managed to use WinLirc with Arduino? Does arduino make the IR decoding?</p>
I really don't know winlirc so sorry i don't have an idea :S
its good i just need to block the FFFFFFFF string cause its picking it up as a remote code causing false readings. could you help with that part cause i have tried and failed
Insert this:<br> <br> <strong>if(results.value != 4294967295){<br> Serial.println(results.value, DEC);<br> } </strong><br> <br> 4294967295 is the decimal value for FFFFFFFF<br> <br> The F-s won't be shown ;) enjoy<br> <br> Patrik
Awesome now to figure the rest on my own lol<br>i didnt think bout inverting the line
I need to do a function only while I'm pressing a key of the remote, which means that the function stops when I take my hand off the button. How can I write the program to that? Plz help!!!
<p>For some reason its trying to read from the RobotIRremote library. Should I delete or move the folder as i am using an UNO?</p><p>Here are my errors:</p><p>Arduino: 1.6.5 (Windows 7), Board: &quot;Arduino Uno&quot;</p><p>C:\Program Files (x86)\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp:5:1: error: missing terminating &quot; character</p><p> int RECV_PIN = TDK2&quot;; // the pin the IR receiver is connected to</p><p> ^</p><p>C:\Program Files (x86)\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp:5:16: error: 'TDK2' was not declared in this scope</p><p> int RECV_PIN = TDK2&quot;; // the pin the IR receiver is connected to</p><p> ^</p><p>C:\Program Files (x86)\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp: In function 'void beginIRremote()':</p><p>C:\Program Files (x86)\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp:10:2: error: 'irrecv' was not declared in this scope</p><p> irrecv.enableIRIn(); // Start the receiver</p><p> ^</p><p>C:\Program Files (x86)\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp: In function 'bool IRrecived()':</p><p>C:\Program Files (x86)\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp:14:9: error: 'irrecv' was not declared in this scope</p><p> return irrecv.decode(&amp;results);</p><p> ^</p><p>C:\Program Files (x86)\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp: In function 'void resumeIRremote()':</p><p>C:\Program Files (x86)\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp:18:5: error: 'irrecv' was not declared in this scope</p><p> irrecv.resume(); // resume receiver</p><p> ^</p><p>Error compiling.</p><p> This report would have more information with</p><p> &quot;Show verbose output during compilation&quot;</p><p> enabled in File &gt; Preferences.</p>
<p>I have deleted it and now it says there is no IRremote.h but there is!!</p>
<p>in expansion of macro 'HEX'<br>Error compiling.</p><p>and </p><p>expected unqualified-id before numeric constant<br> #define HEX 16</p><p>are causing me problems</p>
hi please help me i already had all the codes for the IR<br>what if i want to light 2 leds with the IR? which connections should i make? am new please hlep :(
<p>I think you'll have to take two (or four) button's readings and apply them to two different LEDs.</p><p>Something like:</p><p>switch(results.value) {</p><p> case 1:</p><p> digitalWrite(13,HIGH);</p><p> break;</p><p> case 2:</p><p> digitalWrite(12,HIGH);</p><p> break;</p><p> case 3:</p><p> digitalWrite(13,LOW);</p><p> break;</p><p> case 4:</p><p> digitalWrite(12,LOW);</p><p> break;</p><p>}</p>
<p>IRrecvDemo.ino:9:22: fatal error: IRremote.h: No such file or directory<br>compilation terminated.</p>
<p>Maybe the IR library isn't present on your PC. Try downloading it from here: <a href="http://arcfn.com/files/IRremote.zip" rel="nofollow">http://arcfn.com/files/IRremote.zip </a> (from the tutorial).</p><p>After downloading it, open your IDE, click on &quot;Sketch&quot;, click on &quot;Import Library...&quot;, click on &quot;Add Library&quot;, and finally, browse for your library.</p>
<p>I did make it! But I have no image. Awesome job! you have the most simple way to solve this problem of Remote Controlling projects, and it only requires 1 pin!</p>
<p>im receiving this error?</p><p>C:\Program Files\Arduino\libraries\IRremote\IRremote.cpp:529: error: 'volatile struct irparams_t' has no member named 'rawlen'</p>
how did you fix it?
<p>already fixed it</p>
<p>Awesome! Thank you so much for this. You are very smart, and thank you for making this.</p>
<p>Hi, I do not get anything in the serial monitor</p>
<p>hi, thanks for you work</p><p>i switch, when i press 0 for example</p><p>switch(results.value){</p><p> case 16738455:</p><p> Serial.println(0);</p><p> irrecv.resume();</p><p> break;</p><p>i want it to print 0, but it loops forever, can you help me?</p>
<p>hi im trying to controll my arduino to move a servo. </p><p>Could you help me put in the code?</p><p>The controll gives off the infrared as i press left: FF22DD and right FFC23D. Please help me figure this out.<br><br> #include &lt;Servo.h&gt;<br> #include &lt;IRremote.h&gt;<br><br> unsigned long Value1 = 0xFF22DD; // where XXXXXXXX is on our your remote's values<br> unsigned long Value2 = 0xFFC23D; // where XXXXXXXX is another button on your remote<br><br> int RECV_PIN = 11;<br> IRrecv irrecv(RECV_PIN);<br> decode_results results;<br><br> Servo servo1;<br><br> // the setup routine runs once when you press reset:<br> void setup() { <br><br> Serial.begin(9600);<br> irrecv.enableIRIn(); // Start the receiver<br><br> // initialize the digital pin as an output.<br><br> servo1.attach(10); // attack servo to digital pin 10<br> }<br><br> // the loop routine runs over and over again forever:<br> void loop() {<br><br> if (irrecv.decode(&amp;results)) {<br> <br> Serial.println(results.value, HEX);<br> irrecv.resume(); // Receive the next value<br> }<br><br> if(results.value == Value1) {<br> servo1.write(160);<br> }<br> else if (results.value == Value2){<br> servo1.write(75);<br> }<br> } </p>
Hello, <br>Whenever I plug my Arduino(with the IR receiver), it always turns off as soon as I plug it into the computer. Any advice? <br>(btw, my arduino works fine with anything else plugged into it.)
hello I get this ' IRrevc' does not name a type
lidl remote FTW :D
I hade a small white IR receiver with only 2 leads. Would this work?
Excellent tutorial, very helpful. I have a quick question, what is the best way to deal with on/off of the same button. Since each button has two keys, i thought I could use them to turn on and off. it works, but the timing is an issue since the other key comes quickly after the first. What is the best way to deal with it? <br> <br>I tried: (but the button pressing has to be timed perfectly) <br> case key1: <br> digitalWrite(LED, HIGH); <br> delay(150); <br> break; <br> <br> case key2: <br> digitalWrite(LED, LOW); <br> delay(150); <br> break; <br> <br>Thanks!
I have done this before, but I did it with pins so I could check the current state of the pin and then decide whether or not to make it on or off. The way I did this in an Instructable of mine was <br> <br>switch (results.value) <br>case (blahblah) <br> { <br> if (digitalRead(pin) == LOW) <br> { <br> digitalWrite(pin, HIGH); <br> } <br> else <br> { <br> digitalWrite(pin, LOW); <br> } <br>} <br>} <br> <br>If you have multiple pins to check, just make it a function, call it for each case and pass in the pin number. Hope this helped.
help when i upload it marks that IRrecv irrecv(RECV_PIN); and says does not name the type
Which IR receiver did you use?
I don't know the type because I soldered it out maybe from an old dvd player but I'm not sure. I think it works on 38kHz.
Sparkfun has a great one for $1.95
Okay so i have a problem. I have already been able to get the ir codes from the remote that i wish to us but it will send something like this: <br>4035 <br>4035 <br>4035 <br>4035 <br>4035 <br>2553 <br>2553 <br>2553 <br> so the code is actually being send 5 times then another 3 are the end code. but sometimes if i press the button again the first number will either send 4 or 6 times. im not sure how to filter out the codes because if i just look for say 4035 it will repeat 4 to 6 times... um please if any one has an idea please help
Try an unsigned long so that in your program it looks like <br> <br>#include <br> <br>unsigned long someValue = 0xXXXXXXXX; // where XXXXXXXX is on our your remote's values. <br> <br>void loop(){ <br> <br>if(results.value == someValue) { <br> digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) <br> delay(1000); // wait for a second <br> digitalWrite(led, LOW); // turn the LED off by making the voltage LOW <br> delay(1000); // wait for a second <br>} <br> <br>} <br>
make a method that catches the first time that you receive the signal. then tell it to ignore the rest until you recieve the 2553 signal... something like this: <br> <br>boolean ignore=false; <br> <br>void setup(){ <br>... <br>} <br> <br>void loop(){ <br>int sig= ; <br>//set your input here, sending your input to the to sig. <br>if (!ignore&amp;&amp;sig==4035)doSomething(); <br>else ignore==true; <br>} <br> <br>}
Mine shows zeroes no matter what button I push on any remote.
How would i use the case function to turn on an led. What I want to do is have the led turn High as long as I hold the button and go low when I release. The problem though is that there are 2 codes for every button on my remote. I press it once and it gives 458. then if I press it again it gives 10458. If I hold the button down It spams the one code and If i release then hold it down again it spams the other code.<br>thanks
I've been receiving error codes saying &quot;error: 'EE008FC9' was not declared in this scope&quot;, how do i fix this? (BTW, EE008FC9 is a remote key code)
put it in decimal :)
new error: `.' cannot appear in a constant-expression
nvm fixed that now its expected ';' before break
Is that the original arduino UNO
No, probably it is not. But it is fully functional as well as the original.
I thought of it cause the power light in the original UNO is green and not blue

About This Instructable




More by phorvath92:Control your Arduino with a remote 
Add instructable to: