HY-SRF05 ultrasonic sensor 5V, 2-450cm, Arduino compatible
zoom_out_map
chevron_left chevron_right

Product images are for informational purposes only and may vary slightly depending on the batch and supplier. Product specifications and prices may be subject to change without notice. We do our best to provide accurate and complete product specifications, but they may not be completely accurate. If you encounter any such situation, please let us know.

The product is intended for specialists and requires qualified and authorized personnel. The product does not include assembly/use instructions . Putting the product into operation by unqualified persons leads to the loss of the warranty according to the Terms and Conditions on the site.

The specified technical parameters (current, power, etc.) represent maximum allowable values under ideal operating conditions. For safe use and optimal lifespan, it is recommended to operate the product continuously at no more than 50% of the specified maximum values.

New

Ultrasonic Sensor HY-SRF05, 5 Pins, 2–450 cm, 5V

Ultrasonic module for contactless distance measurement in robots, automation, and Arduino projects, with a range of 2-450 cm and a detection angle of up to 15°. It operates at 5V, uses the TRIG ECHO protocol compatible with HC-SR04, and has 5 pins with OUT for selecting standard mode or single-pin mode. It provides TTL output and good accuracy under ideal conditions. 

12.64 RON Tax included

10.45 RON Tax excluded

No reviews yet
1-2 zile
check In Stoc

Shipping by Thursday 22 October

Buying this product earns you 0.63 RON in loyalty points.

Warranty: 24 months for individuals
INTERNATIONAL DELIVERY
International fast shipping within EU. Free Shipping for orders above 100 EUR in most EU countries.
FAST DISPATCH 24H
We ship from our stock within 24H
LOYALTY POINTS
You earn points with every order, worth 5%.

The HY-SRF05 ultrasonic sensor is a non-contact distance measurement module, functionally compatible with the popular HC-SR04. It uses the same TRIG/ECHO control protocol and also includes an OUT pin for selecting the operating mode. The first three pins (VCC, TRIG, ECHO) are arranged in the same order as on the HC-SR04, while GND is in the last position, after OUT, so when replacing an HC-SR04, the ground pin position must be checked. The module connects directly to Arduino boards (Uno, Nano, Mega, Leonardo) and can also be used with ESP32, STM32, Raspberry Pi Pico, or other platforms. On 3.3V logic boards, the 5V ECHO signal must be adapted through a voltage divider.

Measurement is based on the time of flight of ultrasonic waves. Upon receiving a trigger pulse, the module emits a burst of eight pulses at 40 kHz and waits for the echo reflected by the object. On the ECHO output, it generates a HIGH signal whose duration corresponds to the round-trip time of the wave. Distance is obtained by multiplying this duration by the speed of sound, approximately 340 m/s, and dividing the result by two.

The module’s main features are a measurement range between 2 cm and 450 cm, accuracy of up to 3 mm under ideal conditions, and a detection angle of up to 15 degrees. It is powered by 5 VDC, consumes less than 2 mA at rest, and provides TTL-compatible output. Measurement is not affected by ambient light or the color of the object. The sensor has two separate transducers, a transmitter and a receiver, mounted on a 45 x 21 mm PCB with four mounting holes.

The OUT pin allows selection between two operating modes. Left unconnected, the module operates in standard mode, with separate TRIG and ECHO pins, just like the HC-SR04. Connected to GND, it activates single-pin mode, in which both trigger and echo use the TRIG pin, useful in projects with few free pins. The implementation of single-pin mode may vary depending on the module’s production revision, so standard mode is recommended for general use.

The sensor is suitable for obstacle-avoiding robots, parking assistance systems, non-contact tank level measurement, presence detection, and educational projects. Results are better on hard, flat surfaces oriented perpendicular to the sensor. Soft materials (fabrics, foam) and angled surfaces can reduce the maximum detection distance. The speed of sound varies slightly with temperature, so small measurement deviations may occur at extreme temperatures.

 

Specifications:

