Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Sensors
  4. ›IR Obstacle Sensor Module

Component guide · Beginner · 3 min read

IR Obstacle Sensor Module

How It Works, Wiring and Limits

By Geekobot Learning Team · Updated 24 Oct 2026

I'm using
Wiring, code and the Run it panels follow your board.
On this page
Short answerHow an IR obstacle sensor worksWiring and codeSetting the rangeWhy it misses black objects and false-triggers in sunlightIR sensor types comparedCommon mistakesFAQsParts and next steps
Short answer

An IR obstacle sensor module shines infrared light from an LED and watches for its reflection with a photodiode; when something is within about 2 to 30 cm, its OUT pin goes LOW. It runs on 3.3 to 5 V and needs no library. It cannot measure distance, struggles with black or shiny objects and false-triggers in sunlight, so use an HC-SR04 or VL53L0X when you need a real distance.

Key specs at a glance

Supply
3.3 to 5 V, about 20 mA
Output
Digital, active LOW on detection (most modules)
Range
About 2 to 30 cm, set by the trimmer (FC-51)
Detection angle
About 35 degrees
Comparator
LM393 with an adjustable threshold
TCRT5000 version
1 to 25 mm, for line following and reflective sensing
01

How an IR obstacle sensor works

The module has an infrared LED emitting at about 940 nm and a photodiode next to it, separated by a small barrier. With nothing in front, no light returns. A nearby object reflects some IR back onto the photodiode, the LM393 comparator compares that signal with the level set by the trimmer, and OUT switches LOW. A second LED on the board lights to show detection.

02

Wiring and code

Three pins: VCC, GND, OUT. The output is open-collector with a pull-up on the board, so it connects directly to an Arduino, ESP32 or Pico pin.

Read an IR obstacle sensor · Arduino C++Verify & upload in Electrolark
const int IR = 7;

void setup() {
  pinMode(IR, INPUT);
  Serial.begin(9600);
}

void loop() {
  if (digitalRead(IR) == LOW) Serial.println("Obstacle");
  else                        Serial.println("Clear");
  delay(200);
}
03

Setting the range

Turn the trimmer with a small screwdriver while holding a white card at the distance you want, until the detection LED just switches on. Turning it too far makes the sensor trigger permanently; back it off until the LED goes out with nothing in front. Do the adjustment in the lighting the robot will actually use.

04

Why it misses black objects and false-triggers in sunlight

  • ✓Dark and matte surfaces absorb IR, so black tape or a black robot may be invisible.
  • ✓Shiny surfaces reflect IR away at an angle.
  • ✓Sunlight and halogen lamps carry a lot of IR and swamp the photodiode. Shield the sensor or use a modulated sensor (such as a 38 kHz IR receiver with a pulsed LED).
  • ✓It gives no distance value. For distance use the HC-SR04 or a VL53L0X laser sensor.
05

IR sensor types compared

ModuleRangeOutputBest for
FC-51 obstacle sensor2 to 30 cmDigitalObstacle avoidance, object counting
TCRT5000 reflective module1 to 25 mmDigital + analogLine following, edge detection, encoder wheels
Sharp GP2Y0A2110 to 80 cmAnalog distanceReal distance with a narrow beam
38 kHz IR receiver (TSOP / VS1838)Up to 10 m with a remoteDemodulated digitalRemote control, beam-break with a modulated LED
VL53L0X3 to 200 cmI2C distanceAccurate short-range distance
FC-51 obstacle sensor
Range:
2 to 30 cm
Output:
Digital
Best for:
Obstacle avoidance, object counting
TCRT5000 reflective module
Range:
1 to 25 mm
Output:
Digital + analog
Best for:
Line following, edge detection, encoder wheels
Sharp GP2Y0A21
Range:
10 to 80 cm
Output:
Analog distance
Best for:
Real distance with a narrow beam
38 kHz IR receiver (TSOP / VS1838)
Range:
Up to 10 m with a remote
Output:
Demodulated digital
Best for:
Remote control, beam-break with a modulated LED
VL53L0X
Range:
3 to 200 cm
Output:
I2C distance
Best for:
Accurate short-range distance
06

