Home > Projects > LED Projects > Control LED Using IR Remote : Simple

Control LED Using IR Remote : Simple

Summary of Control LED Using IR Remote : Simple


This article guides users on controlling an LED with an IR remote using an Arduino UNO. It details gathering components, wiring the circuit, installing the IRremote library, and uploading code to decode specific button signals. The project enables turning an LED on or off by pressing designated buttons on a standard IR remote, utilizing serial communication for debugging signal values.

Parts used in the LED Control with IR Remote:

  • Breadboard
  • LED
  • 220ohm resistor
  • Arduino UNO
  • TSOP382 IR receiver
  • Jumper or hookup wires

Hello everyone, In this instructables we will control LED using IR remote.

Step 1: Gather the Parts

  1. A breadboard
  2. A LED
  3. A 220ohm resistor
  4. An Arduino UNO
  5. A TSOP382 IR receiver
  6. Some jumper or hookup wires

Step 2: Wiring

Hookup all the components according to the circuit diagram shown above.

Step 3: Receive the IR Signals From the Remote

Download Ken Shirriffs IR library from github then add the library to “Arduino installation location\libraries\”

Upload the following code to your arduino:

#include <IRremote.h

int IR_Recv = 2; //IR Receiver Pin 2

IRrecv irrecv(IR_Recv);

decode_results results;

void setup(){

pinMode(13, OUTPUT);

Serial.begin(9600); //starts serial communication

irrecv.enableIRIn(); // Starts the receiver

}

void loop(){

if (irrecv.decode(&results))

{

long int decCode = results.value;

Serial.println(decCode);

irrecv.resume();

}

}

Then open the serial monitor on your arduino IDE and receive IR decimal signals by pressing buttons on your remote for this project we’ll need two IR decimal signals.
For me the IR decimal values are “3733801123” and “403429887” for Select and Power button respectively.

Step 4: The Final Code

Upload the following code to your arduino after replacing 3733801123 and 403429887 with your IR remote decimal code:

#include <IRremote.h>

int IR_Recv = 2; //IR Receiver Pin 2

IRrecv irrecv(IR_Recv);

decode_results results;

void setup(){

pinMode(13, OUTPUT);

Serial.begin(9600); //starts serial communication

irrecv.enableIRIn(); // Starts the receiver

}

void loop(){

if (irrecv.decode(&results))

{

long int decCode = results.value;

Serial.println(decCode);

if (results.value == 3733801123) //Select button

{

digitalWrite(13, HIGH);

Serial.println(“LED turned ON”);

}

if (results.value == 403429887) //Power button

{

digitalWrite(13, LOW);

Serial.println(“LED turned OFF”);

}

irrecv.resume();

}

}

Step 5: Done

Now just press the button of the remote whose code you assigned to your arduino to see your LED turning on and off.

Thanks for viewing.

Please write your questions or suggestions below.

Source:

Quick Solutions to Questions related to LED Control with IR Remote:

  • How do I install the required library for this project?
    Download Ken Shirriffs IR library from github then add the library to your Arduino installation location libraries folder.
  • What is the best way to find the decimal codes for my remote buttons?
    Open the serial monitor on your arduino IDE and receive IR decimal signals by pressing buttons on your remote.
  • Can I use any IR remote for this project?
    Yes, as long as you identify the specific IR decimal values for the buttons you wish to assign to control the LED.
  • Which pin should I connect the IR receiver to?
    The IR Receiver should be connected to Pin 2 on the Arduino as defined in the code.
  • Does the code turn the LED on or off based on specific buttons?
    Yes, the code turns the LED ON when the Select button code is detected and OFF when the Power button code is detected.
  • What happens if I replace the default codes in the final code?
    You must replace the default codes with your own IR remote decimal codes to ensure the correct buttons control the LED.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top