IR Remote Controlled RGB Led Using Arduino Pro Mini

by Prachet Hure in Circuits > Remote Control

2519 Views, 5 Favorites, 0 Comments

IR Remote Controlled RGB Led Using Arduino Pro Mini

IMG_20210204_130418.jpg
IMG_20210204_124819.jpg

This project will allow you to control output devices connected to the Arduino board using T.V remote control or any other IR remote control. For convenience, I have used RGB LED to indicate the status of three pins on the Arduino board. You can use any device which you like to switch 'on' and 'off' like a buzzer, led. To connect inductive loads like motors and relays you will require a power transistor and diode or simply use ULN2003 relay driver IC.

Component List.

IMG_20210204_140708.jpg
  • Arduino pro mini.
  • CP2102 (USB to UART driver).
  • TSOP1738. (IR receiver).
  • Red LED (to indicate receiving signal).
  • 1K resistor in series with led.
  • RGB LED.
  • 560ohm resistor x 3.
  • IR remote control (grab any IR remote like TV remote, lighting remote, etc ).
  • 5V SMPS power supply or 5V battery or 9V battery with IC7805 ( 5V supply with a minimum current rating of 250mA).
  • Breadboard.
  • Jumper wires, M to M, F to F, and M to F. It's recommended to have 5 pcs of all types.

Testing IR Remote.

IMG_20210204_141332.jpg
image_2021-02-04_201325.png
IMG_20210204_143209.jpg

Open camera in your mobile phone. Then hold the remote's top side in front of the mobile camera and press the key you want to test. If you see LED flashing purple light, as shown in the above image. Then you are good to go, the remote is working fine.

Another way, is to use TSOP1738 sensor. Wire the circuit as shown in above image and then hold the remote towards the sensor and press the key that needs to be tested. If the LED connected to the output flashes. Then the remote is working.

Once you get a working IR remote. Let's move further and decode the signal using Arduino.

Library Installation.

image_2021-02-04_212812.png
  1. Open arduino IDE > Tools > Manage libraries.
  2. Then search for "IR remote".
  3. scroll down, you will find IRremote library by Shirriff, z3t0, ArminJo.
  4. select version 3.0.0 and click on Install.

In case you don't have Arduino IDE you can download it from Arduino's website, www.arduino.cc > software > downloads.

Connecting TSOP1738 to Arduino Pro Mini.

proj img1.JPG
image_2021-02-04_225743.png
Chart.JPG

The transmitted signal by IR remote is a pulse code modulated signal. Binary data is modulated on a high-frequency carrier signal of 38KHz. High frequency is used so as to avoid interference from external IR sources like sunlight or light from an incandescent bulb. The high pass filter in TSOP1738 passes frequency above 38KHz and attenuates all the lower frequencies. It also amplifies the signal thus we get an increase in range.

Connect the output of the TSOP sensor to a digital pin with an interrupt in your Arduino board. in Arduino pro mini, pin 2 and 3 support interrupt. Therefore I have connected the output of TSOP sensor to pin 2. Refer to the above chart, to get the valid output pins for different Arduino boards.

Connect CP2102 (USB to UART bridge) to Arduino pro mini as shown in the circuit diagram. Plug CP2102 into the USB port of your computer. Open device manager and ensure that the computer has detected CP2102 on the connected COM port. It will also show you the COM port number.

Decoding IR Signals Associated With Each Key on Remote.

image_2021-02-05_001532.png
image_2021-02-05_003626.png

Select board type, processor, and proper COM port. For that follow the below instructions and make changes according to your board type.

Open Arduino IDE > Tools > Board: "Arduino pro or pro mini"

Processor: "ATmega328p (3.3V, 8MHz)"

Port: "COM3".

Upload the below-given program. This program will decode the digital IR signals and display numeric code on the serial monitor.

Program:-

#include <IRremote.h> // code starts by including library by Ken Shirriff. version 3.0.0
int IRpin =2;

void setup() {
Serial.begin(9600); IrReceiver.begin(IRpin, DISABLE_LED_FEEDBACK);

}

void loop() {
if (IrReceiver.decode()) {

Serial.println(IrReceiver.decodedIRData.decodedRawData);

delay(200);

IrReceiver.resume(); // Receive next value

}

} // code end.

After uploading the code, go to Tools > serial monitor > select baud rate for the serial monitor, if you are getting garbage like "?>"£$?" then try increasing or decreasing the baud rate.

Hold IR remote in front of the TSOP sensor and try pressing different keys on the remote. You will notice that each individual key has its own code that is printed on the serial monitor (Shown in the above image). Note down the code associated with the keys, with which you want to control the output device. In this project, I require only three keys of remote to light different colors in RGB LED.

Modifying Program As Per Desired Output Device.

image_2021-02-05_013817.png
Control devices wirelessly using IR remote and Arduino.

In this project, the output device I am using is RGB LED, so I require only three output pins on Arduino and three keys on the remote. The program is slightly modified, instead of printing the decoded code on the serial monitor. The code is used in conditional "if statement" or "switch case statement" to turn "on" and "off" the output pin. Upload the below Program.

Program to control RGB LED using IR remote:-

#include
int IRpin =2;

int redpin=10;

int greenpin=11;

int bluepin=12;

void setup()
{

Serial.begin(9600);

IrReceiver.begin(IRpin, DISABLE_LED_FEEDBACK);

pinMode(redpin,OUTPUT);

pinMode(greenpin,OUTPUT);

pinMode(bluepin,OUTPUT);

}

void loop()
{

if (IrReceiver.decode())

{

Serial.println(IrReceiver.decodedIRData.decodedRawData); // Print the Serial 'results.value' switch(IrReceiver.decodedIRData.decodedRawData)

{

case 3550760131: // code for the red key, use your own remote key code.

digitalWrite(redpin,HIGH);

break;

case 1527873955: // code for the green key, use your own remote key code.

digitalWrite(greenpin,HIGH);

break;

case 1274461223: // code for the blue key, use your own remote key code.

digitalWrite(bluepin,HIGH);

break;

case 963094115: // code for off-key, use your own remote key code.

digitalWrite(greenpin,LOW);

digitalWrite(bluepin,LOW);

digitalWrite(redpin,LOW);

break;

}

delay(200);

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

}

} // code end

Once the program is uploaded. Disconnect CP2102 from the USB port and make the connections as shown in the above circuit diagram. Power on the circuit and control colors of RGB LED using remote control keys.

Here are some brief applications of the project.

  • You can even make IR communication-based home automation system using relays and relay driver IC ULN2003.
  • Make a remote control robot.
  • Control LED electronic display.

In general, make your project or product wireless using IR technology. Thanks for reading this post. Let me know if you are making this project or have your own project ideas based on IR communication. Also, feel free to ask questions regarding this project.