Model: HY-SRF05

Supply voltage: 4.5 – 5.5 VDC (typically 5 VDC)

Idle current: < 2 mA

Operating current: 10 – 40 mA

Operating frequency: 40 kHz

Measurement range: 2 cm – 450 cm

Dead zone: 2 cm

Accuracy: up to 3 mm

Detection angle: max. 15°

Trigger signal: TTL pulse of at least 10 µs

ECHO output signal: TTL (HIGH = VCC, LOW = 0V)

Recommended interval between measurements: at least 60 ms

Operating modes: standard (separate TRIG and ECHO), single-pin

Number of pins: 5 (VCC, TRIG, ECHO, OUT, GND)

Operating temperature: -20 ~ 60°C

Mounting holes: 4 x 2 mm

Dimensions: 45 x 21 mm

 

Pinout:

Pin Name Description
1 VCC +5 VDC supply
2 TRIG Trigger input. HIGH pulse of at least 10 us to start the measurement. In single-pin mode, it is also the echo output.
3 ECHO Echo output. HIGH signal whose duration is proportional to the measured distance. Unused in single-pin mode
4 OUT Mode selection. Unconnected = standard mode. Connected to GND = single-pin mode.
5 GND Common ground (GND).

 

Usage:

Connect the VCC pin to 5V and the GND pin to the development board ground.

For standard mode, leave the OUT pin unconnected, connect TRIG to a digital pin configured as an output, and ECHO to a digital pin configured as an input.

On 3.3V logic boards (ESP32, STM32, Raspberry Pi Pico), connect ECHO through a voltage divider, for example a 1 kOhm resistor in series and a 2 kOhm resistor to GND.

Apply a HIGH pulse of at least 10 µs to the TRIG pin to start the measurement.

Measure the duration of the HIGH signal on the ECHO pin, for example with the pulseIn() function using a timeout of about 30 ms.

Calculate the distance using the formula Distance (cm) = HIGH duration (µs) x 0.034 / 2.

Keep at least 60 ms between two measurements so that residual echoes do not affect the next measurement.

For single-pin mode, connect the OUT pin to GND, use only the TRIG pin for sending the pulse and reading the echo, and leave the ECHO pin unconnected.

In single-pin mode, after sending the pulse, immediately switch the microcontroller pin to input to read the echo. Never connect the TRIG and ECHO pins directly together.

If the module does not respond in single-pin mode, disconnect OUT from GND and use standard mode.

Mount the sensor perpendicular to the target surface, with no obstacles in the detection cone, and avoid operating multiple ultrasonic sensors simultaneously facing the same direction.

88282
Input Voltage
5 V
Number of pins
5
Measuring distance
2 - 450 cm

Produs destinat utilizarii in proiecte electronice, automatizari, prototipare, educatie si cercetare.

Produsul trebuie utilizat numai conform specificatiilor tehnice mentionate in descriere si/sau in documentatia produsului.

Avertismente generale de siguranta:

Nu utilizati produsul la tensiuni, curenti sau temperaturi peste valorile specificate.

Montajul si conectarea trebuie realizate de persoane cu cunostinte tehnice minime in domeniul electric/electronic.

Evitati scurtcircuitele, inversarea polaritatii si conectarea gresita a alimentarii.

Nu lasati produsul alimentat nesupravegheat in timpul testelor.

Produsul nu este jucarie si nu este destinat copiilor.

Pentru modulele electronice, se recomanda utilizarea in carcase, panouri sau montaje protejate, dupa caz.

Identificare produs:

Denumirea produsului, codul/SKU-ul si caracteristicile tehnice sunt mentionate in pagina produsului si/sau pe eticheta ambalajului.

Producator / Importator / Distribuitor:

Sigmanortec S.R.L.

Calea Bucuresti nr. 9, Targu Jiu, Gorj, Romania

E-mail: [email protected]

Website: www.sigmanortec.ro

Persoana responsabila in UE:

Sigmanortec S.R.L.

