SainSmart HC-SR04

SainSmart HC-SR04 Ultrasonic Distance Sensor User Manual

Model: HC-SR04 | Brand: SainSmart

1. Introdución

The SainSmart HC-SR04 Ultrasonic Distance Sensor module is designed for precise non-contact distance measurement. It utilizes ultrasonic waves to determine the distance to an object, making it suitable for various applications such as robotics, obstacle avoidance, and level sensing. This module offers a measurement range from 2 cm to 400 cm with high accuracy.

SainSmart HC-SR04 Ultrasonic Distance Sensor front view

Figura 1: Fronte view of the HC-SR04 Ultrasonic Distance Sensor, showing the two ultrasonic transducers and the module's pins.

2. Características do produto

3. Especificacións

Dimensións do produto1.3 x 0.4 x 0.05 polgadas
Peso do elemento0.8 onzas
Número de modeloHC-SR04
Fonte de alimentación5V DC
Corrente Quiescente<2 mA
Ángulo efectivo<15 graos
Distancia de alcance2 cm - 400 cm
Resolución0.3 cm

4. Pinout e conexións

The HC-SR04 module features four pins for connection to a microcontroller or other circuit:

SainSmart HC-SR04 Ultrasonic Distance Sensor back view with pins

Figura 2: Atrás view of the HC-SR04 module, showing the electronic components and the four connection pins.

Ensure correct polarity when connecting VCC and GND to avoid damage to the module.

5. Configuración

To set up the HC-SR04 sensor for operation, follow these steps:

  1. Conexión de alimentación: Conecta o VCC pin to a 5V DC power source and the GND pin to the ground of your microcontroller or power supply.
  2. Trigger Pin Connection: Conecta o Disparador pin to a digital output pin on your microcontroller (e.g., Arduino, Raspberry Pi).
  3. Echo Pin Connection: Conecta o Eco pin to a digital input pin on your microcontroller.
  4. Montaxe: Securely mount the sensor in the desired location, ensuring a clear line of sight to the target object. Avoid mounting in areas with excessive vibrations or acoustic interference.

Nota: For microcontrollers operating at 3.3V (like some Raspberry Pi models), a voltage divider or level shifter may be required for the Echo pin to prevent damage, as the Echo pin outputs 5V.

6. Funcionamento

The HC-SR04 operates by emitting an ultrasonic sound wave and measuring the time it takes for the echo to return. The process is as follows:

  1. Activación: To initiate a measurement, the microcontroller sends a short high-level pulse (at least 10 microseconds) to the Disparador alfinete.
  2. Ultrasonic Burst: Upon receiving the trigger pulse, the HC-SR04 module automatically emits eight 40 kHz ultrasonic sound waves.
  3. Echo Reception: The module then waits for the echo of these sound waves. When an echo is detected, the Eco pin goes high.
  4. Duration Measurement: The microcontroller measures the duration for which the Eco pin remains high. This duration represents the time taken for the ultrasonic wave to travel from the sensor to the object and back.
  5. Cálculo de distancia: The distance to the object can be calculated using the following formula:

    Distance (cm) = (Duration of high level on Echo pin (microseconds) * Speed of Sound (cm/µs)) / 2

    The speed of sound in air is approximately 340 meters per second (0.034 cm per microsecond). Therefore, the formula simplifies to:

    Distance (cm) = Duration (µs) / 58

    (Alternatively, Distance (inches) = Duration (µs) / 148)

It is recommended to introduce a small delay (e.g., 60ms) between consecutive measurements to allow the ultrasonic waves to dissipate and prevent interference with subsequent readings.

7. Mantemento

The HC-SR04 module is a low-maintenance device. To ensure optimal performance and longevity:

8 Solución de problemas

If you encounter issues with your HC-SR04 sensor, consider the following common problems and solutions:

9. Garantía e soporte

SainSmart products are designed for reliability and performance. For specific warranty information, please refer to the documentation provided with your purchase or visit the official SainSmart website. For technical support, troubleshooting assistance, or inquiries about product functionality, please contact SainSmart customer service through their official channels.

Recursos en liña: Many online communities and forums dedicated to Arduino, Raspberry Pi, and electronics projects offer extensive resources and examples for using the HC-SR04 sensor. Searching for "HC-SR04 Arduino tutorial" or "HC-SR04 Raspberry Pi Python" can provide valuable code examples and project ideas.

Documentos relacionados - HC-SR04

Preview Manual do usuario da placa controladora SainSmart Genmitsu (GRBL)
Manual de usuario completo para a placa controladora SainSmart Genmitsu (GRBL) con carcasa de ABS e ventilador incorporado, compatible con fresadoras CNC como 3018, 3018-PRO e 1810-PRO. Abarca a configuración, as conexións, a configuración de Vref, as actualizacións de firmware e os accesorios.
Preview Manual do usuario do kit de módulo láser SainSmart de 5.5 W para Genmitsu CNC 3018-PROVer/MX3
Manual de usuario para o kit de módulo láser SainSmart de 5.5 W, compatible coas máquinas Genmitsu CNC 3018-PROVer e 3018-MX3. Inclúe instrucións de instalación, conexión e enfoque tanto para o software LaserGRBL como para o Mach3.
Preview Guía de inicio rápido do kit rotatorio de 4.º eixe de SainSmart
Guía de inicio rápido para o kit rotatorio de 4.º eixe SainSmart, que proporciona recursos, documentación e instrucións de configuración para o CNC 4040 Pro. Inclúe ligazóns a manuais de usuario, guías de instalación e recursos de mecanizado.
Preview Manual de usuario de la impresora 3D SainSmart Ender-3
Manual de usuario da impresora 3D SainSmart Ender-3, que contén instrucións de montaxe, guías de configuración, instalación do software, resolución de problemas e información de soporte.
Preview Kit de control inalámbrico SainSmart para fresadora CNCview e Guía de usuario
Unha reestruturación exhaustivaview e guía do usuario para o kit de control sen fíos SainSmart para fresadoras CNC, que detalla a instalación, as características da aplicación, as variantes do módulo e o rendemento das máquinas CNC Genmitsu.
Preview Manual do usuario da desbrozadora de madeira sen fíos SainSmart V1.0
Manual de usuario da desbrozadora de madeira sen fíos SainSmart, que detalla os avisos de seguridade, o funcionamento, a montaxe, as especificacións e o mantemento. Inclúe información sobre a xestión da batería e os accesorios.