✨ Use RCAPP and get 5% off 👇
Skip to content
Free Delivery on Orders Above Rs 999/- Pan-India
Cash on Delivery Available for Orders above Rs.500/- and Upto Rs 3000/-
SAVE more when you BUY more. Upto 30% Off on BULK PURCHASE
GST Invoices for Your Business
Dedicated Technical Support Team
Safely Delivering Genuine Products PAN INDIA

DIY IR Sensor: Working, Circuit Diagram & Applications

DIY IR Sensor: Working, Circuit Diagram & Applications
D
Written By Daniel D'Souza
📅 Updated on 17 Jun 2026
Summarize with AI
✅ Prompt copied

In this blog, we will build a simple IR sensor and learn more about the components used in it.

 

What is a sensor?

A sensor is a device that can quantify the environment and produce some corresponding output. For our case, the output will be in the form of an electrical signal which we can measure, modify according to our requirements and drive components on it.

 

Also, read our blog on the What Is IR Sensor explaining what is IR sensor, how it works, and the application of IR sensors

Components and Supplies

IR Proximity Sensor-RobocrazeIR Proximity Sensor-Robocraze

    IR (Infrared) Obstacle Avoidance Sensor Module

    IR Proximity Sensor The IR Proximity Sensor has a distance range of 2cm to 30cm and it is ideal for obstacle detection, line tracking, and more. It is designed for easy setup and has onboard detection indication to verify its status. A preset knob...
    Rs 53/-
    Rs 53/-
    Rs 69/-
    Save Rs 16/-
    💥 Hot deal
    Original Arduino Uno R3 microcontroller board with ATmega328P and USB port - Arduino Uno Board -RobocrazeOriginal Arduino Uno R3 microcontroller board with ATmega328P and USB port - Arduino Uno Board -Robocraze

      Arduino Uno R3 Original

      Arduino UNO R3 Original The Arduino Uno R3 is a microcontroller board based on the ATmega328P chip and is widely recognized as the best original Arduino Uno board for beginners and projects. This board has 14 digital I/O pins (6 support PWM), 6 analog...
      Rs 2,619/-
      Rs 2,619/-
      Rs 2,649/-
      Save Rs 30/-
      Jumper Wire Set - M2M, M2F, F2F (40 pcs each) – Ideal for Arduino & prototyping. Electronic Components - RobocrazeJumper Wire Set - M2M, M2F, F2F (40 pcs each) – Ideal for Arduino & prototyping. Electronic Components - Robocraze

        Jumper Wire Set - M2M, M2F, F2F (40 pcs each)

        Jumper Wire Set - M2M, M2F, F2F (40 pcs each) These DuPont jumper wires for electronics is a premium quality wire manufactured by using quality assured material and advanced techniques, which make them up to the standard in this highly challenging field. This 120pcs...
        Rs 139/-
        Rs 139/-
        Rs 169/-
        Save Rs 30/-
        GL12 840 Points Solderless Breadboard for Large Prototyping - Electronic Components -RobocrazeGL12 840 Points Solderless Breadboard for Large Prototyping - Electronic Components -Robocraze

          GL12 840 Points Solderless Breadboard

          GL12 MB102 840 Points Solderless Breadboard Introducing the GL12 840 Points Breadboard at Robocraze! This solderless breadboard is an essential tool for any electronics engineer or hobbyist. It allows you to make temporary prototypes for your electronics projects, making it perfect for experimenting with...
          Rs 70/-
          Rs 70/-
          Rs 90/-
          Save Rs 20/-
          Resistor Box (150PC, 30 Values) – Comprehensive resistor kit. -Basic Components -RobocrazeResistor Box (150PC, 30 Values) – Comprehensive resistor kit. -Basic Components -Robocraze

            Resistor Box (150 Resistors and 30 Values)

            Resistor Box (150 Resistors and 30 Values) If you're an electronics enthusiast or hobbyist, the Resistor Box is an essential addition to your toolkit. This comprehensive kit includes 150 high-quality resistors with 30 unique values, ranging from 1E to 1M ohms. These versatile components...
            Rs 45/-
            Rs 45/-
            Rs 84/-
            Save Rs 39/-

            IR rays

            IR (Infrared Radiation) often called Infrared Light is a part of the Electromagnetic Spectrum that has a wavelength of the order of 700 nm to 1 mm. It is invisible to the naked light as it doesn’t coincide with the visible spectrum.

             

            Components Required and their Information:

            1. Phototransistor
            2. IR LED
            3. 100 Ohm Resistor
            4. 10k Ohm Resistor
            5. Arduino Uno
            6. Jumper Wires
            7. BreadBoard

            Phototransistor:

            Are small semiconductor devices that can detect the amount of incident (light) radiation on them and correspondingly alter the current between the emitter and collector.

            A photodiode can be used for the same purpose, however as phototransistors are more sensitive, we will be using them.

            A transistor has 3 leads - Base, Collector, and an Emitter, However, if you look at the image of a Phototransistor, you will see only 2 leads. That is because the Base is left open here.

             

            IR Led:

            An IR led is a small device that emits IR light. Its construction is very simple to a traditional Light Emitting Diode (LED), however as the light emitted by it is in the infrared region, it’s invisible to us.

            These are very cheap and used extensively as they are a reliable source of IR light, hence one can see their application in electronics, remote control for T.V., etc.

             

            Also learn how Infrared Sensors detect motion and heat.

            Working Principle:

            • The IR LED will generate IR rays when given power.
            • These infrared rays will travel to a surface or a boundary and then be reflected.
            • The reflected rays will fall on the phototransistor and a small number of current flows between the emitter and the collector.
            • This can be measured with the help of a microcontroller like Arduino UNO and a voltage divider network.

            Also, read our blog on the Working of IR Sensor detailing what is IR sensor, how they works, and the different types of IR sensors.

             

            The circuit diagram and explanation:

            1. First, we connect one lead of the 100 Ohm resistor to the anode (+ve) of the LED.
            2. Then we connect the other lead to the 5-volt pin on the Arduino.
            3. Next, connect the cathode (-ve) of the LED to the ground pin on the Arduino.
            4. Similarly, we will connect 1 lead of the 10 kilo Ohm resistor to the collector (-ve) of the phototransistor and connect the other lead to the 5-volt pin on the Arduino.
            5. And connect the emitter (+ve) of the phototransistor to the ground pin on the Arduino.
            6. At the junction of the phototransistor and the 10 kilo Ohm resistor, we will make a connection and give it to the A0 pin on our Arduino.
            7. This completes our connection.

             

            Arduino Code:

             

            /*

             * Name: DIY IR sensor code

             * Description: A simple code to access the values of your sensor

             * Contributor: Jatin Vira

             */

             

            #define InputPin A0             //This is the pin where your Sensor is connected

             

            void setup()                    //Will be executed only once

            {

              pinMode(InputPin, INPUT); //Using PinMode function to declare the A0 pin as an Input Pin

              Serial.begin(9600);           //Setting the Baud Rate to 9600

            }

             

            void loop()                     //Will be executed again and again indefinitely

            {

              //Create a Variable called SensorValue to store the value from Sensor

              int SensorValue = analogRead(InputPin); //Use analogRead to take input from A0 pin

              Serial.println(SensorValue);                //Serial Printing the stored value on a new line

              delay(10);                    //Setting the delay to 10ms, Experiment with different values and see what it does

            }

             

            You can also try using the digitalRead function and see how it affects the sensor values.

             

            Output:

            1. First, we will upload the code to our Arduino.
            2. Next, we will open the Serial Plotter in the tools section.
            3. When you move the hand closer to the sensor you can notice that the value received by the sensor decreases.
            4. Similarly, when the hand is taken further away from the sensor, the value retrieved goes up.

             

            Applications:

            1. This can be used as a proximity sensor, which finds use in many areas such as home automation, mobile robots, etc.
            2. This can be used to differentiate between different colors and subsequently be used in a line following a robot.

            This blog has been submitted by VCET Robotics Club, VCET Vasai under the Robocraze Club Outreach Program.

             

             

            Excerpt

            Learn how to build a DIY IR sensor, understand its working principle, circuit diagram, components used, and real-world applications.
            Prev Post
            Next Post

            Leave a comment

            Please note, comments need to be approved before they are published.

            Thanks for subscribing!

            This email has been registered!

            Shop the look

            Choose Options

            Edit Option
            Back In Stock Notification
            Compare
            Product SKU Description Collection Availability Product Type Other Details

            Choose Options

            this is just a warning
            Login
            Shopping Cart
            0 items
            FREE SHIPPING!
            ₹100 OFF
            ₹200 OFF
            ₹999
            ₹2500
            ₹4900
            WhatsApp Chat Chat