IR Remote Controlled Led With Arduino

Introduction: IR Remote Controlled Led With Arduino

About: Engineering student

Hey guys!

This is my first instructable. It was after spending some time on the net and with a IR remote I figured out how to use it. So I thought I would make it easy for the newbies.I have simply clubbed two programs both not my own. I must admit that I do not take any credits of writing the code myself. So lets start

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Before We Begin

The components required would be

  1. Arduino
  2. 1 kilo ohms resistor
  3. led
  4. breadboard
  5. wires
  6. IR remote
  7. IR sensor

I have used KEYES remote and sensor available online. Can chose your own.

Now a special library is required . Including the library will provide us with some special functions and save our time from writing our own.

Thanks to GITHUB they have made it available for all

Download the zip folder. After downloading unzip and give it a name of your choice. Paste the folder in the 'libraries' folder of your 'Arduino'

To ensure that the library is put properly in its place you can always check as shown in the image.

This will conclude all the requirements to begin

Step 2: The Connections

The connections are done according to the code which I've used.

If you look closely at the IR receiver you'll find a letter written at each pin. There are three pins . Like any other receiver there is one GND and Vs. Another pin is pinout. In my KEYES receiver 'G' is for GND , 'R' for Vs and 'Y' for pinout.

Pinout is connected to pin 11 of arduino.

Now to connect an led shall not be a trouble. I've used 1 Kilo ohms resistor to protect the led. Led is connected to pin 13( which also has an on board led).....Every thing here is just like the blink program

Step 3: CODE

#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
pinMode(13, OUTPUT);
irrecv.enableIRIn(); // Start the receiver
void loop() {
if (irrecv.decode(&results))
Serial.println(results.value); //value displayed in the serial window are in decimal
unsigned long data= results.value;
if(data==16736925) //select the value of the button of your choice
digitalWrite(13, HIGH); //this is the famous blink program
digitalWrite(13, LOW);
irrecv.resume(); // Receive the next value

As I had initially, I take no credits of the above code,except for putting them together.

Now if you look at the code you'll find that only one header file is included. Usually we tend to include the required header files by selecting 'Include Library' from the menu bar. What happens in such a case is there will be also included which will give 'TKD2 error' while verifying. So do not include it as it is not required.

Step 4: Explanations

The code is self explanatory,but to those who find it hard to understand let me give a brief overview.

In the setup I've enabled the receiver. In the loop , I'm printing the values received by the receiver in the serial window. Each key holds a value which is decoded and displayed in decimal on the screen. First try out the values of different keys(button). After knowing the value of the button of your choice enter that value in the 'if' statement for comparison. I've given a simple task of blinking the led. Do any action of your choice.

After performing the operation the sensor prepares to accept another value.

Step 5: Your Done

So now you have learnt how to assign task for each button. Try out with different remotes and assign various tasks.

All the best!!

Keep thinking ,Keep doing

Be the First to Share


    • Magnets Challenge

      Magnets Challenge
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest


    DIY Hacks and How Tos

    This is a really cool projects because you can use it to control just about anything from a TV remote.