Calea Bucuresti nr. 9, Targu Jiu, Gorj, Romania

E-mail: [email protected]

Documentatie si siguranta:

Pentru informatii suplimentare, fise tehnice, declaratii de conformitate sau instructiuni, ne puteti contacta la [email protected].

// HY-SRF05 - Standard mode (separate TRIG and ECHO)

// Wiring:

// VCC  -> 5V

// GND  -> GND

// TRIG -> pin 9

// ECHO -> pin 8

// OUT  -> not connected

const int trigPin = 9;

const int echoPin = 8;

const unsigned long TIMEOUT_US = 30000UL; // ~5 m round trip

void setup() {

  Serial.begin(9600);

  pinMode(trigPin, OUTPUT);

  pinMode(echoPin, INPUT);

  digitalWrite(trigPin, LOW);

}

void loop() {

  // Send a 10 us trigger pulse

  digitalWrite(trigPin, LOW);

  delayMicroseconds(2);

  digitalWrite(trigPin, HIGH);

  delayMicroseconds(10);

  digitalWrite(trigPin, LOW);

  // Measure the HIGH pulse width on ECHO

  unsigned long duration = pulseIn(echoPin, HIGH, TIMEOUT_US);

  if (duration == 0) {

    Serial.println("Out of range or no echo");

  } else {

    float distance = duration * 0.034 / 2.0;

    Serial.print("Distance: ");

    Serial.print(distance);

    Serial.println(" cm");

  }

  delay(100); // Keep at least 60 ms between measurements

}

The HY-SRF05 ultrasonic sensor measures the distance to an obstacle without physical contact, using an ultrasonic transmitter and receiver mounted on the same PCB. It is one of the most widely used modules for obstacle-avoiding robots, parking systems and educational distance-measuring projects, thanks to its simple wiring and its compatibility with the HC-SR04.

In this tutorial you will connect the module to an Arduino Uno in standard mode, with separate TRIG and ECHO pins, and write a simple program that reads the distance and displays it on the serial monitor.

Ultrasonic Sensor HY-SRF05, 5 Pins, 2–450 cm, 5V

How it works:

The module starts a measurement when it receives a HIGH pulse of at least 10 microseconds on the TRIG pin. When it receives this pulse, the HY-SRF05 automatically sends a burst of eight ultrasonic pulses at 40 kHz and waits for them to bounce off the obstacle and return to the receiver.

During this whole time, the ECHO pin stays HIGH, and the duration of the HIGH state is exactly the round-trip time of the sound wave. The code measures this duration in microseconds with the pulseIn function and calculates the distance with the formula Distance in centimeters equals duration multiplied by 0.034 and divided by two, where 0.034 is the speed of sound of about 340 m/s expressed in cm per microsecond.

You must leave at least 60 ms between two measurements, so that the echoes left over from the previous pulse are not mistaken for the next measurement.

What you need:

Wiring:

The module is powered at 5 VDC and uses 5V TTL logic levels, directly compatible with the Arduino Uno. Connect VCC to 5V and GND to the board's ground, then connect TRIG to a digital pin configured as output and ECHO to a digital pin configured as input. The OUT pin stays unconnected, so that the module works in standard mode, with separate TRIG and ECHO.

Product pin Arduino Uno pin Role
VCC 5V +5 VDC power supply
GND GND Common ground
TRIG D9 Trigger pulse to start the measurement
ECHO D10 Echo signal read by the Arduino

HY-SRF05 wiring to Arduino Uno

The code:

Upload the program below in the Arduino IDE, with the board set to Arduino Uno and the correct serial port selected.

