US-016 Voltage-Type Ultrasonic Distance Sensor
The US-016 is the only ultrasonic distance sensor on the market with analog output, where the output voltage is proportional to the measured distance, making it easy to connect with other systems. The US-016 provides stable and reliable operation.
The US-016 ultrasonic distance sensor offers non-contact distance measurement from 2 cm to 3 meters, operating at a supply voltage of 5V and a current of 3.8 mA. It supports analog voltage output and offers stable, reliable performance. The sensor’s range can be adjusted based on different application requirements (with maximum distances of 1m and 3m). When the Range pin is left floating, the maximum range is 3m. The US-016 converts the measured distance to an analog voltage output, with the output voltage being directly proportional to the measured distance.
Module Source
Purchase Link:
https://item.taobao.com/item.htm?spm=a1z10.3-c-s.w4002-19589090137.10.3a9936b4x1Y5oZ&id=609282906435
Baidu Netdisk Download Link:
http://pan.baidu.com/s/1c08JuBQ
Specifications
Operating Voltage: 3.3V-5V Operating Current: 3.8MA
Sensing Angle: Less than 15 degrees
Detection Range: 2cm-300cm
Detection Accuracy: 0.3cm + 1%
Output Type: Analog Voltage
Pin Count: 4 pins
Hardware Connection
Instruction
After powering up the module, the system first checks the input level of the Range pin to set the measurement range accordingly. When the Range pin is at a high level, the range is set to 3m; when at a low level, the range is limited to 1m. Following this configuration, the system initiates continuous distance measurement, with the results output as an analog voltage through the Out pin. As the distance changes, the analog voltage adjusts accordingly. The analog voltage is proportional to the measured distance, with an output range of 0 to Vcc.
- When the system range is set to 1m, the measured distance is: L = 1024*Vout/Vcc (mm). An output voltage of 0V corresponds to a distance of 0m, and an output of Vcc corresponds to 1.024m.
- When the system range is set to 3m, the measured distance is: L = 3096*Vout/Vcc (mm). An output voltage of 0V corresponds to a distance of 0m, and an output of Vcc corresponds to 3.072m.
- Connect the VCC pin of the US-016 module to the 5V pin of the development board.
- Connect the GND pin to the GND pin on the development board.
- Connect the Analog Output pin (signal output) of the US-016 module to the A0 analog input pin on the development board.
- Leave the Range pin of the US-016 module unconnected.
Usage Method
Here is a basic Arduino example code to read data from the US-016 voltage-based ultrasonic sensor connected to an analog pin and convert it into distance (in centimeters).
/******************************************************************************
* Test Hardware: LCSC ColorEasyDuino Development Board
* Version Number: V1.0
* Modified By: www.lckfb.com
* Modification Date: April 9, 2024
* Function Overview:
*****************************************************************************
* Open-source development board hardware and software information and related projects hardware and software information on official website
* Development board official website: www.lckfb.com
* Technical support resident forum, any technical problems are welcome at any time to exchange learning
* LCSC Forum: club.szlcsc.com
* Follow our Bilibili account: [立创开发板], stay toned to our latest news!
* We focus on cultivating Chinese engineers rather than profiting from board sales.
******************************************************************************/
const int ultrasonicPin = A0; // 定义连接到传感器输出的Arduino的模拟输入引脚
void setup() {
Serial.begin(9600); // 开始串行通信
}
void loop() {
// 读取模拟输入
int sensorValue = analogRead(ultrasonicPin);
// 量程为3米时距离公式为:L = (A*3072/1024)*(Vref/Vcc)
// 量程为1米时距离公式为:L = (A*1024/1024)*(Vref/Vcc)
// A 为 采集到的ADC值,Vref 为 ADC 的参考电压,Vcc 为 US-016 的电源电压
float distance = sensorValue*3;
// 打印结果
Serial.print("V, Distance: ");
Serial.println(distance);
delay(1000); // 每次读取之间等待一秒
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Usage Testing
The ultrasonic range is determined as follows: When the Range pin is grounded, the range is 1m; When the Range pin is connected to VCC, the range is 3m; When the Range pin is left floating, the range is also 3m. During testing, the Range pin is left floating, so the range is set to 3m. An object is placed 20cm away from the sensor, and the sensor measures and outputs the data through the serial port.