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:
To follow this project you need the following parts:

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!
The infrared receiver is the component shown in the figure below. This is the TSOP4838.

Infrared receiver pins:
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.
In this part of the project you need to decode the IR signals associated with each button.
Connect the IR receiver accordingly to the schematics below.

To control the IR receiver, you need to install the IRremote Library in the Arduino IDE.
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); }
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:
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.
In this part, you’ll build the circuit with three LEDs that will be controlled using your remote.
Assemble all the parts by following the schematics below.

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); }
After adding the commands for each key in the previous code, you can upload it to your Arduino IDE.
In the end, you can control each LED individually using the buttons of your remote control.

Copyright ©2025. All Rights Reserved Emblab THE RAVE INNOVATION