// HY-SRF05 Ultrasonic Distance Sensor with Arduino Uno
// Standard mode: separate TRIG and ECHO pins, OUT pin left unconnected
const int trigPin = 9;   // TRIG pin connected to Arduino digital pin D9
const int echoPin = 10;  // ECHO pin connected to Arduino digital pin D10
void setup() {
  Serial.begin(9600);     // Start serial communication at 9600 baud
  pinMode(trigPin, OUTPUT); // TRIG pin sends the trigger pulse
  pinMode(echoPin, INPUT);  // ECHO pin reads the returning pulse
}
void loop() {
  // Make sure the trigger pin is low before starting
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  // Send a 10 microsecond HIGH pulse to start the measurement
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  // Measure how long the echo pin stays HIGH, in microseconds
  // timeout of 30000 us avoids blocking if no echo is received
  long duration = pulseIn(echoPin, HIGH, 30000);
  // Convert the duration into distance in centimeters
  // speed of sound is about 0.034 cm per microsecond
  // divide by 2 because the sound travels to the object and back
  float distance = duration * 0.034 / 2.0;
  if (duration == 0) {
    Serial.println("No echo received, check the wiring or the object distance");
  } else {
    Serial.print("Distance: ");
    Serial.print(distance);
    Serial.println(" cm");
  }
  // Wait before the next measurement, more than the 60 ms minimum
  delay(100);
}

How the code works:

At the beginning of the program, the constants trigPin and echoPin are defined, set to D9 and D10 respectively, exactly the pins used in the wiring diagram.

In the setup function, serial communication is initialized at 9600 baud with Serial.begin, and trigPin is configured as OUTPUT and echoPin as INPUT using the pinMode function.

In the loop function, the program first sets trigPin to LOW for two microseconds, then raises it to HIGH for 10 microseconds using digitalWrite and delayMicroseconds, which is exactly the trigger pulse required by the module.

The duration of the HIGH signal on echoPin is read with the pulseIn function and stored in the variable duration, after which the distance is calculated with the formula distance equals duration times 0.034 divided by two and is displayed on the serial monitor with Serial.print.

At the end of each loop, a 100 ms delay ensures an interval longer than the recommended minimum of 60 ms between two consecutive measurements.

Result:

Open the serial monitor in the Arduino IDE at 9600 baud. You should see the distance displayed in centimeters every 100 ms, with the value changing as you move an object closer to or farther from the sensor.

Distance: 23.45 cm
Distance: 23.41 cm
Distance: 22.98 cm
Distance: 45.12 cm
Distance: 44.87 cm
No echo received, check the wiring or the object distance
Distance: 102.33 cm
Distance: 101.90 cm

Common problems:

If nothing appears on the serial monitor, check that you have selected the correct COM port and the Arduino Uno board in the Arduino IDE, and that the serial monitor speed is set to 9600 baud, the same value used in Serial.begin.

If the displayed distance is always 0 or a very large number, check that echoPin is correctly configured as INPUT and that the ECHO wire is firmly connected to pin D10, with no interrupted contact.

If the values are unstable or jump suddenly between very different numbers, move away any other ultrasonic sensors pointing in the same direction and make sure the obstacle is a hard, flat surface placed perpendicular to the sensor.

If the module does not respond at all, check the power polarity. The VCC pin must be connected to 5V and not to 3.3V, otherwise the sensor will not start the measurement.

If you use a board with 3.3V logic instead of the Arduino Uno, keep in mind that the 5V ECHO signal must go through a voltage divider before reaching the board's input pin, otherwise you risk damaging the input.

Limitations and tips:

The HY-SRF05 measures reliably between 2 cm and 450 cm, with a detection angle of at most 15 degrees, which means that thin objects or objects placed to the side of the sensor axis may not be detected correctly. Soft materials, such as fabrics or sponge, absorb part of the ultrasonic wave and can reduce the maximum detection distance.

For projects with fewer free pins on the microcontroller, you can use the module's single-pin mode by connecting OUT to GND and using only the TRIG pin to send the pulse and read the echo, but the standard two-pin mode remains the safest for the first tests.

Once the setup works reliably, you can expand it with several HY-SRF05 modules pointing in different directions for a robot that avoids obstacles on multiple sides, or you can integrate it into a tank level measuring system.

You might also like