Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Robotics
  4. ›DYP A21 (3-500 cm)

Component guide · Intermediate · 4 min read

DYP A21 (3-500 cm) and A22 (2-300 cm) Obstacle Avoidance Ultrasonic Sensors

UART, PWM, RS485, CAN, I2C and Switch

By Geekobot Learning Team · Updated 29 Oct 2026

I'm using
Wiring, code and the Run it panels follow your board.
On this page
Short answerWhat the DYP A21 and A22 obstacle avoidance ultrasonic sensors isDYP A21 and A22 obstacle avoidance ultrasonic sensors pinoutWiring the DYP A21 and A22 obstacle avoidance ultrasonic sensorsExample codeSetup and tuningWhat you needAlternatives and when to choose themCommon mistakesFAQsParts and next steps
Short answer

The DYP A21 and A22 are waterproof ultrasonic sensors designed for obstacle avoidance on robots, AGVs and lawn mowers. Their very short blind zone (2 to 3 cm) and wide beam catch obstacles close to the robot. The A21 reaches 500 cm and the A22 300 cm. They come in UART, PWM, RS485, CAN, I2C and switch versions so they fit microcontrollers and industrial controllers alike.

Key specs at a glance

Range
3 to 500 cm (A21), 2 to 300 cm (A22)
Blind zone
About 2 to 3 cm
Beam
Wide, for obstacle detection
Output
UART (U, T), PWM (M), RS485 (4), CAN (CA), I2C (C), switch (GD)
Supply
3.3 to 5 V TTL, wider for RS485 and CAN
Protection
IP67

Models in this guide

These are alternatives. Pick the one that fits your project; you only need one.

  • Option 1DYP-A21AYYUW-V1.0 UART Auto Ultrasonic Obstacle Avoidance Sensor (Object Range 3 ~ 500cm)₹2,039
  • Option 2DYP-A21AYYTW-V1.0 UART Ultrasonic Obstacle Avoidance Sensor (3-500cm Range)₹2,099
  • Option 3DYP-A21AYY4W-V1.0 RS485 Ultrasonic Obstacle Avoidance Sensor (Object Range 3-500cm)₹2,619
  • Option 4DYP-A21AYYGDW-V1.0 TTL Switch Ultrasonic Obstacle Avoidance Sensor Object Range 3–500 cm₹2,829
  • Option 5DYP-A21AYYCAW-V1.0 CAN Ultrasonic Obstacle Avoidance Sensor (Object Range 3~500cm)₹2,897
  • Option 6DYP-A21AYYMW-V1.0 PWM Ultrasonic Obstacle Avoidance Sensor (Object Range 3-500cm)₹1,909
01

What the DYP A21 and A22 obstacle avoidance ultrasonic sensors is

The DYP A21 and A22 are waterproof ultrasonic sensors with a very short blind zone and wide beam, made for obstacle avoidance on robots and AGVs.

Several sensors on one robot can interfere. Use controlled (T), RS485 or CAN versions and trigger them one after another.

The I2C version (A22YYCW) lets several sensors share two wires with different addresses.

02

DYP A21 and A22 obstacle avoidance ultrasonic sensors pinout

The pins on the DYP A21 and A22 obstacle avoidance ultrasonic sensors and what each one does.

PinFunction
RedVCC
BlackGND
YellowRX / SCL / CAN-H / A
WhiteTX / SDA / CAN-L / B
PinFunction
Red
VCC
Black
GND
Yellow
RX / SCL / CAN-H / A
White
TX / SDA / CAN-L / B
03

Wiring the DYP A21 and A22 obstacle avoidance ultrasonic sensors

Connect the DYP A21 and A22 obstacle avoidance ultrasonic sensors like this.

