Control LEDs Using an IR Remote With Arduino | Arduino Project

by | Nov 28, 2022 | Arduino, Coding

Home » Coding » Control LEDs Using an IR Remote With Arduino | Arduino Project


In this Arduino tutorial, we will learn how to Control LEDs using an IR remote with Arduino This comes under IoT (Internet of Things). In this project, we will control LEDs using an IR Remote. We will be able to turn on LEDs using buttons on the remote.

  • IR Remote is used to send IR(Infrared) signals, just like our TV remote.
  • LED stands for Light Emitting diode.



In order to do this project online, the TinkerCad website can be used, which is beneficial for learning purposes. Whereas for physical projects, the components can be purchased from any electronic store. in both cases, we will require the following components:


  • Arduino Uno R3
  • IR Remote
  • IR Sensor
  • 1 small Breadboard
  • 1 Breadboard mini
  • 4 LEDs of different colors
  • 4 resistors (220 ohms)
  • Connecting wires

Circuit Diagram

Steps To Control LEDs Using an IR Remote With Arduino

Step 1: Gather all the components on the Digital Board or Physical Table.

IR Sensor:

Step 2: Connect the three terminals of the IR sensor to the BreadBoard Mini.

Step 3: Connect the Power terminal of it to the 5V pin of Arduino.

Step 4: Connect the Ground terminal of it to GND in Arduino at the analog side using a Black colored wire.

Step 5: Connect the out terminal of it to the 2 number pin of the Arduino.


Step 6: Connect all four LEDs to the BreadBoard – Small.

Step 7: Connect the Anode terminals of it to pin numbers 12, 10, 8, and 6, respectively.

Step 8: Connect a resistor to the Cathode terminal of the LEDs and then connect it to the Grounding pin in Arduino using connecting wires.

Source Code

#include <IRremote.h>
int ledBlue = 12;
int ledRed = 10;
int ledGreen = 8;
int ledWhite = 6;
int IR_Sensor = 2;
IRrecv irrecv(IR_Sensor);
decode_results result;
void setup()
pinMode(ledBlue, OUTPUT);
pinMode(ledRed, OUTPUT);
pinMode(ledGreen, OUTPUT);
pinMode(ledWhite, OUTPUT);

Serial.println("Enabling IRin");
Serial.println("Enabled IRin");
void loop()
if (irrecv.decode(&result))
unsigned int value = result.value;
switch (value)
case 2295:
digitalWrite(ledBlue, HIGH);
digitalWrite(ledBlue, LOW);

case 34935:
digitalWrite(ledRed, HIGH);
digitalWrite(ledRed, LOW);

case 18615:
digitalWrite(ledGreen, HIGH);
digitalWrite(ledGreen, LOW);

case 10455:
digitalWrite(ledWhite, HIGH);
digitalWrite(ledWhite, LOW);



Explanation of the Code

Let us understand the code that we have created to Control LEDs using an IR remote with Arduino.

1. In the beginning, we included the header file IRremote.

2. After that, we initialized the LEDs to integer values 12,10,8 and 6, respectively, which denotes the pin number to which they are connected in Arduino Uno. Also, we have declared the IR_Sensor variable to pin number 2.

3. After that, we used the IR library function and variable.

4. Now, after this, we have used two functions, that is, setup and loop.

5. In the setup function, we have declared that we are using LEDs pin numbers for output purposes.

6. The serial.begin() is for enabling serial communication between Arduino and remote.

7. In the loop function, we are using the if statement; if some input is received, it will store its value of it in the value variable.

8. Now, to know which LED we need to glow on which value, we have used a switch case.

9. Inside the switch case, if a particular value is there, we make that LED high for some time and then again make it low.

10. We are doing it using a delay function, which takes time in milliseconds.

11. Atlast, to continue it further, we have used the last function to receive the next value.


We will get the following output on the successful completion of the project Control LEDs Using an IR Remote With Arduino.

Click any of the first four switches;

  • On clicking 1 numbered switch, the first LED will glow,
  • On clicking switch number 2 from the IR Remote, Red LED turns on.
  • On clicking switch number 3, the green LED will glow, and
  • On clicking the 4 numbered switch, the white LED will glow.

Control LEDs Using an IR Remote With Arduino

Thus, using this, we don’t even need to go there to turn on the LEDs.


You May Also Like To Create…


Submit a Comment

Your email address will not be published. Required fields are marked *