Arduino - Control LED's With IR Remote Control
Maybe your like
In this project you’ll use an infrared (IR) receiver and an Arduino to control 3 LEDs with a remote control. This is useful to re-use old remote controls or give some functionally to some of your remote’s buttons.

Updated 17 December 2024
This project is divided into two parts:
- You’ll decode the IR signals transmitted by your remote control
- You’ll use that info to perform a task with your Arduino (control 3 LEDs)
Parts required
To follow this project you need the following parts:

- Arduino UNO – read Best Arduino Starter Kits
- 1x Breadboard
- 1x Remote control
- 1x IR receiver ( I’ll be using TSOP4838)
- 3x LED’s
- 3x 220 Ohm resistors
- Jumper wires
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!

Introducing the Infrared (IR) Receiver
The infrared receiver is the component shown in the figure below. This is the TSOP4838.

Infrared receiver pins:
- First pin: Vout
- Second pin: GND
- Third pin: Vcc
When you press your remote control, it sends infrared modulated signals. These signals contain information that your receiver collects.

Each button sends specific information. So, we can assign that information to a specific button.
Decode the IR signals
In this part of the project you need to decode the IR signals associated with each button.
Schematics
Connect the IR receiver accordingly to the schematics below.

Code
To control the IR receiver, you need to install the IRremote Library in the Arduino IDE.
Installing the IRremote library
- Go to Sketch > Include Library > Manage Libraries.
- The Library Manager should open at the left sidebar of the IDE. Search for IRremote.
- Install the library by shirriff. We’re using version 4.4.1.

Copy the following code to your Arduino IDE, and upload it to your Arduino board. Make sure that you have the right board and COM port selected.
#include <IRremote.h> const int RECV_PIN = 11; void setup() { Serial.begin(9600); IrReceiver.begin(RECV_PIN, ENABLE_LED_FEEDBACK); // Initialize the receiver } void loop() { if (IrReceiver.decode()) { // Check if data is received // Filter out unknown protocols if (IrReceiver.decodedIRData.protocol == UNKNOWN) { IrReceiver.resume(); // Resume receiving for the next signal return; // Skip this loop iteration } // Print only valid data IrReceiver.printIRResultShort(&Serial); // Print complete received data in one line IrReceiver.resume(); // Resume receiving for the next signal } delay(100); }View raw code
Open the serial monitor at a baud rate of 9600.

In this project you want to control 3 LEDs. Choose 6 keys on the remote control for the following tasks:
- LED1 – ON
- LED1 – OFF
- LED2 – ON
- LED2 – OFF
- LED3 – ON
- LED3 – OFF
Press, for example, the button number 1 of your remote control. You should get some information about that key in the Serial Monitor. Save the “command” value for that key.

Do the same for the other buttons.
Write down the code associated with each button, because you’ll need that information later.
Building the final circuit
In this part, you’ll build the circuit with three LEDs that will be controlled using your remote.
Schematics
Assemble all the parts by following the schematics below.

Code
Now, grab the command values you captured in the previous step for each button. You’ll need to insert them on the following code.
/* * Modified by Rui Santos, http://randomnerdtutorialscom * based on IRremote Library - Ken Shirriff */ #include <IRremote.h> const int RECV_PIN = 11; const int bluePin = 10; const int greenPin = 9; const int yellowPin = 8; void setup() { Serial.begin(9600); // Start serial communication IrReceiver.begin(RECV_PIN, ENABLE_LED_FEEDBACK); // Start the receiver pinMode(bluePin, OUTPUT); // Set the pins as output pinMode(greenPin, OUTPUT); pinMode(yellowPin, OUTPUT); } void loop() { // Decode the infrared input if (IrReceiver.decode()) { if (IrReceiver.decodedIRData.protocol == UNKNOWN) { IrReceiver.resume(); // Resume receiving for the next signal return; // Skip this loop iteration } // Print the received command for debugging IrReceiver.printIRResultShort(&Serial); switch (IrReceiver.decodedIRData.command) { case 0x01: // Command to turn ON the blue LED digitalWrite(bluePin, HIGH); Serial.println("Blue LED ON"); break; case 0x02: // Command to turn ON the green LED digitalWrite(greenPin, HIGH); Serial.println("Green LED OFF"); break; case 0x03: // Command to turn ON the yellow LED digitalWrite(yellowPin, HIGH); Serial.println("Yellow LED ON"); break; case 0x04: // Command to turn OFF the blue LED digitalWrite(bluePin, LOW); Serial.println("Blue LED OFF"); break; case 0x05: // Command to turn OFF the green LED digitalWrite(greenPin, LOW); Serial.println("Green LED OFF"); break; case 0x06: // Command to turn OFF the yellow LED digitalWrite(yellowPin, LOW); Serial.println("Yellow LED OFF"); break; default: // Unknown command Serial.println("Unknown Command"); break; } IrReceiver.resume(); // Receive the next value } delay(10); }View raw code
After adding the commands for each key in the previous code, you can upload it to your Arduino IDE.
Demonstration
In the end, you can control each LED individually using the buttons of your remote control.

Watch the video demonstration
Wrapping Up
This is a great project to learn about the IR receiver. There are endless possibilities for what you can do with it.
For example, you can replace those LEDs with a relay to control your house appliances. Associate a button to turn off or turn on all the LEDs at the same time, etc.
This can be particularly useful because some remotes have a bunch of buttons that you never use. So, why not use them to do something useful?
This is an excerpt from our course: Arduino Step-by-step projects. If you like Arduino and you want to build more projects, we recommend enrolling in the Arduino Step-by-step projects course.
Tag » Arduino Ir Remote Led On Off
-
Turn LEDs On/Off Via Remote Control - Arduino Project Hub
-
Control An LED With The Remote Control - Arduino Project Hub
-
Using An IR Remote With LEDs - Arduino Project Hub
-
Arduino IR Remote To Control LEDs ON And OFF - ElectroSchematics
-
ARDUINO: IR REMOTE CONTROL OF LEDS - YouTube
-
Control LED Using IR Remote : Simple : 5 Steps - Instructables
-
Control LEDs Using IR Remote And Arduino - Microcontrollers Lab
-
Control-LEDs-ON-OFF-with-IR-Remote-and-Arduino - GitHub
-
How To Control LEDs With An Arduino, IR Sensor, And Remote
-
Turn Led ON/OFF With Any Remote Control | By Julien Louage - Medium
-
How To Set Up An IR Remote And Receiver On An Arduino
-
Arduino IR Remote Controller Tutorial - Setup And Map Buttons
-
IR Remote Controlled LED Chaser Using Arduino - Engineers Garage
-
Control A Led Using Infrared Sensor And Give Command By IR ...