DYP A21 and A22 obstacle avoidance ultrasonic sensors pinArduino UnoESP32
Red (VCC)5 V3.3 or 5 V (check model)
Black (GND)GNDGND
Yellow (RX / trigger)D11GPIO 17
White (TX)D10 (SoftwareSerial RX)GPIO 16
Red (VCC)
Arduino Uno:
5 V
ESP32:
3.3 or 5 V (check model)
Black (GND)
Arduino Uno:
GND
ESP32:
GND
Yellow (RX / trigger)
Arduino Uno:
D11
ESP32:
GPIO 17
White (TX)
Arduino Uno:
D10 (SoftwareSerial RX)
ESP32:
GPIO 16
04

Example code

A minimal sketch to check the part works.

Read a DYP UART sensor (ESP32) · Arduino C++Verify & upload in Electrolark
// DYP UART frame: 0xFF, distance high, distance low, checksum ((0xFF + H + L) & 0xFF), distance in mm
const int TRIG = 17;   // "controlled" (T) models: pull RX low or send a byte to trigger; "auto" (U) models stream

void setup() {
  Serial.begin(115200);
  Serial2.begin(9600, SERIAL_8N1, 16, TRIG);
}

void loop() {
  Serial2.write(0x55);                  // trigger for controlled models; ignored by auto models
  delay(100);
  while (Serial2.available() >= 4) {
    if (Serial2.read() != 0xFF) continue;
    uint8_t h = Serial2.read(), l = Serial2.read(), sum = Serial2.read();
    if (((0xFF + h + l) & 0xFF) == sum) {
      Serial.print((h << 8) | l); Serial.println(" mm");
    }
  }
}
05

Setup and tuning

Mount low and forward

place them at bumper height across the front of the robot.

Avoid crosstalk

trigger several sensors in turn, not all at once.

Output

choose UART, PWM, RS485, CAN, I2C or switch versions to suit your controller.

Stop distance

set a stop distance that allows for the robot's speed and braking.

Ground echoes

angle the sensor slightly up if the wide beam sees the floor.

06

What you need

Shop this list16 of 17 found in our store · ₹25,845

  • DYP-A21AYYUW-V1.0 UART Auto Ultrasonic Obstacle Avoidance Sensor (Object Range 3 ~ 500cm): the part this guide coversDYP-A21AYYUW-V1.0 UART Auto Ultrasonic Obstacle Avoidance Sensor (Object Range 3 ~ 500cm)₹2,039
  • DYP-A21AYYTW-V1.0 UART Ultrasonic Obstacle Avoidance Sensor (3-500cm Range): another version this guide coversDYP-A21AYYTW-V1.0 UART Ultrasonic Obstacle Avoidance Sensor (3-500cm Range)₹2,099
  • DYP-A21AYY4W-V1.0 RS485 Ultrasonic Obstacle Avoidance Sensor (Object Range 3-500cm): another version this guide coversDYP-A21AYY4W-V1.0 RS485 Ultrasonic Obstacle Avoidance Sensor (Object Range 3-500cm)₹2,619
  • DYP-A21AYYGDW-V1.0 TTL Switch Ultrasonic Obstacle Avoidance Sensor Object Range 3–500 cm: another version this guide coversDYP-A21AYYGDW-V1.0 TTL Switch Ultrasonic Obstacle Avoidance Sensor Object Range 3–500 cm₹2,829
  • DYP-A21AYYCAW-V1.0 CAN Ultrasonic Obstacle Avoidance Sensor (Object Range 3~500cm): another version this guide coversDYP-A21AYYCAW-V1.0 CAN Ultrasonic Obstacle Avoidance Sensor (Object Range 3~500cm)₹2,897
  • DYP-A21AYYMW-V1.0 PWM Ultrasonic Obstacle Avoidance Sensor (Object Range 3-500cm): another version this guide coversDYP-A21AYYMW-V1.0 PWM Ultrasonic Obstacle Avoidance Sensor (Object Range 3-500cm)₹1,909
  • DYP-A22YYUW-V1.0 UART Auto Ultrasonic Obstacle Avoidance Sensor (Object Range 2-300cm): another version this guide coversDYP-A22YYUW-V1.0 UART Auto Ultrasonic Obstacle Avoidance Sensor (Object Range 2-300cm)₹2,029
  • DYP-A22YYTW-V1.0 UART Ultrasonic Obstacle Avoidance Sensor Module – 2-300cm Range: another version this guide coversDYP-A22YYTW-V1.0 UART Ultrasonic Obstacle Avoidance Sensor Module – 2-300cm Range₹2,229
  • DYP-A22YY4W-V1.0 RS485 Ultrasonic Obstacle Avoidance Sensor (Object Range 2-300cm): another version this guide coversDYP-A22YY4W-V1.0 RS485 Ultrasonic Obstacle Avoidance Sensor (Object Range 2-300cm)₹2,099
  • DYP-A22YYMW-V1.0 PWM Ultrasonic Obstacle Avoidance Sensor Module (2-300cm Range): another version this guide coversDYP-A22YYMW-V1.0 PWM Ultrasonic Obstacle Avoidance Sensor Module (2-300cm Range)₹1,969
  • DYP-A22YYCW-V1.0 IIC Ultrasonic Obstacle Avoidance Sensor Object Range 2–300cm: another version this guide coversDYP-A22YYCW-V1.0 IIC Ultrasonic Obstacle Avoidance Sensor Object Range 2–300cm₹1,229
  • DYP A22YYGDW-V1.0 Switch Ultrasonic Obstacle Avoidance Sensor Module – 2–300cm Range: another version this guide coversDYP A22YYGDW-V1.0 Switch Ultrasonic Obstacle Avoidance Sensor Module – 2–300cm Range₹1,339
  • ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389
  • Uno R3 development board: the controller used in the wiring tableFind this part
  • MAX485 RS-485 to TTL module: to read RS485 versions from a microcontrollerMAX485 RS-485 to TTL Module₹28
  • USB to RS485 converter adapter: to test RS485 versions from a PCUSB to RS485 Converter Adapter₹74
  • HC-SR04 ultrasonic range finder: the classic low-cost ultrasonic sensorHC-SR04 Ultrasonic Range Finder Sensor Module for Arduino₹69Closest match, check the specs
07

Alternatives and when to choose them

  • ✓DYP A01 family: narrower beam, longer range.
  • ✓HC-SR04: indoor robots.
  • ✓Multi-zone ToF: optical alternative.
08

Common mistakes to avoid

  • !Firing several sensors at once, causing crosstalk.
  • !Mounting so the wide beam hits the floor.
  • !Using TTL wiring on long, noisy cable runs.
  • !Setting a stop distance shorter than the braking distance.
09

Frequently asked questions

Why use A21 or A22 instead of an HC-SR04?

They are waterproof, robust and see obstacles as close as 2 to 3 cm.

Can I use several sensors on one robot?

Yes, but trigger them in turn so they do not hear each other.

Which interface is best for a long robot?

RS485 or CAN handle long cables and noisy motors best.

Why does the sensor see the floor?

The wide beam can catch the ground; tilt it up slightly.

Can they work outdoors in rain?

Yes. They are sealed for outdoor use.

Parts for this guide

  • DYP-A21AYYUW-V1.0 UART Auto Ultrasonic Obstacle Avoidance Sensor (Object Range 3 ~ 500cm)
    ₹2,039View
  • DYP-A21AYYTW-V1.0 UART Ultrasonic Obstacle Avoidance Sensor (3-500cm Range)
    ₹2,099View
  • DYP-A21AYY4W-V1.0 RS485 Ultrasonic Obstacle Avoidance Sensor (Object Range 3-500cm)
    ₹2,619View
  • DYP-A21AYYGDW-V1.0 TTL Switch Ultrasonic Obstacle Avoidance Sensor Object Range 3–500 cm
    ₹2,829View
  • DYP-A21AYYCAW-V1.0 CAN Ultrasonic Obstacle Avoidance Sensor (Object Range 3~500cm)
    ₹2,897View
  • DYP-A21AYYMW-V1.0 PWM Ultrasonic Obstacle Avoidance Sensor (Object Range 3-500cm)
    ₹1,909View
  • DYP-A22YYUW-V1.0 UART Auto Ultrasonic Obstacle Avoidance Sensor (Object Range 2-300cm)
    ₹2,029View
  • DYP-A22YYTW-V1.0 UART Ultrasonic Obstacle Avoidance Sensor Module – 2-300cm Range
    ₹2,229View
  • DYP-A22YY4W-V1.0 RS485 Ultrasonic Obstacle Avoidance Sensor (Object Range 2-300cm)
    ₹2,099View
  • DYP-A22YYMW-V1.0 PWM Ultrasonic Obstacle Avoidance Sensor Module (2-300cm Range)
    ₹1,969View
  • DYP-A22YYCW-V1.0 IIC Ultrasonic Obstacle Avoidance Sensor Object Range 2–300cm
    ₹1,229View
  • DYP A22YYGDW-V1.0 Switch Ultrasonic Obstacle Avoidance Sensor Module – 2–300cm Range
    ₹1,339View
  • ESP32-WROOM-32 38-Pin Development Board
    ₹389View
  • Uno R3 Development Board (No Cable)
    ₹359View
  • MAX485 RS-485 to TTL Module
    ₹28View
  • USB to RS485 Converter Adapter
    ₹74View
  • HC-SR04 Ultrasonic Range Finder Sensor Module for Arduino
    ₹69View
