Introduction: Controlling LED's With an IR Remote

About: controlling LEDs with an IR Remote using an Arduino

Hi guys, I am Pranjal Verma and this is my tutorial on controlling LEDs with an IR remote. in this tutorial, we will know how to control LEDs on and off with an IR remote and we will be using Arduino Uno R3 for our circuit.

Step 1: Materials : Arduino Uno R3

Arduino Uno R3 is a microcontroller board which would help you to process the codes and makes your circuit work. You can also buy one if you don't have from

Step 2: 830 Point Breadboard

Breadboard will help you insert materials for making the circuit. you can also buy one from

Step 3: Cable for Arduino

This cable will help you to connect your Laptop to the Arduino. you can also buy one from

Step 4: IR Receiver

IR Receiver will help you to receive IR radiations and send the information to the Arduino. you can buy one from

Step 5: IR Remote

IR Remote sends IR Radiations to the IR Receiver. You can also buy one from

Step 6: Female to Female Jump Wires

Female to Female Jump Wires helps you to connect different materials on the breadboard. You can also buy one from

Step 7: LED

LED is a light emitting diode which glows when electricity supplied to it. You can also buy it from

Step 8: 220 Resistors

Resistors help to lessen the amount of current flowing in the circuit. You can also buy some from

Step 9: Code of the Tutorial

<p>#include <boarddefs.h><br>#include <IRremote.h>
#include <IRremoteInt.h>
#include <ir_Lego_PF_BitStreamEncoder.h>
int ledb = 13;
int ledg = 12;
int ledr = 8;
int ledy = 7;
int ledw = 2;
int r = 11;
IRrecv irrecv(r);
decode_results results;
long IRCode = 0;</p><p>void setup()
  irrecv.enableIRIn(); // Start the receiver
  pinMode(r,INPUT);</p><p>}</p><p>void loop()
  if (irrecv.decode(&results))
     IRCode = results.value;
     irrecv.resume(); // Receive the next value
    if (IRCode == 16724175){
      digitalWrite(ledb, !digitalRead(ledb));
    if (IRCode == 16718055){
      digitalWrite(ledg, !digitalRead(ledg));
    if (IRCode == 16743045){
      digitalWrite(ledr, !digitalRead(ledr));
    if (IRCode == 16716015){
      digitalWrite(ledy, !digitalRead(ledy));
    if (IRCode == 16726215){
      digitalWrite(ledw, !digitalRead(ledw));

Step 10: How to Create the Circuit

Step 11: Adding More Things to the Circuit

you can add more materials to the circuit by finding the codes of different buttons of the IR Remote and writing the codes for inserting them and write the codes for their working. for example, Below is the code I would be adding to the code I have written to make the LEDs glow in a pattern.

if (IRCode == 16712445){














digitalWrite(ledw,LOW); }

Step 12: Solutions If the Circuit Is Not Working

  1. Check the connections in the circuit if they are correct
  2. If you don't have an Elegoo IR Remote then find the codes of buttons of your IR Remote and replace your codes with the codes in IRCode == (your code)
  3. Check that you have copied the code correctly

Step 13: Thank You

please comment for any improvements to the tutorial