Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
The ultrasonic sensor is a device that uses high-frequency sound waves to detect objects or measure distances. It does this by emitting sound waves and measuring 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 and relative low-cost. It can measure distances ranging from 2 cm to 4 meters, making it useful for various applications like avoiding obstacles for robots, measuring distances, 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).