Underwater Ultrasonic Obstacle Avoidance Sensor -3m Arduino WiKi - DFRobot

Introduction

This is an underwater ultrasonic obstacle avoidance sensor specifically designed for underwater applications. It operates on a wide voltage range of 5-24V and features compact size, minimal blind spots, high precision, and high protection. Its underwater measurement range is from 2-300cm.

With an IP68 protection rating, this sensor can replace a camera for obstacle avoidance and meet the requirements of normal underwater navigation speeds. By using this obstacle avoidance sensor, underwater vehicles can achieve true "unmanned driving" without the need for human observation. Even at a depth of 10m, obstacle avoidance can still be easily accomplished.

Thanks to its small size and minimal blind spots, this sensor takes up minimal space and can be easily integrated into various projects.

Application Scenarios

Features

Specifications:

Board Overview

Num Label Description
Red line VCC power supply input positive pole
Black line GND power ground wire
Yellow line RX UART receiving data line
white 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 115200bps 8 1 None

2、Timing diagram

Timing diagram

Note: T1 ≥ 19ms; T2 ≈ 13ms

3、UART output format

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

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

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

=0XA7;

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

Decimal conversion is equal to 1953;

Tutorial

Requirements

Connection Diagram

Note: the sensor needs to be put into water to get data, otherwise the output distance value is 0

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(115200);
  mySerial.begin(115200);
}
void loop() {
  mySerial.write(COM);
  delay(100);
  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("mm");
      }
    }
  }
}

Expected Results

Put the sensor into the water, and if there is an obstacle in front, the distance between the sensor and the obstacle will be printed by serial port.

Arduino串口打印数据图

FAQ

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

More Documents