Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Voltaat Arduino Ultimate Kit
40 min
Share

Send orders to your Arduino using IR remote

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.

Project Video

Overview

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.

Getting the Items

Arduino Uno R3 (Voltaat Version)
Get Item
Infrared Remote Control Kit
Get Item
Jumper Wires - Male to Male (40 Pack)
Get Item

Steps

Wiring it Up

Connect the wires between the receiver and the Arduino, as shown in the image below:

 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


/*
 Voltaat learn (http://learn.voltaat.com)
 Link for full tutorial:
 IR reciver library:

 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 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.
know when your plant needs watering

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

know when your plant needs watering

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.

know when your plant needs watering

Resources

No items found.