loading
Picture of Arduino - Control LEDs with a Remote Control
Hi guys,
I'm sharing with you a project I've recently done. I'ts about how you can control some LED's with a remote control and your Arduino. But you can apply this to any electronic device such as motors , lights for example.


you can visit my website for more electronic projects, interesting news and tips:
http://randomnerdtutorials.com/


 
Remove these adsRemove these ads by Signing Up

Step 1: IR library

Picture of IR library
First you need to go to this page and download the IR library. You just need to follow the read me file to install. I think that any IR remote control can do this, I’ll be using a Philips Universal one.

Step 2: Parts required

Picture of Parts required
IMG_0170.JPG
Parts list:
1x Arduino
1x Breadboard
1x Remote control
1x IR receiver ( I’ll be using TSOP4838)
4x LED’s
4x 220ohm resistors
Jumper cables

The infrared receiver has 3 pins:
First pin: Vout, outputs HIGH when no signal is present and LOW when a mark is received.
Second pin: GND.
Third pin: Vcc.

Step 3: Circuit diagram

Picture of Circuit diagram
You need to wire your circuit something like this.
And then I went to the arduino IDE > file>examples>IRremote> IRrecvDemo. You need to upload the sketch to your arduino, open the serial monitor and start using your remote control and see which values the arduino is receiving.

After a while I’ve wrote down which values appear in the serial monitor when you press the volume up key or any other key, and write it down for all the keys you want to use. And they were:

Power:  E240
Forward: E250
Reverse: E248
Volume+: E244
Volume-: E254
Mute: E24C7
You will need to convert these hexadecimal numbers to decimal, you can use this tool for that.
1-40 of 45Next »
maitrteya5 days ago

Arduino: 1.6.6 Hourly Build 2015/07/21 05:42 (Windows 7), Board: "Arduino Uno"

IRrecvDemo.ino: In function 'void setup()':

IRrecvDemo:17: error: redefinition of 'void setup()'

sketch_jul26d:1: error: 'void setup()' previously defined here

IRrecvDemo.ino: In function 'void loop()':

IRrecvDemo:23: error: redefinition of 'void loop()'

sketch_jul26d:6: error: 'void loop()' previously defined here

Multiple libraries were found for "IRremote.h"

Used: D:\maitreya\Arduino\arduino-nightly\libraries\RobotIRremote

Not used: C:\Users\Maitru_2\Documents\Arduino\libraries\Arduino-IRremote-master

redefinition of 'void setup()'

This report would have more information with

"Show verbose output during compilation"

enabled in File > Preferences.

waht to do with this

tried using the library file and got this error C:\Program Files (x86)\Arduino\libraries\RobotIRremote\IRremoteTools.cpp:5: error: 'TKD2' was not declared in this scope

tried copying and pasting from above and IRrecvDemo.ino: In function 'void loop()':

IRrecvDemo:112: error: expected `;' before '}' token

can you please advise

i got the same problem please advice me what to do

maitrteya5 days ago

This report would have more information with

"Show verbose output during compilation"

enabled in File > Preferences.

Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno"

In file included from sketch_jul26b.ino:23:

C:\Program Files (x86)\Arduino\libraries\RobotIRremote/IRremoteInt.h:187: error: 'RAWBUF' was not declared in this scope

what is the meaning of this

there comes this error

ahmedH221 month ago

hey, I tried your project and it worked, but I have a little issues related to the distance at which I use my remote. The LEDs can only be switched at really short distances for me. Is it the same with you or my receiver isn't powerful enough ?

ahmedH221 month ago

in this we have to just change the received value from ir after the word "case...like case 1535313823"...or to do sometng else..? plz help .

ThatGuyMan1 month ago

undefined reference to `IRrecv::IRrecv(int)'

ThatGuyMan1 month ago

collect2: error: ld returned 1 exit status

Error compiling.

please help:( i hv no idea what that means

Hi,when I want use serial monitor to see which values the arduino is receiving.

But I cannot see any value returned. Is that because I don't use the philips remote?

Ramunekaz5 months ago

hi when i copy your code i get:

ir-led.ino: In function 'void loop()':

ir-led.ino:105:5: error: expected ';' before '}' token

Error compiling.

That mean you have a syntax error on line 105...

In the IDE, click on settings and activate "line number" option... Go to the line 105 and fix ot

Solved :) i missed this thingie ";" on line 105

Christo69113 months ago

LEDREMOTE.ino: In function 'void loop()':

LEDREMOTE.ino:112:5: error: expected ';' before '}' token

Multiple libraries were found for "IRremote.h"

Used: C:\Program Files (x86)\Arduino\libraries\RobotIRremote

Not used: C:\Users\SERVER\Documents\Arduino\libraries\Arduino-IRremote-master

nazir974 months ago

C:\Program Files (x86)\Arduino\libraries\RobotIRremote\IRremoteTools.cpp:5: error: 'TKD2' was not declared in this scope

what is it asking for and how can I fix it

Aryan251076 months ago

