# Long-Range Photoelectric Sensor
## **Principle**
The long-range photoelectric sensor is a detection switch based on the infrared reflection principle. Its primary function is to accurately detect the presence of obstacles in front of the sensor. The effective detection range is from 0 to 2 meters. Additionally, the sensor’s parameters can be flexibly adjusted using a potentiometer to accommodate various application scenarios.
## Specification
| Item | **Description** |
| :---: | :---: |
| Name | Long-Range Photoelectric Sensor |
| Number | B0020018 |
| Voltage | 5V - DC |
| Data Type | Digital Signal |
| Data Range | 0 or 1 |
| Interface Type | Grove |
| Module Size | 62×40 (mm) |
## **Usage**
|  | | |
| :---: | --- | --- |
|  |  |  |
| _Side View_ | _Front View_ | _Side View_ |
| **Long-range Photoelectric Sensor Connection Diagram** | | |
The long-range photoelectric sensor can be connected to the P0, P1, P2, P8, P12, or P16 ports on the micro:bit Intelligent Hub. By programming, its status can be monitored. When an obstacle is detected, the sensor outputs a low logic level ("0") and the red indicator light turns on. In the absence of an obstacle, it outputs a high logic level ("1") and the red light is off.

The long-range photoelectric sensor features a built-in sensitivity adjustment mechanism. Users can easily adjust sensitivity by turning the potentiometer at the rear. Rotating it clockwise increases the detection range and sensitivity, while counterclockwise rotation decreases the range and sensitivity.
## **Modular Coding**

In the MakeCode coding software, the sensor's signal value from the P0 port can be read using the Microbit extension. The data can then be visualized on the micro:bit’s LED matrix.