Common mistakes to avoid

  • !Expecting a distance value from a digital obstacle sensor.
  • !Mounting the emitter and receiver where the robot's own body reflects IR back.
  • !Testing indoors, then running outdoors where sunlight triggers it constantly.
  • !Forgetting the output is active LOW.
  • !Turning the trimmer to maximum, which makes the sensor always on.
07

Frequently asked questions

What is the range of an IR obstacle sensor?

About 2 to 30 cm for the common FC-51 module, adjustable with the trimmer. Real range depends on the object's colour and surface.

Why does my IR sensor not detect black objects?

Black and matte surfaces absorb infrared instead of reflecting it, so little light returns. Use an ultrasonic sensor for those objects.

Can an IR sensor measure distance?

Digital modules cannot. Analog sensors such as the Sharp GP2Y0A21, or time-of-flight sensors like the VL53L0X, give a distance value.

Does an IR obstacle sensor work with ESP32?

Yes. Power it from 3.3 V so the output never exceeds 3.3 V, and read it on any GPIO.

What is the difference between an IR obstacle sensor and a TCRT5000?

Both use reflected IR. The TCRT5000 works at a few millimetres and often has an analog output, which suits line-following robots. The obstacle sensor is tuned for several centimetres.

Parts for this guide

  • TCRT5000 Single Channel Line Tracking Sensor Module
    ₹41View
  • TCRT5000 Dual Channel Line Tracking Sensor Module – Infrared Reflective Detection
    ₹36View
  • Digital 38kHz Infrared Receiver Module
    ₹48View
Shop Light & Optical SensorsShop Motion & Position Sensors

Terms in this guide

InfraredLight just beyond red that people cannot see, used by IR obstacle sensors, remote controls and line-following sensors.ComparatorA circuit that compares two voltages and outputs HIGH or LOW depending on which is larger. Sensor modules use one (often an LM393) to produce their digital output.Active-lowA signal that is 'on' when pulled to 0 V. Many relay modules switch on when their input is LOW.Open-collectorAn output that can only pull LOW; it needs a pull-up resistor to go HIGH. Many sensor modules and the LM393 comparator work this way.PhotodiodeA diode that produces a small current in proportion to light. Faster and more linear than an LDR, used in IR receivers and light meters.

Projects that use it

Put this into practice: 11 step-by-step builds in our project library use parts from this guide.

Intermediate · 3–4 hoursLine follower robot with L298N and TCRT5000View projectIntermediate · 3 hoursTable-edge avoiding robotView projectBeginner · 45 minutesConveyor and production line counterView project
Browse all 11 projects

Keep learning

Component guideBeginnerHC-SR04 Ultrasonic SensorThe HC-SR04 measures distance from about 2 cm to 4 m by sending a 40 kHz ultrasonic pulse and timing the echo.3 min read · SensorsHow-toIntermediateLine Follower RobotA line follower uses a row of infrared reflective sensors (TCRT5000 type) under the robot to see a black line on a white floor, and steers two DC motors to keep the line centred.3 min read · RoboticsComponent guideBeginnerPIR Motion Sensor (HC-SR501)A PIR (passive infrared) sensor detects movement of warm bodies by sensing changes in infrared heat across its field of view.3 min read · SensorsComponent guideBeginnerArduino UnoThe Arduino Uno is a beginner-friendly microcontroller board that reads sensors and controls LEDs, motors and relays using simple C++ programs called sketches.5 min read · Boards & Microcontrollers

Sources

  • TCRT5000 datasheet (Vishay)
  • LM393 comparator datasheet (Texas Instruments)
  • FC-51 module schematic (community documentation)

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerHow an IR obstacle sensor worksWiring and codeSetting the rangeWhy it misses black objects and false-triggers in sunlightIR sensor types comparedCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide1 item · ₹509

Waveshare IR Proximity Obstacle Avoidance Sensor Module – 2-30cm Range, 35° Angle, LM393 Comparator

Run itChange the inputs and watch the output
Module LED OFF
Serial monitor9600 baud
Clear

A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.

Ask the Community

Ask a question