Send orders to your Arduino using IR remote
Have you ever wondered how your TV or air conditioner remote works? This is exactly what we will discover in this tutorial.
This technology is called IR, which refers to infrared radiation. It is one of the most popular means of wireless communication because it is simple to use and inexpensive.
In this tutorial we will use the IR remote control and the receiver module with the Arduino to receive orders when you press different buttons and display the result on your computer.
Overview
The TV or air conditioner remote sends orders via infrared light. Each button on the remote has a unique code. When you press it, a light-emitting diode (LED) on your remote turns on and off continuously, causing a modulated infrared signal to be sent from the remote to your TV receiver. The TV receiver in turn understands and executes a specific order accordingly.
If you look at the IR LED on your remote control while pressing different buttons, you will not be able to see this light. This is because infrared radiation is not visible to our eyes. But there is a trick you can use to see it: simply open your smartphone's camera and point it at the LED while pressing different buttons to watch it flash in violet.
Let’s see together!

Getting the items
For this project you will need the following components, you can but them from our store.
Wiring it up
To set up the IR receiver in the correct way, follow the instructions below. The image demonstrates how to connect the wires between the receiver and the Arduino. Once the receiver and the Arduino are connected to each other, connect the Arduino to your computer using the USB cable.

Connections from IR receiver to the Arduino:
• IR receiver GND pin (- pin) → Arduino VCC pin
• IR receiver VCC pin (+ pin) → Arduino VCC pin
• IR receiver signal pin → Arduino pin 7
Coding
The function of this sketch is to display the code of each button on the computer.
You may extend the functionality of this code to control an RGB strip or even a robot!
In order for the code to work correctly, you need to download the IR receiver library. Libraries are files that you can download and copy to the Arduino IDE software files so the Arduino can recognize different sensors. You can download the library files from the resources section and then install it by following this tutorial.
/*
Voltaat learn (https://www.voltaat.com/pages/voltaat-learn)
Link for full tutorial: https://bit.ly/3T0lJqV
IR reciver library: https://bit.ly/3s0SJDv
Tutorial: Send orders to your Arduino using IR remote
The function of this sketch is to display the code of each button on the computer
Connections from IR receiver to the Arduino:
• IR receiver GND pin (- pin) → Arduino VCC pin
• IR receiver VCC pin (+ pin) → Arduino VCC pin
• IR receiver signal pin → Arduino pin 7
*/
//This library allows you to use the IR reciver
#include<IRremote.h>
//Define IR reciver pin
int IRReciverPin =7;
//Commands inside void setup run once
void setup()
{
Serial.begin(9600);
IrReceiver.begin(IRReciverPin);
}
//Commands inside void loop run forever
void loop()
{
//If data is received
if(IrReceiver.decode())
{
//print to serial monitor
Serial.print("Button Code: ");
//print the button code
Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX);
Serial.println(" ");
//Restart and Receive the next value
IrReceiver.resume();
}
}
Testing it out

You may now access the serial monitor on your Arduino IDE by clicking on the magnifying glass icon at the top right corner.

The serial monitor is a great tool that can facilitate communication between the computer and the Arduino. It can allow us to send and receive different commands as well as view information directly from the Arduino.
You should also make sure you have chosen the right baud rate (9600) as specified in the code. You can do this by clicking on the drop-down menu at the bottom right corner of the output window.
When a button on the remote control is pressed, the serial monitor should display a code as seen in the image below. You can also see the receiver flashing in response to the signal.

Related Tutorials
Your gaming mouse uses a special LED called the RGB LED, which is similar to a regular LED but it is made up of three smaller ones. It is called an RGB LED because it has three LEDs with three colors: red, green, and blue.
Most of us are familiar with the switches used in household devices. A relay is a type of switch that can be connected to an Arduino or any other microcontroller.
A servo motor is just a simple DC motor with certain modifications. When you look at it, you'll notice that it has several gears and an electronic circuit.