Welcome to RGB Ultrasonic module repository

RGB ultrasonic module





1. Description of Pin


According to the above figure, from left to right are: GND, ECHO, RGB, VCC.

The anti-reverse port is used here, which can be connected via 4pin cable or DuPont cable.


2. Ultrasonic Transmitter


This interface is used to transmit ultrasonic signals.

The input function of the ultrasonic module can be triggered by inputting a high level signal of at least 10μs to the transmit pin (the ECHO pin) of the ultrasonic module.(It recommended high level 10~15us)

3. Ultrasonic Receiver


After the ranging function is triggered, the module will automatically send out 8 40 kHz ultrasonic pulses and automatically detect whether there is a signal return. This step is automatically completed by the module.

The ECHO pin will output a high level once an echo signal is detected. The high level duration is the time from the transmission to the return of the ultrasonic wave.

Formula: Distance = High Time * Sound Speed (340M/S)/2.

In the general control program we will use the following formula to calculate the distance:

Distance = pulseIn(SingPin, HIGH) / 58.00

The reasons are as follows:

The pulseIn() unit is microsecond, and the sound propagation speed is 340m/s. The crystal frequency of the MCU is about 14MHZ, so the distance distance = 340*100/(1000000-14000)*pulseIn()/ 2, after simplifying it For pulseIn() / [(1000000-14000)*2 /(340*100)] is equal to pulseIn() / 58.0.

4. Main chip


We adopt STM8S003F3U6 chip, the data sheet for this chip is already available in the documentation. 

5. Operational Amplifier


We adopt LMV324 chip, the data sheet for this chip is already available in the documentation.

6. RGB


We adopt two WS2811.

7. Indicator light


When module is working, red indicator light D1 will keep flashing. 

8. Range

Detection distance is about 0~3m. 


1. This module should not be directly connected with power. If you want to connect with power, you need to connect the GND pin of the module at the first, otherwise it will affect the normal operation of the module.

2. When measuring distance, the measured object should be no less than 0.5 square meters and the plane should be flat as much as possible, otherwise the measurement result will be affected.