The ultrasonic sensor features a sealed, waterproof, dustproof probe, ideal for harsh, wet environments. All signal processing components are built into the module, enabling users to read distance directly via the Asynchronous Serial Interface. Operating at 9600 baud, the sensor can connect seamlessly to the main host or other MCUs, significantly reducing development time.
The DFRobot A02YYUW Waterproof Ultrasonic Sensor (SKU: SEN0311) is a durable distance sensor suitable for challenging or humid environments, thanks to its IP67 waterproof and dustproof ratings. It is commonly employed in DIY electronics, robotics, and industrial automation.
Key features include
| Accuracy | ±1 cm |
|---|---|
| Operating Voltage | 3.3 .. 5 V |
| Average Current | <8 mA |
| Blind Zone Distance | 3 cm |
| Detecting Range(Flat object) | 3 .. 450 cm |
| Output | UART |
| Response Time | 100 ms |
| Operating Temperature | -15 .. 60 ℃ |
| Storage Temperature | -25 .. 80 ℃ |
| Reference Angle | 60º |
| Waterproof Grade | IP67 |
If you'd like to support the development of the site with the price of a coffee — or a few — please do so here.
Here's a handy tip: you can quickly save this page as a PDF by clicking “export to PDF” in the menu on the right side of the screen.
Pinout
| Color | A0221AU Unit | Arduino Pin | Notes |
|---|---|---|---|
| red wire | Vcc | Arduino 5V | Power input (3.3 .. 5 V) |
| black wire | GND | Arduino GND | GND |
| yellow wire | Rx | Arduino Pin 11 (Not strictly needed if the sensor is in auto-output mode) | Receive |
| white wire | Tx | Arduino Pin 10 | Transfer |
Arduino Example Code
This code listens for the data packet, verifies the checksum, and calculates the distance in millimeters.
#include <SoftwareSerial.h> // RX on Pin 10, TX on Pin 11 SoftwareSerial mySerial(10, 11); unsigned char data[4]; int distance; void setup() { Serial.begin(115200); // To PC mySerial.begin(9600); // To Sensor Serial.println("A0221AU Sensor Initialized..."); } void loop() { if (mySerial.available() > 0) { // Look for the header byte (0xFF) if (mySerial.read() == 0xFF) { data[0] = 0xFF; for (int i = 1; i < 4; i++) { data[i] = mySerial.read(); } // Verify checksum: (data[0] + data[1] + data[2]) & 0x00FF byte checksum = (data[0] + data[1] + data[2]) & 0xFF; if (data[3] == checksum) { distance = (data[1] << 8) + data[2]; Serial.print("Distance: "); Serial.print(distance); Serial.println(" mm"); } else { Serial.println("Checksum Error"); } } } delay(100); }
Implementation Tips
This page has been accessed for: Today: 2, Until now: 4