# 1. Glowing Ultrasonic Sensor ## 1.1 Illuminated Ultrasonic Sensor Description ### 1.1.1 Sensor Overview This module is an illuminated ultrasonic distance measurement sensor equipped with an industrial-grade ultrasonic ranging chip. The chip integrates the ultrasonic transmitting circuit, receiving circuit, and digital processing unit. The module communicates via the I²C interface, allowing users to read distance measurement data directly. ### 1.1.2 Working Principle During operation, the module automatically emits eight 40 kHz square waves and then checks for a returning signal. If a signal is received, the module outputs a high-level pulse. The duration of this high-level pulse corresponds to the time taken for the ultrasonic wave to travel to the obstacle and return. The distance is calculated using the following formula: $$ \text{Distance} = \frac{\text{High-level duration} \times \text{Speed of sound (340 m/s)}}{2} $$ Additionally, the ultrasonic probe integrates two RGB LEDs. The LEDs support adjustable brightness, and by varying the intensity of the red (R), green (G), and blue (B) channels or combining them, a wide range of colors can be displayed. This module has broad applications, most commonly in smart vehicles and intelligent robots for automatic obstacle avoidance. ## 1.2 Precautions Please do not use the device outside the specified voltage range. ## 1.3 Parameters Instruction For details about the chip used in this module, please refer to "**3. Chip Manual and Schematic**." ### 1.3.1 Pin Description | Pin | Description | | ---- | --------------- | | 5V | Power input | | GND | Ground cable | | SDA | SDA data cable | | SCL | SCL clock cable | ### 1.3.2 Specification
Parameter Value
Working Voltage DC 5V
Working Current 2mA
Working Frequency 40Hz
Effective Measurement Range 2cm~400cm
Measurement Angle 15°
Communication I²C
I²C Address (7 bits) 0x77
Port 5264-4AW
Working Temperature 0℃~50℃
Size 46mm × 20mm
Compatibility Modular LEGO-compatible
## 1.4 Program Outcome You can find tutorials and example programs for different platforms in the same directory of this section. Here, we'll simply use the Arduino IDE to demonstrate the testing process. In this example, the illuminated ultrasonic sensor is used to measure the distance to an object in front of it. Place an object in front of the sensor and slowly move it away—the readings in the Serial Monitor will gradually increase. Move the object closer again, and the readings will decrease. At the same time, the two built-in RGB LEDs provide a visual cue for distance: **"Too close"** → LEDs turn **"red"** **"Farther away"** → LEDs turn **"green"**