Instructables

Arduino - Control LEDs with a Remote Control

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.
ehameedullah5 months ago

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

ehameedullah5 months ago

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

Kamokaki6 months 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);
}
}

rogertikboy6 months ago

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)  rogertikboy6 months 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

Vaibhav1o11 year ago
Dude the code is wrong!!
RuiSantos (author)  Vaibhav1o11 year 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!
tashvin RuiSantos7 months ago
hey dude what if i use a remote control which i got with the arduino starter kit?
thanks :)
lpereira157 months ago
what if I want to do this without using a library?
RuiSantos (author)  lpereira157 months ago
If you don't want to use the library, you'll need to write a lot of code to do this simple project.
What I recommend you to do is to download the library and my code.
See which functions I'm using from the library.
And understand what they do.

Then instead of using the functions from the library you can create your own functions on a single Arduino skecth...

I hope this helps,
Rui
I've installed the IRremote library. Opened iRrevc, compiled and uploaded to Arduino. All looks as it should yet nothing prints in the serial monitor. I've tried ALL the baud rates (although I imagine you used 9600) yet the issue persists. My circuit is identical to yours. Only difference in brand/model of the IR Receiver... I've tried 2. One I salvaged from an old sony blu ray player and the other I bought at RadioShack (276-0640). Both are:
38kHz IR receiver
Supply Current: 0.27-0.45mA
Supply Voltage: 2.5-5.5V
Output Volt low: 100mV

I've also tried several remotes that I've confirmed are in perfect working order.

Any thoughts on the matter? If you'd like, PM me.

Thank you!!
faziefazie10 months ago
I follow your circuit diagram, but there are several problems
1. when I upload the code to Arduino, I keep get the wrong message that my Arduino port can't be read by my PC, but if I don't connect the ground and vcc from the circuit to Arduino, the port can be read by my PC.
2. After I upload the code (without connect the circuit and Arduino), I can't test my remote because the serial monitor can't be open if the circuit is connect to Arduino.
3. My IR receiver get hot when I connect it with Arduino.

is that something I did wrong? or can you give me more explanations about how to read the remote.

thanks.
RuiSantos (author)  faziefazie10 months ago
thanks for trying my project!
1) I didn't understand exactly that problem... :S can you upload others arduino sketches to your arduino? did you upload the IR library to the libraries folder from the arduino IDE?
2) If the answer I gave you in 1) doens't apply to you... try to reinstall the arduino IDE again and try to upload my code.
3) which IR receiver you're using?
did you follow exactly my schematics? because that shouldn't be happening!
Please let me know what I can help you more with