very nice project but i have some ir photodiode receiver can u give me sketch for it.

Aryan251076 months ago

very nice project but i have some ir photodiode receiver can u give me sketch for it.

Aryan251076 months ago

very nice project but i have some ir photodiode receiver can u give me sketch for it.

Aryan251076 months ago

very nice project but i have some ir photodiode receiver can u give me sketch for it.

Aryan251076 months ago

very nice project but i have some ir photodiode receiver can u give me sketch for it.

Aryan251076 months ago

very nice project but i have some ir photodiode receiver can u give me sketch for it.

Aryan251076 months ago

very nice project but i have some ir photodiode receiver can u give me sketch for it.

Aryan251076 months ago

very nice project but i have some ir photodiode receiver can u give me sketch for it.

Aryan251076 months ago

very nice project but i have some ir photodiode receiver can u give me sketch for it.

Aryan251076 months ago

very nice project but i have some ir photodiode receiver can u give me sketch for it.

hello. I am trying to code this for only one LED for 1 button on the remote control to my television. Every time I try to modify your code, I always get a whole bunch of errors, but the most annoying one is "Case label '********1' not within a switch statement. it always adds the 1 on the end, and I would like help on fixing this along with the other numerous errors that occumpany it. If you would please kindly ether message me or send code for only one led, that would be fantastic! great job by the way! Please respond!

Sincerely,Nic5153

dj505Gaming7 months ago

I noticed that in the code you can change HEX to DEC to avoid the conversion.

Specifically the example code for IRrecvDemo

KUPITO7 months ago

Amazing! Thanks for sharing this bro, this was my first project with an arduino. I was having a hard time at the beginning but it was because the pins of my receiver were different according to the datasheet. As an electric engineer. this could come pretty handy you could even control high power applications, instead of having a LED a relay would take place or a timer. Applications are limitless

Thanks dude this works perfectly for me.

I used this to operate a fan.

micmac9 months ago

The only tiny error I found (beside a missing ';') is that the IR discovery sketch used to capture the IR codes from the controller calls for a different receiver pin, 11 if I remember, where your setup calls for pin 3. Once that change is made in the code, it captures the IR perfectly and then goes on to control the LEDs perfectly. I'm well on my way to my remote control swiveling ceiling mounted garage fan. Thanks.

servalente11 months ago

Caro Rui, gostaria, se possível, que me desse uma ajuda numa questão relativa ao IR a funcionar com o arduino e controlo de leds. Faço modelos à escala, e no projecto que tenho em mãos gostava de aplicar luzes num camião à escala 1/8. Tenho tudo ligado, e quase a funcionar na perfeição, mas ainda não consegui deixar os sinais de pisca a funcionar. Tenho três códigos do IR disponiveis, para os piscas de esq. da direita e para os de emergência. Não consigo arranjar maneira de os deixar a piscar enquanto tenho outras luzes ligadas. Acha que me pode ajudar?

Obrigado desde já pela paciência.

i love instructable site becauze they do alot of different crazy project

i love instructable site becauze they do alot of different crazy project

Kamokaki1 year ago

hi im trying to controll my arduino to move a servo.

(Could you help me put in the code?

The controll gives off the infrared as i press left: FF22DD and right FFC23D. Please help me figure this out.)

#include <Servo.h>
#include <IRremote.h>

unsigned long Value1 = 0xFF22DD; // where XXXXXXXX is on our your remote's values
unsigned long Value2 = 0xFFC23D; // where XXXXXXXX is another button on your remote

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;

Servo servo1;

// the setup routine runs once when you press reset:
void setup() {

Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver

// initialize the digital pin as an output.

servo1.attach(10); // attack servo to digital pin 10
}

// the loop routine runs over and over again forever:
void loop() {

if (irrecv.decode(&results)) {

Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}

if(results.value == Value1) {
servo1.write(160);
}
else if (results.value == Value2){
servo1.write(75);
}
}

here is the error I got

IRrecvDemo:16: error: 'IRrecv' does not name a type
IRrecvDemo:17: error: 'decode_results' does not name a type
IRrecvDemo.ino: In function 'void setup()':
IRrecvDemo:27: error: 'irrecv' was not declared in this scope
IRrecvDemo.ino: In function 'void loop()':
IRrecvDemo:32: error: 'irrecv' was not declared in this scope
IRrecvDemo:32: error: 'results' was not declared in this scope
IRrecvDemo:67: error: expected `;' before '}' token

thanks again,

RuiSantos (author)  rogertikboy1 year ago

You need to install the IR library...

You didn't follow throught the Step number 1.. Please read that step carefully.

Have a nice day,

Rui

Vaibhav1o12 years ago
Dude the code is wrong!!
RuiSantos (author)  Vaibhav1o12 years ago
sorry for the long delay to answer... what you mean? it works fine for me and for a lot of people who already tried...
tell me what's not working, thanks!
hey dude what if i use a remote control which i got with the arduino starter kit?
thanks :)
1-40 of 45Next »