IR receiver transmitter interfacing with Arduino

IR  Receiver and IR emitter Modules: These modules are used to send to send and receive information. Before getting into detail, first we will see that what the IR communication is and how it works.

IR Communication

IR Communication is a very easy to use, inexpensive and common way of communication. IR radiation is basically a light that cannot be seen by a human eye. As it is undetectable to human eye, it is perfect for wireless communication. IR radiations are everywhere, these emits from sun, light bulbs and many other things. ir receiver module

IR light (Transmitter) is almost similar to visible light except its wavelength is longer. When you hit a TV remote button, IR Led transmit information to the TV. IR Led turns on and off 38000 times a second to transmit information to IR receiver in TV.

IR sender Module

The IR sender is used to receive the infrared rays that are emitted by IR emitter. The IR receiver module consists of a IR receiver. The IR receiver is of many types, some are shown below

It has module comes with a remote. These are inexpensive and can be used in many projects from simple to complicated. The basically consists of a IR emitter that sends a signal to IR receiver connected with the Arduino.




Specifications of IR Receiver Module

The IR Receiver Module has the following specifications

  • It has the operating voltage of 2.7V to 5.5V
  • It has a supply current of 1.5 mA
  • It has an operating temperature from -25 C to 85 C
  • It has a receiving distance of 18 meter
  • The frequency at which it operates is 37.9 KHz

Pin Out of IR Receiver Module

The IR receiver has three pinsir receiver pin out

From left to right, these are

  •  Ground
  • Voltage
  • Signal

IR receiver module interfacing with Arduino

The connections are very easier. Connect the 5V and ground of the Arduino to the 5v and ground of the IR receiver and the pin 11 of the Arduino to the signal pin of IR receiver.

Before uploading the code, download the library from here  and place it in the Arduino/libraries directory.

ir-receiver-interfacing-with-arduino

Code of ir receiver interfacing with arduino

//  This code is to test the IR receiver module

// Make sure you have installed the library.

#include <IRremote.h>                                                                 // Adding the library for IR communication

int IR_PIN = 11;                                                                                 // Declaring pin 11 for IR receiver signal

IRrecv irDetect( IR_PIN );                                                                             // Using the library function

decode_results irIn ;                     

void setup ( )

{

  Serial.begin( 9600 ) ;




  irDetect.enableIRIn ( ) ;                                                               // This command will start the Receiver

}

void loop ( ) {

  if (irDetect.decode(&irIn ) ) {

    decodeIR ( ) ;

    irDetect.resume ( ) ;

  }

}

void decodeIR ( )                                                              // This will tell us which key Is pressed.

{

  switch(irIn.value)

 {




  case 0xFF629D: 

    Serial.println( " Up Arrow " );

    break;




  case 0xFF22DD: 

    Serial.println( " Left Arrow " );

    break;




  case 0xFF02FD: 

    Serial.println( "OK" );

    break;




  case 0xFFC23D: 

    Serial.println ( " Right Arrow " ) ;

    break;




  case 0xFFA857: 

    Serial.println ( " Down Arrow " ) ;

    break ;




  case 0xFF6897: 

    Serial.println ( " 1 " ) ;

    break;




  case 0xFF9867: 

    Serial.println ( " 2 " ) ;

    break;




  case 0xFFB04F : 

    Serial.println ( " 3 " ) ;

    Break ;




  case 0xFF30CF : 

    Serial.println ( " 4 " ) ;

    break;




  case 0xFF18E7 : 

    Serial.println ( " 5" ) ;

    break;




  case 0xFF7A85 : 

    Serial.println ( " 6 " ) ;

    break;




  case 0xFF10EF : 

    Serial.println ( " 7" ) ;

    break;




  case 0xFF38C7: 

    Serial.println ( " 8" ) ;

    break;




  case 0xFF5AA5: 

    Serial.println ( "9 " ) ;

    break;




  case 0xFF42BD: 

    Serial.println ( "* " ) ;

    break;




  case 0xFF4AB5 :   

    Serial.println ( "0 " );

    break;




  case 0xFF52AD: 

    Serial.println ( " # " ) ;

    break;




  default:

   break;




  }

Press any key and it will be shown on the serial monitor.

IR Emitter Module

The IR emitter is also known as the IR transmitter. The IR emitter module is very inexpensive and it is very easy to use. It has many applications. It can be used in the projects like controlling a TV, controlling a motor and many things can be controlled using it. The IR emitter module consists of a Light emitting diode that is similar to the common light emitting diode but different material is used. This diode sends the information in the form of infrared rays that is then received by the receiver.

Specifications for IR Emitter Module

  • It has an operating voltage of 5V.
  • It operates at a frequency signal of 38 KHz
  • It sends information to a distance of 18 meters

Pin Out of IR Emitter Module

The pin out from left to right isIR transmitter

  •  Signal
  • 5V
  • Ground

IR transmitter interfacing with arduino

The connections are similar to the IR receiver module. Connect the 5V and ground of the Arduino to the 5v and ground of the IR receiver and the pin 10 of the Arduino to the signal pin of IR receiver.Library is same for both IR receiver and IR emitter. Download it if you haven’t before, download the library from here  and place it in the Arduino/libraries directory.

Code of IR transmitter interfacing with arduino

// This code is for the IR emitter Module
// install the library before uploading the code
#include < IRremote.h >

IRsend irsend ;

void setup( )
{
irsend.sendNEC(0x20dfc03f, 32); // This command is for volume up
}

void loop( ) {
}

IR remote control also have IR transmitter and reach button has specific code associated with it. I will also post article on IR remote control. This is all about tutorial of interfacing IR transmitter and IR receiver interfacing with arduino.

One Response

  1. Ei Ei November 25, 2016

Add Comment

Subscribe to our blog to get updates in your email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 706 other subscribers