Arduino Program for IR Sensor – How IR Receiver Works

In this tutorial, we are going to set up IR receiver and remote on an arduino. how the Arduino IR Receiver interface works? I will also show you how to use virtually any IR remote to control any kind of thing connected to the Arduino  and arduino program for ir sensor. you will make many arduino project like home automation, remote control car with the help of IR Receiver.

Component Requirement of arduino ir receiver: 

IR Receiver (Tsop1738): 

TSOP17XX is a commonly used IR receiver for Infrared PCM remote control systems. It is used in TVs remote; DVD Players remote etc. this component is built with pin diode, preamplifier and filter for PMC frequency. TSOP1738 is very common whose carrier frequency is 38KHz. The output of TSOP1738 receivers can be directly connected to arduino for further processing.Here the arduino program for ir sensor are given below.

Pinout of IR Receiver: 

  • GND: –Ground
  • Vin: –Power supplyarduino program for ir sensor
  • Data: – Receive the data send to arduino

Feature of arduino program for ir sensor:

  • CMOS and TTL Compatible
  • Active Low Output
  • Immunity against ambient light
  • Low Power Consumption
  • Able to transfer data continuously up to 2400bps
  • Supply Voltage: 4.5 – 5.5V

Circuit Diagram of arduino with ir sensor:

arduino program for ir sensor

Explanation of TSOP1738:

  • Connect the output pin of TSOP1738 to arduino digital pin 9 to get the tv remote signal or ir remote signal
  • Download IR Remote Library and place in Arduino/libraries folder.

arduino program for ir sensor github

  • Download link: –

    • Open serial terminal at 9600 baud rate.
    • Press the IR Remote button while pointing remote towards the IR Receiver
    • You will see some decimal value when pressing the button
    • Note Down
    • Repeat few times and make sure you are getting the same decimal value for a single button press.
    • Repeat you are getting the decimal value for another button.

arduino program for ir sensor

arduino program for ir sensor

#include <RobotIRremote.h>
#include <RobotIRremoteInt.h>
#include <RobotIRremoteTools.h>
#include <IRremote.h>
int RECV_PIN = 9;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
  void loop()
if (irrecv.decode(&results)) {
    Serial.println(results.value, DEC);


How IR sensor work:

In the arduino program for ir sensor, when we will press the remote button, the remote will send an IR signal in the form of the IR sensor. The IR receiver will receive this signal and will give it to the Arduino. This decimal of corresponding button will show in serial monitor.

See Video for Better Reference:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.