Description
HY-SRF05 Ultrasonic Distance Sensor Module
Ultrasonic module that estimates distance from the time taken for an emitted sound pulse to return from an object.
Specifications stated in the listing
- Operating voltage: 5V DC
- Operating current: 10–40mA
- Ultrasonic frequency: 40kHz
- Detection angle: 15°
- Listed measuring range: 2–450cm
- Listed accuracy: ±3mm
- Dimensions: 45 × 20 × 15mm
- Use: distance sensing in robotics and automation
These figures and mode descriptions are seller claims and may depend on the module version, target surface and environment. Verify the pinout for the supplied board. The module uses 5V; protect 3.3V-only GPIO inputs (including Raspberry Pi) from 5V echo signals with an appropriate level shifter or divider.
Source Arduino examples
#define TRIG_PIN 2
#define ECHO_PIN 3
long duration;
int distance;
void setup() {
pinMode(TRIG_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
duration = pulseIn(ECHO_PIN, HIGH);
distance = duration / 29 / 2;
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(1000);
}
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define TRIG_PIN 2
#define ECHO_PIN 3
long duration;
int distance;
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
pinMode(TRIG_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
lcd.begin();
lcd.backlight();
Serial.begin(9600);
}
void loop() {
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
duration = pulseIn(ECHO_PIN, HIGH);
distance = duration / 29 / 2;
lcd.setCursor(0, 0);
lcd.print("Distance: ");
lcd.print(distance);
lcd.print(" cm");
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(1000);
}
The source examples are reproduced without changes. Confirm that the wiring, pin assignments and trigger/echo mode match your module before use.









