Introduction: TV Remote Controlled RGB Led

INTRODUCTION


Infrared remote control project is one of the popular projects for arduino lovers. We are here talking about the tv remote. There are various button of tv remote that are not used. Also if we can make this tv remote to control things other than tv than this will be cool and great.Arduino is an open source development board which is very good research and learning platform for technical and non technical person. It is very easy and comfortable to use in most of the situation from school project to the professional job. So it gives us knowledge about electronics and help develop idea of all age students.

Learning arduino is awesome with enough hardware.Infrared remote works on 38khz. Here I used a chinese cheap remote.

Step 1: Components Required

Picture of Components Required

1. computer or laptop

2. arduino (uno)

3. tv remote

4. IR receiver

5. some jumpers

6. Breadboard

Step 2: Hardware Setup or Circuit Diagram Preparation

Picture of Hardware Setup or Circuit Diagram Preparation

connect your components as shown in the diagram below with the help of bread board carefully.IR receiver is a three pin device and it has internal op-amp and decoder. It receives the binary signal of IR transmitted from the remote of tv and sends it to the pin 11 of the arduino.

=> face ir receiver towards you

=> connect right most pin to 5V of arduino

=> connect middle pin to gnd of arduino

=> connect left most pin to pin D11 of arduino digital i/o lines

Step 3: Installing IRremote.h Library to Your Arduino IDE

=> download the arduino IRremote library by clicking here.

=> extract it and copy the folder of IRremote to the following directory.

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

=> Remove the library folder named as RobotIRremote from the above directory

=> Then restart your arduino IDE if you already opened it.

IRremote library installation complete.

Step 4: Code of the Project

Test code

=> go to file>example>IRremotemaster> irrecvdemo

or

=> copy and paste the following code to your arduino ide

#include<IRremote.h>

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {

Serial.begin(9600);

irrecv.enableIRIn();

}

void loop() {

if (irrecv.decode(&results))

{ Serial.println(results.value, HEX);

irrecv.resume();

}

}

=> after uploading this code then open serial monitor and press any key and note the hex code with corresponding key that is shown in Serial monitor.

Step 5: RGB Led Connection

Picture of RGB Led Connection

=> connect your rgb led as described

red to pin 13

green to pin 10

blue to pin 9 of arduino

=> copy and paste the following code to your arduino IDE and upload it to your arduino. press your remote key from 1 to 7. various types of color can be achieved.

note: replace hex_code by your corresponding hex code that you noted before

here replace 1, 2 ,3,4,5,6,7 by your 0xhex_code obtained by pressing 1,2,3,4,5,6,7 .

(zero small x (0x) is necessary in front of your hex code. )

#include<IRremote.h>
int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {

Serial.begin(9600);

irrecv.enableIRIn();

}

void loop() {

if (irrecv.decode(&results))

{

Serial.println(results.value, HEX);

if(results.value==1)

{

digitalWrite(red,HIGH);

digitalWrite(green,LOW);

digitalWrite(blue,LOW);

}

else if(results.value==2)

{

digitalWrite(red,LOW);

digitalWrite(green,HIGH);

digitalWrite(blue,LOW);

}

else if(results.value==3)

{

digitalWrite(red,LOW);

digitalWrite(green,LOW);

digitalWrite(blue,HIGH);

}

else if(results.value==4)

{

digitalWrite(red,HIGH);

digitalWrite(green,HIGH);

digitalWrite(blue,LOW);

}

else if(results.value==5)

{

digitalWrite(red,HIGH);

digitalWrite(green,LOW);

digitalWrite(blue,HIGH);

}

else if(results.value==6)

{

digitalWrite(red,LOW);

digitalWrite(green,HIGH);

digitalWrite(blue,HIGH);

}

else if(results.value==7)

{

digitalWrite(red,HIGH);

digitalWrite(green,HIGH);

digitalWrite(blue,HIGH);

}

else {

digitalWrite(red,LOW);

digitalWrite(green,LOW);

digitalWrite(blue,LOW);

}

irrecv.resume();// Receive the next value

}

}

Step 6: Possible Problems

Every type of remote do not give simple number after decoding like 1, 2, 3 etc instead they give long hex code. This can not be directly used in if-else statement. So there is a method of placing 0x in front of the hex code in if else statement.so try the following code after you run the test code given above and either copy paste or modify the test code.

#include<IRremote.h>

int before;

int RECV_PIN = 11;

int led=13;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup(){

Serial.begin(9600);

irrecv.enableIRIn(); // Start the receiver

before=0;

pinMode(led, OUTPUT);// sets the digital pin as output

}

void loop() {

if (irrecv.decode(&results))

{

Serial.println(results.value, HEX);

irrecv.resume(); // Receive the next value

}

if(results.value==0xyour hex code) // for example 0xFF52AD

{

if(before==0)

{

digitalWrite(led,HIGH);

before=1;

}

}

else

{

digitalWrite(led,LOW);

before=0;

}

}



