Basics

Infrared is a form of light radiation, except it lies outside the visible light spectrum for humans. Since IR is undetectable to the human eye, it makes it a good candidate for wireless communication. Many products such as remote controls utilize infrared technology. In infrared communication, a infrared receiver converts the information given from the sender/remote into an electrical signal.

Modulation

Since Infrared radiation is all around us, the Infrared receiver will need to differentiate this radiation from the one outputted from the remote. To do this, the signal will need to be modulated or modified, this is typically done through using a 38kHz frequency signal. The receiver will demodulate the signal and output binary for the micro controller to understand.

Arduino

Infrared sensors typically contain a ground, output, and Vcc(power) pins.

To use infrared sensors with our Arduino, we must connect our Ground, Power, and Output pins from the board to the Infrared sensor on a breadboard. Next, to simplify our Infrared programming process for Arduino, we will use the IRremote library for Arduino, view it here.

Next to find out the codes for your Infrared remote, We will use the sample code from the library.


include <IRremote>
const int RECV_PIN = 7; //create receiver object
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn(); //start the receiver
}

void loop(){
  if (irrecv.decode(&results)){
    Serial.println(results.value, HEX);
    irrecv.resume(); //resume and receive next value
  }
}

This code will give you each code for each button on your Infrared Remote, with this information you can program more complex projects.

Categories: Arduino