Small Angle Ultrasonic Ranging Sensor-8m Arduino WiKi- DFRobot

Introduction

This is a small-angle ultrasonic ranging sensor that uses intelligent signal processing circuits, built-in high-precision algorithms, and a measurement range of 25-800cm. It has the characteristics of small blind spots, high precision, fast response, and low power consumption.

The sensor has an IP67 protection level and an onboard temperature compensation function, which can automatically correct temperature deviations and can stably measure distances from -15°C to 60°C. Ultrasonic ranging is not affected by the color, transparency, and material (metal, non-metal) of the detected object, and is suitable for various humid and harsh measurement environments.

The sensor has a maximum measurement angle of about 15°, a small beam angle, and is not affected by the environment. It can still measure obstacles in a narrow environment and can be used in scenarios such as smart manhole cover water level detection, reservoir water tank liquid level detection, river water level detection, and small-angle horizontal detection.

Features

Specifications:

Board Overview

Num Label Description
Red line VCC power supply input positive pole
Black line GND power ground wire
Blue line RX UART receiving data line
Green line TX UART transmitting data line

Dimensional Drawing

Dimensional Drawing

Output Format

1、communication instructions

Interface Baud rate Data bit Stop bit Check bit
UART 9600bps 8 1 None

2、Timing diagram

Timing diagram

Note: T1>2.5s, T2=0.9~2.5s; RX falling edge trigger pulse width is recommended to be between 10us-2ms

3、UART output format

Frame data Output data Description Bytes
Frame header 0XFF Frame header, fixed as 0XFF 1 byte
H_DATA 0X01 Higher 8 bits of distance data 1 byte
L_DATA 0XA1 Lower 8 bits of distance data 1 byte
SUM 0XA1 data checksum 1 byte

SUM= (header+Data_H+ Data_L)&0x00FF

=(0XFF + 0X01 + 0XA1)&0x00FF

=0XA1;

Distance value = DATA_ H * 256+DATA_L = 0x01A1;

Decimal conversion is equal to 417,Indicates that the currently measured distance value is 417cm.

Tutorial

Requirements

Connection Diagram

Arduino Wiring diagram

Sample Code

#include <SoftwareSerial.h>
unsigned char buffer_RTT[4] = {0};
uint8_t CS;
#define COM 0x55
int Distance = 0;
SoftwareSerial mySerial(7, 8); 
void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
}
void loop() {
  mySerial.write(COM);
  delay(10);
  if(mySerial.available() > 0){
    delay(4);
    if(mySerial.read() == 0xff){    
      buffer_RTT[0] = 0xff;
      for (int i=1; i<4; i++){
        buffer_RTT[i] = mySerial.read();   
      }
      CS = buffer_RTT[0] + buffer_RTT[1]+ buffer_RTT[2];  
      if(buffer_RTT[3] == CS) {
        Distance = (buffer_RTT[1] << 8) + buffer_RTT[2];
        Serial.print("Distance:");
        Serial.print(Distance);
        Serial.println("cm");
      }
    }
  }
}

Expected Results

If there is an obstacle or liquid in front of the sensor, the serial port prints out the distance value between the sensor and the obstacle or liquid.

Arduino串口打印数据图

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents