meta data for this page
lamaPLC: A0221AU / A02YYUW Waterproof Ultrasonic Distance Sensor with UART communication
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
- Integrated Processing: All signal processing is performed internally, and the module outputs the final distance value directly via a UART (serial) interface. This simplifies the code required for microcontrollers such as Arduino or Raspberry Pi.
- Automatic Mode: The “U” in the A02YYUW designation signifies it is the UART version operating in “Automatic Mode,” which continuously transmits data that can be read at any time without requiring a trigger signal.
- Reliability: DFRobot states that its closed, separated probe design, combined with strong interference resistance, ensures stable, reliable data output even in smog- or dust-laden environments.
Specification
| 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.
Arduino & A0221AU Unit
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
- Blind Zone: These sensors typically have a blind spot of about 3cm to 25cm; readings within this range are inaccurate.
- Baud Rate: Most A02 series sensors default to 9600 baud.
- Power: These modules can be power-hungry during the ultrasonic pulse; if readings are unstable, add a 100 uF capacitor across the sensor's VCC and GND pins.
UART topics on lamaPLC
| Page | Date | Tags |
|---|---|---|
| 2025/05/31 21:56 | 1-wire, communication, bus, microlan, i2c, uart, usart, ds18b20 | |
| 2024/11/15 20:15 | communication, satellite, navigation, gps, ocx, cdma, glonass, beidou, galileo, qzss, uart, arduino | |
| 2025/02/11 20:21 | bus, communication, uart, rs-232, rs-422, rs-485 | |
| 2026/02/14 22:31 | a0221au, a02yyuw, waterproof, ultrasonic, distance, sensor, uart, ip67, serial, sen0311, dfrobot | |
| 2025/11/21 23:07 | esp8266, esp32, esp32-c2, esp32-c3, esp32-c5, esp32-c6, esp32-c61, esp32-h2, esp32-s2, esp32-s3, esp32-p4, espressif systems, communication, ethernet, ip, wi-fi, thread, zigbee, matter, homekit, bluetooth, mqtt, adc, spi, uart, i2c, i2s, rmt, pwm, usb, usb otg, twai | |
| 2026/02/15 20:20 | mh-z19, mh-z19d, mh-z19c, mh-z19b, mh-z19e, ndir, co₂, sensor, winsen, uart, pwm, communication, non-dispersive infrared, infrared, ir, temperature, arduino, code, tasmota | |
| 2026/02/14 22:53 | cjmcu-750, cjmcu-752, cjmcu, nxp, sc16is750, sc16is752, uart, serial, i2c, spi, modul, converter, arduino, code |
This page has been accessed for: Today: 8, Until now: 141