

The IR Sensor Module (LM393) is an infrared-based sensor designed to detect obstacles and measure distances by emitting and receiving infrared light. It utilizes the LM393 comparator for signal processing, ensuring reliable and accurate detection. This module is widely used in robotics, automation systems, and proximity detection applications due to its simplicity and effectiveness.








The IR Sensor Module (LM393) is equipped with the following technical features:
| Parameter | Specification |
|---|---|
| Operating Voltage | 3.3V to 5V DC |
| Current Consumption | 20mA (typical) |
| Detection Range | 2cm to 30cm (adjustable via potentiometer) |
| Output Type | Digital (High/Low) |
| Comparator Chip | LM393 |
| Infrared Wavelength | 760nm to 1100nm |
| Dimensions | ~3.1cm x 1.5cm x 0.7cm |
The module typically has a 3-pin interface:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply pin. Connect to 3.3V or 5V DC. |
| 2 | GND | Ground pin. Connect to the ground of the power supply. |
| 3 | OUT | Digital output pin. Outputs HIGH (1) when no obstacle is detected, LOW (0) when an obstacle is detected. |
VCC pin to a 3.3V or 5V power source and the GND pin to the ground.OUT pin to a digital input pin of your microcontroller (e.g., Arduino UNO).OUT pin. The onboard LED will also light up when an obstacle is detected.Below is an example of how to connect and use the IR Sensor Module with an Arduino UNO:
VCC pin of the module to the 5V pin on the Arduino.GND pin of the module to the GND pin on the Arduino.OUT pin of the module to digital pin 2 on the Arduino.// IR Sensor Module Example Code
// This code reads the digital output of the IR sensor and prints the status
// to the Serial Monitor. The onboard LED on pin 13 will also toggle based
// on the sensor's output.
const int irSensorPin = 2; // IR sensor output connected to digital pin 2
const int ledPin = 13; // Onboard LED pin
void setup() {
pinMode(irSensorPin, INPUT); // Set IR sensor pin as input
pinMode(ledPin, OUTPUT); // Set LED pin as output
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int sensorValue = digitalRead(irSensorPin); // Read the sensor output
if (sensorValue == LOW) {
// Obstacle detected
digitalWrite(ledPin, HIGH); // Turn on LED
Serial.println("Obstacle detected!");
} else {
// No obstacle
digitalWrite(ledPin, LOW); // Turn off LED
Serial.println("No obstacle.");
}
delay(100); // Small delay for stability
}
The sensor is not detecting obstacles:
VCC and GND connections).False detections or erratic behavior:
The onboard LED does not light up:
OUT pin connection and ensure it is properly connected to the microcontroller.The detection range is too short:
Q: Can the IR Sensor Module detect transparent objects?
A: No, the module may struggle to detect transparent or highly absorbent surfaces as they do not reflect infrared light effectively.
Q: Can I use this module with a 3.3V microcontroller?
A: Yes, the module supports an operating voltage of 3.3V to 5V, making it compatible with 3.3V systems.
Q: How do I increase the detection range beyond 30cm?
A: The detection range is hardware-limited. For longer ranges, consider using a different sensor designed for extended distances.
Q: Is the module suitable for outdoor use?
A: The module can be used outdoors, but strong sunlight or other infrared sources may interfere with its performance. Use shielding or filters if necessary.