ESP32 KY-050 Ultrasonic Distance Sensor Module

KY-050 Ultrasonic Distance Sensor Module image

KY-050

Protocol: Digital

Overview

The KY-050 is an ultrasonic distance sensor module capable of measuring distances ranging from 2 cm to 300 cm with a resolution of approximately 3 mm. It emits a 40 kHz ultrasonic pulse and measures the time taken for the echo to return, allowing for precise distance calculations.

About KY-050 Ultrasonic Distance Sensor Module

The KY-050 Ultrasonic Distance Sensor Module is designed for non-contact distance measurements. It operates by emitting an ultrasonic pulse and measuring the time it takes for the echo to return after reflecting off an object. This module is ideal for applications such as obstacle detection, distance measurement, and level sensing in various projects.

Technical Specifications

Operating Voltage 5V
Measuring Range 2 cm to 300 cm
Resolution 3 mm
Ultrasonic Frequency 40 kHz
Minimum Time Between Measurements 50 µs
Dimensions 45 mm x 20 mm x 15 mm

Pinout Configuration

The VCC pin is used to supply power to the sensor, and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements). The GND pin is the ground connection and must be connected to the ground of your ESP32.

  • VCC: Connects to the power supply, typically 5V.
  • Trig: Trigger input; connect to a digital output pin on the microcontroller.
  • Echo: Echo output; connect to a digital input pin on the microcontroller.
  • GND: Connects to the ground of the circuit.

Wiring with ESP32

  • VCC: Connect to ESP32 5V.
  • GND: Connect to ESP32 GND.
  • Trig: Connect to ESP32 digital output pin (e.g., GPIO5).
  • Echo: Connect to ESP32 digital input pin (e.g., GPIO18).

Troubleshooting Guide

Common Issues

❌ No Distance Reading

⚠️ Incorrect Distance Measurements

Debugging Tips

🔍 Serial Monitor

⚡ Voltage Checks

Code Examples

Arduino Example

C++
🔧

ESP-IDF Example

C++
🏠

ESPHome Example

YAML
🛠️

PlatformIO Example

C++
🐍

MicroPython Example

Python

Conclusion

The ESP32 KY-050 Ultrasonic Distance Sensor Module is a powerful KY-0xx module sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.

For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.

Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.