HC-04 Ultrasonic Sensor Module
The HC-SR04 ultrasonic sensor uses sonar to determine distance to an object – just like bats or dolphins do. This module offers excellent range accuracy and stable readings in an easy-to-use package. It operation is not affected by sunlight or black material (although acoustically soft materials like cloth can be difficult to detect). It is similar in performance to the SRF05 but with the low-price of a Sharp infrared sensor. Perfect for collision avoidance on your next robotics or multi-rotor project with Arduino Boards!
Features:
- High Accuracy: Utilizes ultrasonic waves to measure distances with high precision.
- Compact Design: Small form factor suitable for integration into various projects.
- Low Power Consumption: Designed to operate efficiently with minimal energy usage.
- Easy Integration: Compatible with microcontrollers like Arduino for straightforward implementation.
Specification | Value |
---|
Working Voltage | 5V DC (Wide voltage range: 4.5V – 5.5V) |
Measurement Range | 2cm – 4m |
I/O Pins Needed | 4 |
Operating Current | 15mA (typical) |
Dimensions | 45mm x 20mm x 15mm |
Compatibility | Arduino, Raspberry Pi, and other microcontrollers |
Ease of Pairing | Easy integration with microcontrollers |
Pin Out:
Pin Number | Pin Name | Description |
---|
1 | Vcc | Powers the sensor, typically 5V DC |
2 | Trigger | Input pin. Send a high pulse (typically 10µs) to trigger the ultrasonic wave emission,(RX_SCL_I/O) |
3 | Echo | Output pin. Sends a high pulse indicating the duration of the received echo signal, allowing distance calculation.(TX_SDA) |
4 | Ground | Connect to the ground of the system |
Interfaces for HC-04 RCWL-9610 5V Ultrasonic Sensor:
Interface | M1 | M2 | |
---|
GPIO (General Purpose I/O) | NC | NC | |
I2C (Inter-Integrated Circuit) | NC | R8 | |
UART (Universal Asynchronous Receiver-Transmitter) | R7 | NC | |
1-WIRE | R7 | R8 | |
Interface | Usage | Connection | Description |
---|
GPIO (General Purpose I/O) | Digital signal output indicating motion detection. | GPIO Pin: Directly connect to microcontroller’s GPIO pin for detecting motion. | Provides a simple and direct digital output that indicates whether motion is detected. |
I2C (Inter-Integrated Circuit) | Communication with multiple devices over two wires (SDA and SCL). | Connect SDA and SCL lines to the corresponding pins on the microcontroller, with pull-up resistors (typically 4.7kΩ). | Enables communication with multiple I2C devices using just two lines for data transmission. |
UART (Universal Asynchronous Receiver-Transmitter) | Serial communication to send and receive data over UART. | Connect TX to RX and RX to TX on the microcontroller, use appropriate voltage shifting if required. | Used for serial data communication to and from the sensor. |
1-WIRE | Single-wire interface for multiple devices communication. | Connect data line to microcontroller’s input pin, with a pull-up resistor (typically 4.7kΩ) to the supply voltage. | Allows multiple sensors to communicate over a single wire. |
Wiring and Resistor Configuration for HC-04 RCWL-9610 5V:
When setting up the sensor, the choice of resistors will determine how the interfaces are configured. Here’s a general idea of how to wire it:
Interface | Resistor Configuration | Description |
---|
GPIO (General Purpose I/O) | Echo Pin: Connect with a 1kΩ resistor (if interfacing with a 3.3V system). | Ensures voltage safety for microcontroller when interfacing with 3.3V logic. |
I2C (Inter-Integrated Circuit) | SDA and SCL lines: Use 4.7kΩ pull-up resistors on both the SDA and SCL lines. | Ensures proper signal integrity and communication between devices. |
UART (Universal Asynchronous Receiver-Transmitter) | TX to RX, RX to TX: Use voltage divider (1kΩ and 2kΩ) for safe voltage level shifting. | Ensures UART communication works at the correct voltage levels for both sender and receiver. |
1-WIRE | Data line: Place 4.7kΩ pull-up resistor between the data line and supply voltage. | Provides proper data line voltage for reliable communication. |
Functionality:
- Distance Measurement: The HC-SR04 can measure distances from 2cm to 400cm, using ultrasonic waves to calculate distance based on the time it takes for the sound to return after bouncing off an object.
- Motion Detection: The RCWL-9610 uses microwave radar to detect motion within a specific range, making it suitable for security applications.
Applications:
- Robotics: Obstacle detection and avoidance in robotic systems.
- Automation: Distance measurement for automated processes.
- Security Systems: Intrusion detection by monitoring distance changes.
- Parking Assistance: Measuring parking space occupancy.
Additional Notes:
- The HC-04 module emits ultrasonic waves and measures the time taken for the echo to return, calculating distance based on the speed of sound. Ensure proper alignment and avoid obstacles in the sensor’s path for accurate measurements.
Bassam Ahmed (verified owner) –
تعمل بكفاءه , شكراً لك