Remote controlled LED with Arduino

Remote control using Arduino

This is the mini project of IR REMOTE CONTROLLED OUTPUT. Here Output is used as LEDs , You can Connect high load using Relay. Any Remote can used . Particular key of Remote is used for Particular LED.

Posted by Electronics Circuit Diagram on Friday, 14 September 2018

How to program arduino ir sensor code

Now a days Infrared (IR) remote is widely used as wireless communication to control any appliances. There are many advantages of wireless technology.  TV/video remote controls, motion sensors, remote control toy, music player and infrared thermometers are very prominent example of wireless communication using  remote control.

In this section i am discussing about a simple arduino project of LEDs Control using Remote. In this project i will also see that how to set a particular key of remote for control a particular LED. Infrared Light is Type of light but human eye can’t see. This light has different wavelength and frequency from visible light. A lot of Infrared light also present in environment in the sunlight.

When we press the key of remote, then a special intensity of frequency of infrared light emits through the IR LED connected in remote. That Emitted IR Signal is detected by the Sensor (photodiode or other ir sensors) and this decodes the ir signal and modulated by the circuit. Here I am using HS0038 IR sensor for receiving and detecting the signal from remote. You can use different ir sensor Like TSOP1738.

ir sensor

Connect the Positive terminal of sensor with VCC of arduino board and ground pin with ground of arduino. Now the Output pin of sensor is connected with pin no 2 (you can connect with different digital output pin). Connect 10 LEDs,  positive terminal of all led with Pin no 4 to 13 in series resistor of each LED 220 Ω. These are outputs that can controlled by remote. 

Step 1 : download the Arduino-IRremote-2.1.0 zip file

Step 2 : Open Arduino (arduino IDE)

step 3 : Go to sketch⇒ Include Library⇒ Add .ZIP library

Step 4 : Select your file and click enter

How to Decode The Remote

Copy the following code and paste  and then verify and upload to arduino board

#include <IRremote.h>
int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);

decode_results results;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn(); 
}
  
void loop() {
if (irrecv.decode(&results)) {
    Serial.println(results.value, DEC);
    irrecv.resume();
  }
}

Go to   Tools⇒ Serial Monitor

Then a blank page opened

Now press the key one by one (which keys you want to use) for instantly . You will see the some coded value for each key.

Then Copy and paste the following code in new or write as your own by the using of these coded value with place of CASE.

#include <IRremote.h>
#define irPin 2
IRrecv irrecv(irPin);
decode_results results;
#define r1 4
int relay1 = LOW;
#define r2 5
int relay2 = LOW;
#define r3 6
int relay3 = LOW;
#define r4 7
int relay4 = LOW;
#define r5 8
int relay5 = LOW;
#define r6 9
int relay6 = LOW;
#define r7 10
int relay7 = LOW;
#define r8 11
int relay8 = LOW;
#define r9 12
int relay9 = LOW;
#define r10 13
int relay10 = LOW;

void setup()
{
irrecv.enableIRIn();
pinMode(r1, OUTPUT);
pinMode(r2, OUTPUT);
pinMode(r3, OUTPUT);
pinMode(r4, OUTPUT);
pinMode(r5, OUTPUT);
pinMode(r6, OUTPUT);
pinMode(r7, OUTPUT);
pinMode(r8, OUTPUT);
pinMode(r9, OUTPUT);
pinMode(r10, OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) {
switch (results.value) {
case 3772809343 :
digitalWrite(r1,0);
digitalWrite(r2,0);
digitalWrite(r3,0);
digitalWrite(r4,0);
digitalWrite(r5,0); //all off
digitalWrite(r6,0);
digitalWrite(r7,0);
digitalWrite(r8,0);
digitalWrite(r9,0);
digitalWrite(r10,0);
delay(250);

break;

case 3772793023 :
digitalWrite(r1,1);
digitalWrite(r2,1);
digitalWrite(r3,1);
digitalWrite(r4,1);
digitalWrite(r5,1); //all on
digitalWrite(r6,1);
digitalWrite(r7,1);
digitalWrite(r8,1);
digitalWrite(r9,1);
digitalWrite(r10,1);

break;

case 3772784863 :
relay1 = ~ relay1;
digitalWrite(r1,relay1);
delay(300);
break;
case 3772817503 :
relay2 = ~ relay2;
digitalWrite(r2,relay2);
delay(300);
break;
case 3772801183 :
relay3 = ~ relay3;
digitalWrite(r3,relay3);
delay(300);
break;
case 3772780783 :
relay4 = ~ relay4;
digitalWrite(r4,relay4);
delay(300);
break;
case 3772813423 :
relay5 = ~ relay5;
digitalWrite(r5,relay5);
delay(300);
break;
case 3772797103 :
relay6 = ~ relay6;
digitalWrite(r6,relay6);
delay(300);
break;
case 3772788943 :
relay7 = ~ relay7;
digitalWrite(r7,relay7);
delay(300);
break;
case 3772821583 :
relay8 = ~ relay8;
digitalWrite(r8,relay8);
delay(300);
break;
case 3772805263 :
relay9 = ~ relay9;
digitalWrite(r9,relay9);
delay(300);
break;
case 3772811383 :
relay10 = ~ relay10;
digitalWrite(r10,relay10);
delay(300);
break;

}

irrecv.resume();
}
}

Share this

About the Author

Admin

Hi, My name is Aman bharti, I am interested in making and study of Electronics & circuit diagram. I like to share my knowledge and all ideas with people which i get from My Experiment & from different sources. I try to provide any circuit details deeply with test result as possible as. You can contact me on- Email – [email protected]

Leave a Reply

Your email address will not be published.