LS03-R5
AI

The **LS03-R5** is a common electronic sensor module, specifically a **Reflective Optical Photosensor** (often used as a line tracker or proximity switch). It operates based on the principle of infrared (IR) light emission and detection.
---
### 1. Key Components and Construction
The LS03-R5 typically consists of the following electronic parts integrated into a single housing:
| Part | Component Type | Function |
| :--- | :--- | :--- |
| **IR Emitter** | Infrared LED | Emits a beam of infrared light toward a surface. |
| **IR Detector** | Phototransistor | Detects the reflected IR light from the surface. |
| **Comparator IC** | LM393 (usually) | Compares the signal from the detector against a threshold. |
| **Potentiometer** | Variable Resistor | Adjusts the sensitivity/detection range. |
| **Resistors/Caps** | SMD Passive Components | Current limiting for the LED and signal filtering. |
---
### 2. Technical Specifications
The electrical characteristics are vital for integrating the LS03-R5 into a microcontroller project (like Arduino or ESP32).
| Parameter | Value/Range |
| :--- | :--- |
| **Operating Voltage (VCC)** | 3.3V to 5V DC |
| **Output Type** | Digital (High/Low) and sometimes Analog |
| **Detection Distance** | 1mm to 25mm (Adjustable) |
| **Signal Logic** | Logic 0 (Low) when object detected; Logic 1 (High) when clear |
---
### 3. Pinout Configuration
The module generally features a 3-pin or 4-pin interface:
1. **VCC:** Power Supply (3.3V - 5V).
2. **GND:** Ground.
3. **DO (Digital Output):** TTL level output based on the threshold set by the potentiometer.
4. **AO (Analog Output):** (Optional) Real-time voltage reflecting the intensity of the reflection.
---
### 4. Working Principle
The electronic logic follows these steps:
1. The **Infrared LED** continuously emits IR light.
2. If an object is within range, the light reflects back into the **Phototransistor**.
3. The phototransistor's resistance changes, creating a voltage swing.
4. The **LM393 Comparator** compares this voltage to the preset value from the **Potentiometer**.
5. If the reflection is strong enough, the output pin transitions to a **Low state (0V)** and an onboard LED usually lights up.
---
### 5. Sample Wiring (Arduino)
```cpp
// Basic code to read LS03-R5 Digital Output
int sensorPin = 2; // Connected to DO
int ledPin = 13; // Internal LED
void setup() {
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
int sensorState = digitalRead(sensorPin);
if (sensorState == LOW) {
digitalWrite(ledPin, HIGH); // Object detected
} else {
digitalWrite(ledPin, LOW); // No object
}
}
```
- ⤷How do I adjust the detection range using the onboard potentiometer?
- ⤷ What is the difference between the Digital Output and Analog Output on this sensor?
- ⤷ Can the LS03-R5 detect dark surfaces as effectively as light surfaces?