12/13/2019 Controlling LED's using Remote Control - Arduino Project
HOME / PROJECTS, EMBEDDED, ARDUINO / CONTROLLING LED’S USING IR REMOTE CONTROL – ARDUINO PROJECT
Controlling LED’s using IR Remote Control – Arduino Project
Open source z wave controller
Connect to your cloud. Z wave, Zigbee protocol compatible hub. Supply
free SDK and API.
dusuniot.com OPEN
23 Controlling LED’s using IR Remote Control – Arduino Project
Feb By Ali Hamza Arduino, Embedded, Projects IR Receiver, IR Sensor, IR Transceiver, LED Control, Remote, Sensor
0 Comments
This article allows you to turn ON and OFF LED’s using a cheap IR remote control. Here we used
Contents
an available IR Arduino library so it was pretty easy to decode the signals transmitted by the
infrared remote. 1 Required Components
2 Hardware
The LED’s which are connected to Arduino will be controlled by IR Transceiver module. IR 2.1 Circuit Diagram
Transmitter i.e., Remote transmits unique code to IR sensor wirelessly. IR sensor receives that 2.2 Circuit Diagram Explanation
signal and controls the LED’s which are connected to Arduino according to Code. 3 Software
3.1 Arduino Code
Required Components
3.2 Code Explanation
4 Working
5 Practical Implementation
6 Video
IR sensor
Arduino Uno
4 X Led’s
4 X 220 ohm resistors
Remote
Connecting wires
Breadboard
Hardware
Circuit Diagram
https://electrosome.com/led-control-ir-remote/ 1/11
12/13/2019 Controlling LED's using Remote Control - Arduino Project
LED Control Using IR Receiver – Circuit Diagram
Circuit Diagram Explanation
First of all, connect the LED’s with Arduino. Connect the positive side of the four LED’s to the pins 7, 6, 5 and 4 of Arduino and the
negative side of LED’s to the GND of Arduino through the 220 ohm resistors. The resistors are necessary because they prevent the
excess amount of current from owing through the LED’s.
After that, make the connections of the IR sensor with the Arduino as follows
Open source z wave controller
Connect to your cloud. Z wave, Zigbee protocol compatible hub. Supply
free SDK and API.
dusuniot.com OPEN
Connect the negative of IR sensor to the GND of Arduino.
Connect the positive of IR sensor to the 5V pin of Arduino.
Connect the signal pin of IR sensor to the pin 8 of Arduino.
Software
Arduino Code
https://electrosome.com/led-control-ir-remote/ 2/11
12/13/2019 Controlling LED's using Remote Control - Arduino Project
#include <IRremote.h>
int receiver_pin = 8;
int first_light_pin = 7;
int second_light_pin = 6;
int third_light_pin = 5;
int fourth_light_pin = 4;
int led_case[] = {0,0,0,0};
IRrecv receiver(receiver_pin);
decode_results output;
#define code1 48703
#define code2 58359
#define code3 6375
#define code4 25979
void setup()
{
Serial.begin(9600);
receiver.enableIRIn();
pinMode(first_light_pin, OUTPUT);
pinMode(second_light_pin, OUTPUT);
pinMode(third_light_pin, OUTPUT);
pinMode(fourth_light_pin, OUTPUT);
}
void loop()
{
if (receiver.decode(&output))
{
unsigned int value = output.value;
switch(value)
{
case code1:
if(led_case[1] == 1)
{
digitalWrite(first_light_pin, LOW);
led_case[1] = 0;
}
else
{
digitalWrite(first_light_pin, HIGH);
led_case[1] = 1;
}
break;
case code2:
if(led_case[2] == 1)
{
digitalWrite(second_light_pin, LOW);
led_case[2] = 0;
}
else
{
digitalWrite(second_light_pin, HIGH);
led_case[2] = 1;
}
break;
case code3:
if(led_case[3] == 1)
{
digitalWrite(third_light_pin, LOW);
led_case[3] = 0;
}
else
{
digitalWrite(third_light_pin, HIGH);
led_case[3] = 1;
}
https://electrosome.com/led-control-ir-remote/ 3/11
12/13/2019 Controlling LED's using Remote Control - Arduino Project
break;
case code4:
if(led_case[4] == 1)
{
digitalWrite(fourth_light_pin, LOW);
led_case[4] = 0;
}
else
{
digitalWrite(fourth_light_pin, HIGH);
led_case[4] = 1;
}
break;
}
Serial.println(value);
receiver.resume();
}
}
Code Explanation
First of all, we need to include the library for the IR sensor and IR remote. Then we initialized the pins where we connected the led’s
and set the initial state of the led’s as o state.
#include <IRremote.h>
int receiver_pin = 8;
int first_light_pin = 7;
int second_light_pin = 6;
int third_light_pin = 5;
int fourth_light_pin = 4;
int led_case[] = {0,0,0,0};
Then we de ned the code for each button through which we want to control the led. If you are running the Arduino code for the rst
time then upload the Arduino code as it is and open the Serial monitor. Press the button from the remote and a code will be shown
on the serial monitor for each button.
#define code1 48703
#define code2 58359
#define code3 6375
#define code4 25979
In the setup function, we have made the led pins as output pins because we will give the output to the led’s through that pins.
pinMode(first_light_pin, OUTPUT);
pinMode(second_light_pin, OUTPUT);
pinMode(third_light_pin, OUTPUT);
pinMode(fourth_light_pin, OUTPUT);
Whenever a button is pressed, a code is received by the IR sensor and is given to the Arduino. The Arduino will then compare it to
the already saved codes and if any of the code will match then it will turn on the led connected to that code. If the LED is already
light up and the same button is pressed again then the led will go down.
https://electrosome.com/led-control-ir-remote/ 4/11
12/13/2019 Controlling LED's using Remote Control - Arduino Project
if (receiver.decode(&output))
{
unsigned int value = output.value;
switch(value)
{
case code1:
if(led_case[1] == 1)
{
digitalWrite(first_light_pin, LOW);
led_case[1] = 0;
}
else
{
digitalWrite(first_light_pin, HIGH);
led_case[1] = 1;
}
break;
case code2:
if(led_case[2] == 1)
{
digitalWrite(second_light_pin, LOW);
led_case[2] = 0;
}
else
{
digitalWrite(second_light_pin, HIGH);
led_case[2] = 1;
}
break;
case code3:
if(led_case[3] == 1)
{
digitalWrite(third_light_pin, LOW);
led_case[3] = 0;
Working
Whenever a button is pressed on the IR remote, an IR led blinks thousands of time in a fraction of second and sends that data to the
IR receiver in the coded form. The IR receiver receives this signal and sends it to Arduino.
Each button has a unique code. So we have saved the codes for the buttons to which we want to control the LED’s in the Arduino
code. Now whenever a button is pressed, then an unique code will be received by the IR receiver and sends to Arduino. Then the
Arduino compares this received unique code with the saved codes. If any of the code matches with the Arduino pre-stored code
then Arduino will turn ON the appropriate LED light.
Practical Implementation
LED Control Using IR Receiver – Practical Implementation
https://electrosome.com/led-control-ir-remote/ 5/11
12/13/2019 Controlling LED's using Remote Control - Arduino Project
Video
Controlling LED's using IR Remote Control - Arduino Uno
Open source z wave controller
Connect to your cloud. Z wave, Zigbee protocol compatible hub. Supply
free SDK and API.
dusuniot.com OPEN
Like 4.8K people like this. Sign Up to see what your
friends like.
https://electrosome.com/led-control-ir-remote/ 6/11
12/13/2019 Controlling LED's using Remote Control - Arduino Project
Related Posts:
Controlling DC
Motors using Interfacing PIR Interfacing Soil Controlling of DC
Arduino and IR Motion Sensor with Moisture Sensor with Digital Door Lock Motors using
Remote Arduino Arduino using Arduino MPU5060
Temperature LED Control by
Controlled Fan using Interfacing Rain ESP8266 as Web
Arduino Sensor with Arduino Server – IoT
Share this post
Author
Ali Hamza
Leave a Reply
Your email address will not be published. Required elds are marked *
Comment
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
POST COMMENT
https://electrosome.com/led-control-ir-remote/ 7/11
12/13/2019 Controlling LED's using Remote Control - Arduino Project
RELATED POSTS
Sending E-mail Siren Generator Interfacing Contro
from ESP8266 – using IC UM3561 Ultrasonic Distance using E
IoT Project August 6, 2014 | Vivek Kartha | Sensor : ASCII Telegra
Electronics, Hobby Circuits,
January 17, 2019 | Basamma B | Projects | UM3561 | 9 Comments Output with PIC Project
Electronics, Embedded, ESP8266,
IoT, Projects | API, Arduino,
IC UM3561 is a CMOS LSI IC
commonly used in alarm and toy
Microcontroller December 21
base64encode, Email Sending, | Embedded
applications. It is able to March 7, 2013 | Ligo George |
ESP8266, IoT, IoT Project, SMTP Projects | ES
generate... Embedded, MikroC, PIC
Server | 0 Comments Automation,
Read More Microcontroller, PIC Comments
The scope of the IoT applications Microcontroller, Projects, Tutorials
is growing from controlling In this projec
| Microcontroller, MikroC, PIC,
appliances to monitoring devices LED which is
Sensors, Ultrasonic | 92
(like sensors) and sending e- ESP8266 with
Comments Hope you...
mails. So...
In some of our projects, we may
Read More Read More
want to measure the distance of
an object from a
point. Ultrasonic Distance
Sensors...
Read More
RECENT POSTS
Installing Keil IDE – ARM Microcontroller Tutorial – Part 1
October 8, 2019
Sending E-mail from ESP8266 – IoT Project
January 17, 2019
Controlling LED using ESP8266 and Telegram Bot – IoT Project
December 21, 2018
Interfacing MPU-6050 / GY-521 board with Arduino Uno
December 16, 2018
Updating Sensor Data to Google Spreadsheet using ESP8266 – IoT Project
November 28, 2018
Flashing Espressif and NodeMCU Firmware to ESP8266
October 28, 2018
FOLLOW US
MOST VIEWED
Astable Multivibrator using Transistors
https://electrosome.com/led-control-ir-remote/ 8/11
12/13/2019 Controlling LED's using Remote Control - Arduino Project
by Ligo George
Getting Started with MPLAB XC8 Compiler – LED Blinking
by Ligo George
LED Blinking using 8051 Microcontroller and Keil C – AT89C51
by Ebin George
What is a Microprocessor ?
by Ligo George
5V Power Supply using 7805 Voltage Regulator with Design
by Manoj Shenoy
Transistor as a Switch
by Ligo George
CATEGORIES
Electronics
555 Circuits
Basic Electronics
Opamp
Electronics News
IC
Power Supply
Sensors
What is Inside?
Featured
Mobiles
News
Processors
Projects
Embedded
Arduino
AVR Microcontroller
ESP8266
PIC Microcontroller
Hobby Circuits
IoT
Softwares
Tablets
https://electrosome.com/led-control-ir-remote/ 9/11
12/13/2019 Controlling LED's using Remote Control - Arduino Project
Technology Transfer
Tutorials
8051 Microcontroller
8085
Arduino
ARM
ARM7
ATMEL AVR
CloudX
ESP8266
MATLAB
OpenWrt
PCB Designing
DipTrace
OrCad
PIC Microcontroller
CCS C Compiler
Hi-Tech C
MikroC
MPLAB XC8
Python
Raspberry Pi
Python Rpi
SCILAB
MOST COMMENTED
Digital Clock using PIC Microcontroller and DS1307 RTC
by Ligo George
Voltmeter and Ammeter using PIC Microcontroller
by Ligo George
Water Level Indicator and Controller using PIC Microcontroller
by Ligo George
Interfacing HC-SR04 Ultrasonic Sensor with PIC Microcontroller
by Ligo George
Automatic Power Factor Controller using Microcontroller
by Divya Syamala
USB PIC Programmer : PICKit2
by Ligo George
https://electrosome.com/led-control-ir-remote/ 10/11
12/13/2019 Controlling LED's using Remote Control - Arduino Project
TAGS
3D 16F877A 555 8051 MICROCONTROLLER ANDROID ARDUINO ARDUINO UNO ATMEGA32 ATMEL DC MOTOR DHT22
ELECTRONICS EMBEDDED ESP8266 GOOGLE HI-TECH C IOT L293D LCD LED MATLAB MICROCONTROLLER MIKROC
MOBILE MOTOR MPLAB MPLAB XC8 OP-AMP PCB PIC PROTEUS PWM PYTHON RASPBERRY PI RFID SAMSUNG
SENSOR SENSORS SERVO MOTOR SMARTPHONE TABLET TRANSISTOR TRANSISTORS TUTORIALS XC8
RECENT COMMENTS
Chand Sayyad on Transformerless Capacitor Dropper Power Supply
Shani on Interfacing DC Motor with PIC Microcontroller using L293D
Rendon Gree on Using UART on Raspberry Pi – Python
Rendon Gree on Using UART on Raspberry Pi – Python
B B DWIVEDI on What is a Microprocessor ?
FOLLOW US
© Copyright 2018. All Rights Reserved.
https://electrosome.com/led-control-ir-remote/ 11/11