REMOTE CONTROLLED LEDS

    
 

WANT TO CONTROL YOUR ELECTRONIC DEVICES WITH ANY REMOTE ? WELL YOU'RE IN THE RIGHT PLACE

Here, we will create a system that controls LEDs through IR signals of a remote. This project is called "Remote Controlled LEDS".

WORKING PROCEDURE 

Active IR Sensors can emit IR radiation as well as detect it. In this project a remote transmits IR signals and an IR sensor receives it. The HEXADECIMAL code is noted down for each button pressed ,applied in the code and necessary commands are written to control the LEDs.

Keep in Mind:

  • Resistor of at least 100 Ohms should be connected in series with each of the LEDs to protect it from getting damaged.
  • The HEX code must be placed correctly in the code.
  • Some remotes generate multiple HEX values of  a single button. So the buttons should be pressed within a very close range of the IR receiver. This will solve the problem for most of the cases.

THE COMPONENTS

  • ARDUINO UNO BOARD                              
  • LED:--> BLUE-YELLOW-WHITE [ according to your wish ]                
  • RESISTOR 100 Ohms - X3
  • IR SENSOR                  
  • BUZZER
  • BREAD BOARD
  • ANY REMOTE                            
  • JUMPER WIRES ( M-M | M-F )     

SCHEMATIC

RemoteControlledLEDs-Schematic
SCHEMATIC DIAGRAM OF REMOTE CONTROLLED LEDS


THE COMPLETE CODE

/*author : Sadman Alvee -> owner of impedancPlus*/ #include<IRremote.h>
#include<ir_Lego_PF_BitStreamEncoder.h> //IRSensor int irPin = 6; //LEDs and Buzzer int blueLedPin = 13; int yellowLedPin = 9; int whiteLedPin = 4; int buzzerPin = 7; //Creating object of type-IRrecv IRrecv IR(irPin); //Creating object of type-decode_results decode_results decodeResult; void configureLedBuzzerSystem(int remoteButton) { switch (remoteButton) { case 1 : { digitalWrite(blueLedPin, HIGH); digitalWrite(buzzerPin, HIGH); delay(1000); digitalWrite(blueLedPin, LOW); digitalWrite(buzzerPin, LOW); } break; case 2 : { digitalWrite(yellowLedPin, HIGH); digitalWrite(buzzerPin, HIGH); delay(1000); digitalWrite(yellowLedPin, LOW); digitalWrite(buzzerPin, LOW); } break; case 3 : { digitalWrite(whiteLedPin, HIGH); digitalWrite(buzzerPin, HIGH); delay(1000); digitalWrite(whiteLedPin, LOW); digitalWrite(buzzerPin, LOW); } break; case 4: { for (int i = 0; i < 10; i++) { digitalWrite(blueLedPin, HIGH); digitalWrite(buzzerPin, HIGH); delay(200); digitalWrite(blueLedPin, LOW); digitalWrite(buzzerPin, LOW); delay(50); digitalWrite(yellowLedPin, HIGH); digitalWrite(buzzerPin, HIGH); delay(200); digitalWrite(yellowLedPin, LOW); digitalWrite(buzzerPin, LOW); delay(50); digitalWrite(whiteLedPin, HIGH); digitalWrite(buzzerPin, HIGH); delay(200); digitalWrite(whiteLedPin, LOW); digitalWrite(buzzerPin, LOW); delay(50); } } break; case 5: { for (int i = 0; i < 10; i++) { digitalWrite(blueLedPin, HIGH); digitalWrite(yellowLedPin, HIGH); digitalWrite(whiteLedPin, HIGH); digitalWrite(buzzerPin, HIGH); delay(400); digitalWrite(blueLedPin, LOW); digitalWrite(yellowLedPin, LOW); digitalWrite(whiteLedPin, LOW); digitalWrite(buzzerPin, LOW); delay(400); } } break; case 6: { digitalWrite(blueLedPin, HIGH); digitalWrite(yellowLedPin, HIGH); digitalWrite(whiteLedPin, HIGH); digitalWrite(buzzerPin, HIGH); delay(1500); digitalWrite(blueLedPin, LOW); digitalWrite(yellowLedPin, LOW); digitalWrite(whiteLedPin, LOW); digitalWrite(buzzerPin, LOW); } break; } } void configureIRsensor() { while (IR.decode(&decodeResult) == 0) { } //Displays the hex value of the remote button pressed Serial.println(decodeResult.value, HEX); delay(100); /* decodeResult.value == "0x________" here in the dashed area after 0x put the hexadecimal values of the button pressed */ //LED-BLUE if (decodeResult.value == 0x48DEC02C) configureLedBuzzerSystem(1); //LED-YELLOW else if (decodeResult.value == 0xB46EC5C3) configureLedBuzzerSystem(2); //LED-WHITE else if (decodeResult.value == 0x6C969A63) configureLedBuzzerSystem(3); //LED-all leds Bliknking in pattern else if (decodeResult.value == 0xEA2CA9EB) configureLedBuzzerSystem(4); //LED-all leds blinking at once multiple times else if (decodeResult.value == 0x247631DA) configureLedBuzzerSystem(5); //LED-all leds blinking only once else if (decodeResult.value == 0xCC6D5D17) configureLedBuzzerSystem(6); IR.resume(); } void setup() { // put your setup code here, to run once: pinMode(blueLedPin, OUTPUT); pinMode(yellowLedPin, OUTPUT); pinMode(whiteLedPin, OUTPUT); pinMode(buzzerPin, OUTPUT); IR.enableIRIn(); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: configureIRsensor(); }

Comments