Choosing the wrong proximity sensor type is one of the most common mistakes in Arduino and IoT projects. An IR sensor that works perfectly indoors fails in sunlight. An ultrasonic sensor that detects objects 3 meters away struggles with soft fabrics. A capacitive sensor that detects water through a wall is completely fooled by a metal object.
Each proximity sensing technology has specific strengths and limitations that make it ideal for some applications and terrible for others. This guide breaks down every major proximity sensor type available to makers in India — IR, ultrasonic, capacitive, PIR, and LiDAR — with concrete specs, wiring guidance, and project recommendations.
1. What Is Proximity Sensing?
A proximity sensor detects the presence or absence of an object — and in many cases, the distance to it — without physical contact. This is fundamental to a huge range of applications: automatic door openers, robotic obstacle avoidance, liquid level detection, touchless buttons, intruder detection, and industrial assembly line verification.
Unlike a simple switch, a proximity sensor works over a distance and can return either a binary (present/absent) signal or an analog/digital value representing distance. The technology used determines everything: range, accuracy, response time, power consumption, and sensitivity to environmental conditions.
2. IR (Infrared) Proximity Sensors
How IR Proximity Works
An IR proximity sensor emits infrared light from an IR LED and measures the reflected signal with a photodetector. When an object comes within range and reflects the IR beam back, the receiver detects the increase in IR signal strength.
There are two main types:
- Reflective IR sensors: Transmitter and receiver side by side; detects objects by reflection. Examples: TCRT5000, Sharp GP2Y series.
- Break-beam IR sensors: Transmitter and receiver on opposite sides; object detection by interrupting the beam. Examples: optocouplers, through-beam sensors.
IR Sensor Specifications
- Range: 2–30 cm (reflective), up to several meters (beam-break)
- Response time: Very fast (<1 ms)
- Power: Low (typically 20–50 mA)
- Output: Analog or digital (depending on module)
- Cost: Very low (₹20–150 per module)
IR Sensor Limitations
- Sunlight interference: Bright sunlight contains strong IR and can saturate the receiver, causing false readings. This makes basic IR sensors unreliable outdoors.
- Surface dependence: Dark or matte surfaces absorb IR and may not be detected even when close. Shiny surfaces may deflect the beam away from the receiver.
- No distance measurement: Simple IR modules give only binary (object present/absent) output, not distance.
When to Use IR Sensors
IR sensors are ideal for indoor object detection at short ranges, line-following robots, proximity switches on enclosed machinery, and any application where cost is the primary constraint. They are NOT suitable for outdoor use, dark/absorptive materials, or when you need actual distance measurement.
AC 220V Security PIR Human Body Motion Sensor Detector
Mains-voltage PIR sensor for direct integration with 220V lighting — no microcontroller required. Perfect for automatic light switches and security systems.
3. Ultrasonic Sensors: HC-SR04 and Waterproof Variants
How Ultrasonic Sensing Works
Ultrasonic sensors emit a burst of sound waves at 40 kHz (above human hearing) and measure the time taken for the echo to return. Since the speed of sound in air is known (~343 m/s at 20°C), distance is calculated as:
distance_cm = (echo_time_microseconds / 2) / 29.1
The HC-SR04 is the most popular Arduino-compatible ultrasonic sensor. It has a 4-pin interface (VCC, GND, Trig, Echo), a range of 2–400 cm, and costs under ₹80.
Ultrasonic Sensor Specifications
- Range: 2–400 cm (HC-SR04), 20–600 cm (JSN-SR04T waterproof)
- Accuracy: ±3 mm
- Beam angle: ~15° cone
- Response time: ~60 ms (one measurement cycle)
- Power: 15 mA at 5V
- Output: PWM pulse width proportional to distance
Ultrasonic Sensor Advantages
- Works on nearly any object regardless of colour or surface texture
- Not affected by ambient light (including sunlight)
- Provides actual distance, not just presence/absence
- Waterproof variants available for outdoor and liquid-level applications
- Excellent range for the price
Ultrasonic Sensor Limitations
- Soft/angled surfaces: Sound-absorbing materials (foam, fabric, acoustic tiles) return weak echoes or none at all. Surfaces angled away from the sensor deflect the beam.
- Temperature sensitivity: Speed of sound changes with temperature (~0.6 m/s per °C). For high accuracy in variable temperatures, compensate using a temperature sensor.
- Minimum distance: Cannot measure objects closer than ~2 cm reliably (the echo overlaps the pulse).
- Slow update rate: ~60 ms per measurement limits use in fast-moving applications.
A86 JSN-SR04T Waterproof Ultrasonic Rangefinder Module Version 3.0
IP67-rated waterproof ultrasonic sensor — ideal for water tank level monitoring, outdoor proximity detection, and harsh-environment distance measurement.
4. Capacitive Proximity Sensors
How Capacitive Sensing Works
Capacitive sensors detect objects by measuring changes in an electric field. Any material — water, plastic, metal, human skin, wood, or food — that changes the capacitance of the sensing element is detectable. This makes capacitive sensors uniquely able to detect objects through non-conductive barriers (like a plastic container wall).
In maker projects, capacitive sensing shows up in:
- Touch buttons and sliders
- Liquid level sensing through tank walls
- Soil moisture measurement (capacitive soil sensors)
- Human presence detection for touchless interfaces
Capacitive Sensor Specifications
- Range: 0–20 mm (industrial), 0–10 mm (maker modules)
- Materials detected: Almost everything (metals, liquids, organics, plastics)
- Output: Digital (threshold) or analog (capacitance value)
- Speed: Very fast (<1 ms)
- Power: Very low (microamps for some types)
Capacitive Sensor Limitations
- Short range: Industrial capacitive sensors detect objects at only a few millimetres distance.
- Interference: Humidity and temperature changes affect capacitance readings. Metal objects near the sensor can create false detections.
- Not suitable for long-range detection.
Capacitive Soil Moisture Sensor
Uses capacitive sensing to measure soil dielectric constant — no corrosion, no electrolysis. Detects moisture through the soil medium without direct contact with water.
5. PIR Motion Sensors: A Special Case
PIR (Passive Infrared) sensors are often grouped with proximity sensors but work quite differently. Rather than emitting any signal, they passively detect changes in infrared radiation emitted by warm bodies (humans, animals). A PIR sensor does NOT measure distance — it detects the change in heat pattern across its field of view when a person moves through it.
Key PIR Characteristics
- Detection range: 5–10 metres (typical for modules), adjustable on most modules
- Field of view: 110° typical (lens-dependent)
- Output: Digital HIGH when motion detected
- Power: Very low (milliamps)
- Limitations: Cannot detect stationary people; pets may trigger false alarms; detection zone has blind spots close to sensor
PIR sensors are the right choice for room occupancy detection, automatic lighting, and security systems. They are the wrong choice if you need to detect non-moving objects or measure exact distances.
B2X2 4 Elements Infrared Motion Analog PIR Sensor for Lighting
4-element dual-axis PIR sensor with analog output — reduces false triggers by requiring motion across both sensing zones. Ideal for directional detection in corridors.
6. LiDAR: High-Precision Proximity
LiDAR (Light Detection and Ranging) uses pulsed laser light and time-of-flight measurement to determine distance with very high precision. Unlike ultrasonic sensors, LiDAR can detect objects at very high speed, over long ranges, with millimetre accuracy.
Consumer LiDAR modules like the TF-Luna, TFmini, or Benewake AD2-S-X3 bring this technology to maker-level projects. They communicate via UART or I2C and provide distance measurements up to 8–250 metres depending on the model.
LiDAR vs Ultrasonic
- LiDAR: faster (up to 1000 Hz), more accurate (±3 mm), longer range, works better on angled surfaces, but costs more and can be affected by transparent surfaces and strong ambient light.
- Ultrasonic: cheaper, works in fog/dust/some reflective scenarios LiDAR cannot handle, minimum range >2 cm, slower.
Benewake AD2-S-X3 High-Performance Automotive-Grade LiDAR
Automotive-grade 3D LiDAR for autonomous driving and advanced robotics — extremely precise 3D mapping at high update rates, far beyond what ultrasonic or IR can achieve.
7. Side-by-Side Comparison Table
| Feature | IR | Ultrasonic | Capacitive | PIR | LiDAR |
|---|---|---|---|---|---|
| Range | 2–30 cm | 2–400 cm | 0–20 mm | 5–10 m | 0.1–250 m |
| Measures Distance? | No (basic) | Yes | No | No | Yes |
| Works Outdoors? | Poor | Yes | Yes | Yes | Yes |
| Surface Dependent? | High | Low | None | None | Medium |
| Typical Cost (India) | ₹20–150 | ₹60–500 | ₹80–300 | ₹50–400 | ₹1,500+ |
| Best Use Case | Indoor, close range | Distance/level | Touch/liquid | Human presence | Robotics/auto |
8. How to Choose the Right Proximity Sensor
Use this decision tree to pick the right technology:
- Do you need to detect humans/animals specifically? → PIR sensor.
- Do you need distance measurement up to 4 metres, on solid objects, in any lighting? → Ultrasonic (HC-SR04 or JSN-SR04T for waterproof).
- Do you need distance measurement with high accuracy and speed, budget allows? → LiDAR.
- Do you need to detect liquid level, soil moisture, or objects through a non-conductive barrier? → Capacitive sensor.
- Indoor only, close range (<20 cm), cost-sensitive? → IR sensor.
9. Arduino Code Examples
Ultrasonic HC-SR04 Distance Measurement
#define TRIG_PIN 9
#define ECHO_PIN 10
void setup() {
Serial.begin(9600);
pinMode(TRIG_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
}
float getDistanceCm() {
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
long duration = pulseIn(ECHO_PIN, HIGH, 30000);
if (duration == 0) return -1; // timeout = out of range
return (duration / 2.0) / 29.1;
}
void loop() {
float dist = getDistanceCm();
if (dist < 0) {
Serial.println("Out of range");
} else {
Serial.print("Distance: ");
Serial.print(dist);
Serial.println(" cm");
}
delay(100);
}
PIR Motion Detection
#define PIR_PIN 2
#define LED_PIN 13
void setup() {
Serial.begin(9600);
pinMode(PIR_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
delay(30000); // PIR warm-up time (important!)
Serial.println("PIR ready");
}
void loop() {
int motion = digitalRead(PIR_PIN);
if (motion == HIGH) {
digitalWrite(LED_PIN, HIGH);
Serial.println("Motion detected!");
} else {
digitalWrite(LED_PIN, LOW);
}
delay(100);
}
10. Project Ideas by Sensor Type
IR Sensor Projects
- Line-following robot (TCRT5000 array)
- Automatic coin counter
- Touchless hand sanitizer dispenser
- Visitor counter for shops
Ultrasonic Sensor Projects
- Water tank level monitor with SMS alert
- Obstacle-avoiding robot
- Parking distance sensor
- Blind stick distance warning system
PIR Sensor Projects
- Automatic corridor light
- Home security alarm
- Energy-saving monitor (turn off devices when room empty)
- Wildlife camera trigger
Capacitive Sensor Projects
- Smart plant watering system
- Touchless elevator buttons
- Liquid level in sealed tanks
- Interactive music instrument
FAQ: Proximity Sensor Types
What is the difference between an IR proximity sensor and a PIR sensor?
An IR proximity sensor actively emits infrared light and detects reflection from objects — it can detect any object at close range. A PIR (Passive Infrared) sensor does not emit anything; it passively detects changes in heat (infrared radiation) emitted by warm bodies. PIR sensors only detect moving warm objects (humans, animals) at longer range but cannot detect static objects or measure distance.
Can an ultrasonic sensor detect water level?
Yes, ultrasonic sensors work very well for water level detection. Mount the sensor above the tank pointing downward. As water level rises, the distance decreases. The waterproof JSN-SR04T version is ideal as it can be mounted in humid or splashing environments. This is one of the most popular uses of ultrasonic sensors in Indian maker projects — overhead tank level monitors with mobile notifications.
Why does my IR sensor give false readings in sunlight?
Sunlight contains a broad spectrum of infrared radiation. If this ambient IR is strong enough, it saturates the IR photodetector even when no object is present, causing constant false detections. Solutions: use a sensor with modulated IR (like Sharp GP2Y series or TCRT5000 with modulated driver), add an IR filter lens, shade the sensor from direct sunlight, or switch to an ultrasonic sensor which is immune to light interference.
Which proximity sensor is best for a robot obstacle avoidance project?
For indoor robots, an HC-SR04 ultrasonic sensor provides reliable detection of most solid obstacles at 2–400 cm. For faster, more accurate robots, a TFmini or TF-Luna LiDAR is better (1000 Hz update rate, ±3mm accuracy). Many competition robots use both: ultrasonic for wide-angle detection and a LiDAR for precise forward distance. IR sensors are used for short-range cliff detection or line following but are unreliable for general obstacle avoidance.
Can a proximity sensor detect a person sitting still?
PIR sensors cannot detect a stationary person — they only respond to movement. For detecting a stationary person, you need an active sensor: ultrasonic (detects the body as a physical object), capacitive (detects the body’s electrical field changes), or a time-of-flight sensor. Some modern PIR modules combine PIR with radar for this purpose, but for simple Arduino projects, point an ultrasonic sensor at the chair/seat and check for a distance reading below a threshold.
Find the Right Proximity Sensor for Your Project
Understanding the difference between IR, ultrasonic, capacitive, and PIR proximity sensors is the key to building projects that actually work reliably. Stop guessing — pick the right technology for your specific application and your project will run smoothly from day one.
Zbotic stocks all major proximity sensor types for maker, student, and professional projects across India.
Add comment