Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
An ultrasonic sensor is a device that uses high-frequency sound waves (ultrasound) to detect objects, measure distances, or detect changes in the environment. It emits sound waves and measures the time it takes to bounce off an object and return to the sensor.
The HC-SR04 is a popular ultrasonic sensor due to its simplicity, low cost, and ease of integration with microcontrollers like Arduino and Raspberry Pi. It can measure distances ranging from 2 cm to 4 meters, making it useful for various applications, including obstacle avoidance in robots, distance measurement, and level sensing.
The HC-SR04 ultrasonic sensor relies on two key components: a transmitter that emits ultrasonic sound pulses and a receiver that detects the reflected waves, allowing for distance measurement.
This component emits high-frequency sound waves (ultrasonic pulses) into the environment.
This component receives sound waves (echoes) once they bounce back from an object.
When the Trigger Pin receives a high pulse (typically 10 microseconds), it activates the ultrasonic transmitter to emit a sound wave.
The ultrasonic transmitter sends out a sound wave at a frequency of 40 kHz, which travels through the air. Meanwhile, the echo pin goes HIGH and starts waiting for the wave to be reflected from an object.
If there is no object or reflected pulse, the Echo pin will time out after 38ms and return to the LOW state.
When the sound wave hits an object, it reflects towards the sensor. The echo pin goes LOW as soon as the signal is received. The sensor measures the time it takes for the sound wave to travel to the object and back.
By measuring the time delay between the emission and reception of the sound waves, the sensor can calculate the distance to the object using the formula:
$$Distance=\frac{Time\times Speed\;of\;Sound}2$$
The speed of sound in air is approximately 343 meters per second (at 20°C).