first open serial monitor to veiw the decoded hex code and use hex code in if else condition as guided above.
note that in this section where 'your hex code' is written there copy the code of your code shown in serial monitor of your arduino IDE.

comment for your queries and share the post so that other can view it. if i have done mistake please kindly make me known about that.. thanks for viewing the post...............

Comments

YUSUF6731 (author)2016-09-15

which ir receiver I use for it???

marcosd15 (author)2016-06-14

Help me

Arduino: 1.6.9 Hourly Build 2016/03/25 02:33 (Windows 10), Placa:"Arduino/Genuino Uno"

C:\Users\xxxxx\AppData\Local\Temp\arduino_modified_sketch_594982\sketch_jun14a.ino: In function 'void loop()':

sketch_jun14a:28: error: 'red' was not declared in this scope

digitalWrite(red,HIGH);

^

sketch_jun14a:30: error: 'green' was not declared in this scope

digitalWrite(green,LOW);

^

sketch_jun14a:32: error: 'blue' was not declared in this scope

digitalWrite(blue,LOW);

^

sketch_jun14a:40: error: 'red' was not declared in this scope

digitalWrite(red,LOW);

^

sketch_jun14a:42: error: 'green' was not declared in this scope

digitalWrite(green,HIGH);

^

sketch_jun14a:44: error: 'blue' was not declared in this scope

digitalWrite(blue,LOW);

^

sketch_jun14a:52: error: 'red' was not declared in this scope

digitalWrite(red,LOW);

^

sketch_jun14a:54: error: 'green' was not declared in this scope

digitalWrite(green,LOW);

^

sketch_jun14a:56: error: 'blue' was not declared in this scope

digitalWrite(blue,HIGH);

^

sketch_jun14a:64: error: 'red' was not declared in this scope

digitalWrite(red,HIGH);

^

sketch_jun14a:66: error: 'green' was not declared in this scope

digitalWrite(green,HIGH);

^

sketch_jun14a:68: error: 'blue' was not declared in this scope

digitalWrite(blue,LOW);

^

sketch_jun14a:76: error: 'red' was not declared in this scope

digitalWrite(red,HIGH);

^

sketch_jun14a:78: error: 'green' was not declared in this scope

digitalWrite(green,LOW);

^

sketch_jun14a:80: error: 'blue' was not declared in this scope

digitalWrite(blue,HIGH);

^

sketch_jun14a:88: error: 'red' was not declared in this scope

digitalWrite(red,LOW);

^

sketch_jun14a:90: error: 'green' was not declared in this scope

digitalWrite(green,HIGH);

^

sketch_jun14a:92: error: 'blue' was not declared in this scope

digitalWrite(blue,HIGH);

^

sketch_jun14a:100: error: 'red' was not declared in this scope

digitalWrite(red,HIGH);

^

sketch_jun14a:102: error: 'green' was not declared in this scope

digitalWrite(green,HIGH);

^

sketch_jun14a:104: error: 'blue' was not declared in this scope

digitalWrite(blue,HIGH);

^

sketch_jun14a:110: error: 'red' was not declared in this scope

digitalWrite(red,LOW);

^

sketch_jun14a:112: error: 'green' was not declared in this scope

digitalWrite(green,LOW);

^

sketch_jun14a:114: error: 'blue' was not declared in this scope

digitalWrite(blue,LOW);

^

Foram encontradas múltiplas bibliotecas para "IRremote.h"
Usado: C:\Users\Nana\Documents\Arduino\libraries\IRremote
Não usado: C:\Users\Nana\Desktop\arduino\arduino-nightly\libraries\IRremote
exit status 1
'red' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

pj200 (author)2016-02-20

can we make this with normal LEDs, if yes what changes should be made in the code

sangit-niroula (author)pj2002016-02-21

yes we can make this project with normal leds. just remove rgb leds and then place normal leds insted of rgb led. you can put 3 normal leds instead of a rgb led. actually rgb led is a composite led of three normal leds.

LEGOLEGOLEGOLEGO (author)2016-01-31

Where do you get all the supples?

I got it from the market of Kathmandu, Nepal. you can get them online from ebay or amazon or sparkfun or alibaba.

DIY Hacks and How Tos (author)2016-01-18

Awesome Arduino controller. You can use this kind of controller to control any number of different projects.

ya and thanks...

About This Instructable

2,796views

58favorites

License:

Bio: Electronics and Communication Engineer, Electronics and Robotics researcher. President at Cosmos Electronics Research Team(CERT) www.facebook.com/sangit.niroula
More by sangit-niroula:TV Remote Controlled RGB Led
Add instructable to: