Introduction
This ultrasonic time-of-flight (TOF) sensor utilizes the difference in energy of the ultrasonic echo signal on various surfaces to identify materials. Featuring ultra-low power, small size, and light weight, the ultrasonic material detection sensor is specially designed for material identification within a short range of 2-10cm. The ultrasonic sensor can distinguish hard and soft materials and output information by IO (high/low) or UART. Compact and easy to install, it is mainly suitable for robotic cleaners to identify the floor material and automatically adjust the cleaning strategy according to the recognized ground information, thus achieving intelligent cleaning.
Specification
- Input Voltage: 3.3V
- Start-up Current: 50mA
- Operating Current: 8mA
- Driving Frequency: 175KHz
- Detection Range: 2 to 10cm
- Detection Frequency: 100Hz
- FOV: 45°
- Operating Temperature:-10 to 50℃
- Storage Temperature: -30 to 70℃
- Lifetime: 3000h
- EDS Protection Level: 15KV
- Protection Level: IP54
- Communication Mode: UART/IO
- Weight: 1.0g (wires not included)
Interface
Note: there is a ο mark at welding pin 1 of the wiring base
NO | Signal | Type | Description | Min | Typical | Max |
---|---|---|---|---|---|---|
1 | Rx | Input | UART | 0V | 3.3V | 3.5V |
2 | Tx/IO | Output | TTL level | 0V | 3.3v | 3.5V |
3 | GND | Power | Power Negative | - | 0V | - |
4 | P3V3 | Power | Power positive | 2.8V | 3.3V | 3.6V |
Product size
Assembly diagram
Requirements
Hardware
DFRduino UNO R3 X 1 Ultrasonic Material Detection Sensor X 1 ZH1.5T-4P terminal connector X 1
Software Arduino IDE Click to Download Arduino IDE from Arduino® supports IO mode and serial mode. The IO mode is used by default when the module is powered on.
IO mode wiring diagram
Sample Code
int ledPin = 13; // LED connected to digital pin 13
int inPin = 8; // pushbutton connected to digital pin 8
int val = 0; // variable to store the read value
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output
pinMode(inPin, INPUT); // sets the digital pin 8 as input
digitalWrite(ledPin, LOW);
}
void loop() {
val = digitalRead(inPin); // read the input pin
if (val)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
delay(50);
}
The response time for judgment in IO mode is 10ms; When the target material is a soft material, the TX pin outputs a low level of 0V; When the target material is a hard material, the TX pin outputs a high level of 3.3V
Serial mode wiring diagram
Module is powered on, it sends instructions to the module through the serial port to switch from IO mode to serial port mode. After that, the module sends related data at a frequency of 100 Hz. This data follows the module's serial port software communication protocol.
Baud Rate | Data Bits | Stop Bits | Parity Bit | Flow Control |
---|---|---|---|---|
115200 | 8 Bits | 1 | No | No |
Sample Code
#include <SoftwareSerial.h>
SoftwareSerial mySerial(9, 10); // RX, TX
unsigned char Send_Date[6] = {0XAA,0XAA,0XFE,0X01,0X00,0X53};
unsigned char buffer_RTT[100] = {};
uint8_t checksum = 0;
void setup() {
Serial.begin(9600);
mySerial.begin(115200);
mySerial.write(Send_Date,6);
}
void loop() {
while (mySerial.available() > 0)
{
if(mySerial.read() == 0XAA)
{
buffer_RTT[0]=0XAA;
for(int i=1;i<8;i++)
{
buffer_RTT[i]=mySerial.read();
}
checksum =(buffer_RTT[0]+buffer_RTT[1]+buffer_RTT[2]+buffer_RTT[3]+buffer_RTT[4]+buffer_RTT[5]+buffer_RTT[6])&0X00FF;
if(buffer_RTT[7]== checksum)
{
Serial.println(buffer_RTT[4]); //read data bit status
}
}
}
delay(5);
}
When hard material is detected, the serial port prints 0; when soft material is detected, the serial port prints 1.
Material testing instructions
1、 Material description, common hard materials include: wooden floor, ceramic tiles, marble; common soft materials include: carpet (long-haired carpet,medium-haired carpet, short-haired carpet), sponge, etc..
2、 The unevenness and the excessively large floor gap of the hard material ground may cause the echo value of the hard material to be significantly weakened and be misjudged as a soft material. Therefore, it is not recommended to be used in complex scenes with the flatness of the ground. In order to enhance reliability, it is recommended to coordinate the detection with the movement of the sweeping robot, and use multiple detection results within a certain range to assist in the determination, which can prevent other conditions from affecting the detection..