Shop Ultrasonic Distance & Ranging Sensors

Keep learning

Component guideIntermediateDYP A01NYUB, A01 Series, ME007YS, A19, A21B, A12 Narrow BeamDYP A01 and related sensors are sealed IP67 ultrasonic rangefinders for tanks, parking, bins and outdoor robots.5 min read · SensorsComponent guideBeginnerHC-SR04 Ultrasonic SensorThe HC-SR04 measures distance from about 2 cm to 4 m by sending a 40 kHz ultrasonic pulse and timing the echo.3 min read · SensorsComponent guideIntermediateWaterproof Ultrasonic SensorsWaterproof ultrasonic sensors such as the JSN-SR04T and A02YYUW put the transducer in a sealed probe on a cable, so they can measure water level in a tank or work outdoors.3 min read · Sensors

Sources

  • DYP A21 and A22 datasheets

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerWhat the DYP A21 and A22 obstacle avoidance ultrasonic sensors isDYP A21 and A22 obstacle avoidance ultrasonic sensors pinoutWiring the DYP A21 and A22 obstacle avoidance ultrasonic sensorsExample codeSetup and tuningWhat you needAlternatives and when to choose themCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide8 items · ₹18,000

DYP-A21AYYUW-V1.0 UART Auto Ultrasonic Obstacle Avoidance Sensor (Object Range 3 ~ 500cm) · DYP-A21AYYTW-V1.0 UART Ultrasonic Obstacle Avoidance Sensor (3-500cm Range) · DYP-A21AYYGDW-V1.0 TTL Switch Ultrasonic Obstacle Avoidance Sensor Object Range 3–500 cm · DYP-A21AYYCAW-V1.0 CAN Ultrasonic Obstacle Avoidance Sensor (Object Range 3~500cm) · DYP-A21AYYMW-V1.0 PWM Ultrasonic Obstacle Avoidance Sensor (Object Range 3-500cm) · DYP-A22YYUW-V1.0 UART Auto Ultrasonic Obstacle Avoidance Sensor (Object Range 2-300cm) · DYP-A22YYTW-V1.0 UART Ultrasonic Obstacle Avoidance Sensor Module – 2-300cm Range · DYP-A22YYMW-V1.0 PWM Ultrasonic Obstacle Avoidance Sensor Module (2-300cm Range)

Run itChange the inputs and watch the output

Wide beam for obstacles. Distance is in millimetres.

Serial monitor115200 baud
820 mm

A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.

Ask the Community

Ask a question