Introduction: Arduino IR Remote Control

Picture of Arduino IR Remote Control


By using arduino and IR Receiver TSOP 1738 (in our project, you can use any ir receiver available) we can decode any infrared remote code into hex or some other format. Before constructing the circuit check datasheet of IR receiver having in your hand, hence you can connect proper bias pins and output pin.

Step 1: Wiring Components

Picture of Wiring Components

To read the IR rays from remote control by arduino board we need external library that is IRremote library, you can get IRremote library here. (how to insert new library in arduino IDE)

Step 2: Receiving IR Hex Code

Picture of Receiving IR Hex Code

In this project first we have executed the IRrecvDemo example program from the arduino IR library example and decoded IR rays from remote.

(Note: If you have any error while running this library, remove “IRremoteTools.cpp” from libraries\RobotIRremote\IRremoteTools.cpp)

Arduino Code for Receiving IR as Hex code

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()



irrecv.enableIRIn(); // Start the receiver


void loop(){

if (irrecv.decode(&results)) {

Serial.println(results.value, HEX);

irrecv.resume(); // Receive the next value }


Step 3: Remote Control With Arduino

Picture of Remote Control With Arduino

Then we used decoded data as switching condition in arduino sketch to turn on and off the three LEDs.

Arduino Code

#include <IRremote.h>

int RECV_PIN = 11; //

int output1 = 2;

int output2 = 4;

int output3 = 6;

int itsONled[] = {0,0,0,0};

#define code1 0xFF807F //

#define code2 0xFFA05F //

#define code3 0xFF906F //

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {

Serial.begin(9600); //

irrecv.enableIRIn(); //

pinMode(output1, OUTPUT);

pinMode(output2, OUTPUT);

pinMode(output3, OUTPUT);


void loop() {

if (irrecv.decode(&results)) {

unsigned int value = results.value;

switch(value) {

case code1:

if(itsONled[1] == 1) { //

digitalWrite(output1, LOW); //

itsONled[1] = 0; // } else { //

digitalWrite(output1, HIGH); //

itsONled[1] = 1; //



case code2:

if(itsONled[2] == 1) {

digitalWrite(output2, LOW);

itsONled[2] = 0; } else {

digitalWrite(output2, HIGH);

itsONled[2] = 1;



case code3:

if(itsONled[3] == 1) {

digitalWrite(output3, LOW);

itsONled[3] = 0; } else {

digitalWrite(output3, HIGH);

itsONled[3] = 1;




Serial.println(value); // you can comment this line

irrecv.resume(); // Receive the next value



Step 4: Prototype

Picture of Prototype


hack_everything (author)2016-03-28

can you use motors instead of leds?

Yes you can! but you should use ic L293D to drive motors.

Thank you

havent got the parts yet but there coming

thanks I will give it a go

SimonF81 made it! (author)2017-01-17

Great project. I modified it to handle 6 outputs, worked a treat.

Thanks for sharing.

DAEHWANL made it! (author)2017-01-10

I made it! Sorry, I'm poor at English.


1. STEP 2 : IR Receiving hex code

You can measure the hex code of pressed button from the serial monitor.

ex) my remote control, **without external lighting**

press "7" >> Serial monitor 6375 (hex code = 0x18E7)

press "8" >> Serial monitor 39015(hex code = 0x9867)

press "9" >> Serial monitor 22695(hex code = 0x58A7)

2. STEP 3 : Remote Control with Arduino

change code


#define code1 0xFF807F >> #define code1 0x18E7 (or 6375)

#define code2 0xFFA05F >> #define code2 0x9867 (or 39015)

#define code3 0xFF906F >> #define code2 0x58A7 (or 22695)

press "7" >> LED ON/OFF (Pin 2)

press "8" >> LED ON/OFF (Pin 4)

press "9" >> LED ON/OFF (Pin 6)

Tanmay Deuskar (author)2016-08-04


I am using a VS 1838 ir receiver. The receiver is working but when I press an button on my remote the serial monitor shows many HEX values for the same button. What can I do about that?

DJman230 made it! (author)2016-07-27

Hey, Thank you very much for this tutorial. I made it, and it works!! Do you know why I get these errors?

avishwakarma8 (author)2016-05-05

sir can u write code for 4 LED's plz

aayush swami (author)2016-04-20

my code running perfect but serial monitor is showing garbage values without connecting TSOP1136 . But after connecting it does not takes any values in IRrecvDemo.ino

adithyapaip (author)2016-02-04

please help me...I am getting error saying fatal error WProgram.h no such file or directory....

manav786 (author)2016-01-26

my arduino hanged when ir remote was used after sometime.
it doesnt works whenever i'll press reset switch.
help plz.

manav786 (author)2016-01-26

my arduino hanged when ir remote was used after sometime.
it doesnt works whenever i'll press reset switch.
help plz.

TexanFan made it! (author)2016-01-17

I knew the original code worked so I had to figure out why it wasn't working for me....

I removed the 0x from in front of the IR code....and just used the codes I was viewing from my remote on the Serial monitor and it's all good.... I also removed all the // from here and there in the program and I am good to go.

#define code1 0xFF807F //

This has been an awesome experience...

PS. I used a TSOP4838 it was all I fine for now...will buy the recommended TSOP later.

Patel Trushang (author)2015-12-25

hey i like your project. can you write code for 8 leds? please send to

About This Instructable




More by theorycircuit:Experiment-Resistor Exposed on Different TemperatureMotorized Fidget SpinnerArduino Mario Melody Tune
Add instructable to: