IR Communication Sensor Guide with Arduino Interfacing

Introduction

IR LED And IR Photodiode
IR LED and IR Photodiode

 

  • IR light is like visible light but it is invisible to our eyes, because of which they are suitable in application of wireless communication.
  • The band for IR (Infrared) in electromagnetic spectrum is 300GHz to 430 THz and wavelength range of around 700nm to 1mm.
  • Along with the IR LED some other sources like sun, light bulbs, human and animal bodies etc. also emit infrared energy.
  • IR communication is used for short and medium distance applications.

 

Principle of Working

  • IR LEDs transmit digital (logical 1 and 0) data in the form of infrared light.
  • Logical 1 is emitted by keeping IR LED ON and logical 0 by keeping it OFF.
  • This ON and OFF sequence of data is collected by IR photodiode at receiver end.

 

Types of IR communication 

IR Communication Types
IR Communication Types

 

1) Point to point communication : In point to point communication, line of sight is required between transmitter and receiver devices.

2) Diffuse communication : In diffuse communication, no need to keep transmitter and receiver in straight line of sight. It can be done by reflecting or bouncing the transmitted signal from surfaces like wall, ceilings etc.

 

Simple IR Communication using IR Photodiode Receiver

  • In simple IR communication, whatever data (1 or 0) present at transmitter end will be transmitted as it is without any modulation technique.
  • Receiver collects the transmitted data (1 or 0) as it is without any demodulation or filter technique.
Basic IR Communication
Basic IR Communication

 

  • The only limitations of this basic communication are short distance and interference from IR energy of the surroundings.

 

IR Communication using Modulation

In modulation type of IR communication, IR light is modulated with carrier frequencies to get better distance available.

Also, it provides better immunity to surrounding IR interferences. Generally, TSOP series receivers are used to receive modulated IR light.

IR LED And TSOP1738

 

IR Transmitter

  • For IR transmission, IR LED of wavelength 940 nm to 950 nm are commonly used.
  • When we transmit the data to the IR receiver, at the same time the IR receiver also receives IR rays from the surroundings. These IR rays from the surroundings can distort the transmitted data.
  • To avoid such surrounding interferences, IR signal can be modulated with carrier frequencies. The commonly used carrier frequencies are 30kHz, 36kHz, 38kHz, 56kHz etc.
  • In the IR communication, NEC code, Toshiba Micom Format, Sharp Code, RC5 Code, RC6 Code, R–2000 Code, Sony Format (SIRCS) etc. protocols are used.
  • Also, simple RS232 serial communication protocol can be used for IR communication. This protocol uses one start bit, 8-bit data, one parity bit (optional) and one stop bit format. Now, IR data is modulated to IR signal at 38kHz as shown in figure below.
IR LED Transmitter With Modulation
Fig: Serial data modulating at 38kHz

 

IR Receiver

  • At receiver end, IR receiver receives data at 38kHz of carrier frequency.
  • For IR filter, epoxy package is designed.
  • This module is designed in such a way that any unexpected output pulses due to noise or disturbance signal are avoided.
  • Generally, TSOP series Receiver are used which support reception of various transmitted code.
  • E.g. In TSOP1738, continuous data rate is possible up to 2400 bps.
  • This demodulated output signal is received by microcontroller.
  • The demodulated output data of TSOP is shown in figure below.
TSOP1378 Receiver
Fig: Output data of TSOP1738

 

Connection Diagram for IR Communication using TSOP1738 and  Arduino

IR Communication Between IR LED And TSOP1738 IR Receiver using Arduino
Connection Diagram for IR Communication using TSOP1738 and  Arduino

 

Code for IR Communication between IR LED And IR Photodiode Using Arduino Uno

Sketch for Transmitter

void setup() {
  Serial.begin(9600);	/* Define baud rate for serial communication */
}

void loop() {
  int count;
  for(count = 0; count<100; count++)
  {
    Serial.println(count);
    delay(1000);
  }
}

 

Sketch For Receiver

void setup() {
  Serial.begin(9600);	/* Define baud rate for serial communication */
}

void loop() {
if(Serial.available())	/* If data is available on serial port */
  {
    Serial.print(char(Serial.read()));	/* Print character received on to the serial monitor */
  }
}

 

Here transmitter transmits the number from 1 to 100 to the receiver and the receiver receives the number and displays it on the serial monitor.

To know more about IR communication using Arduino refer to this link

 

Examples of IR communication

  1. IR Communication using ATmega16
  2. IR Communication using Arduino
  3. IR Communication using TI Launchpad
  4. IR Communication using NodeMCU

Components Used

IR LED Infrared Emitters
IR LED Infrared Emitters
1
TSOP1738 Infrared Receivers
Infrared Receivers 38kHz IR Receiver
1
Ad