Member-only story
This article helps beginners understand how ultrasonic sensor work and how to use it with Arduino. The animated image makes it easy to understand.
About Ultrasonic Sensor
Ultrasonic sensor HC-SR04 is used to measure the distance to an object by using ultrasonic waves.
Pinout
The ultrasonic sensor HC-SR04 includes four pins:
- VCC pin: needs to be connected to VCC (5V)
- GND pin: needs to be connected to GND (0V)
- TRIG pin: this pin receives the control signal (pulse) from Arduino.
- ECHO pin: this pin sends a signal (pulse) to Arduino. Arduino measures the duration of pulse to calculate distance
How It Works
- Micro-controller generates a 10-microsecond pulse on the TRIG pin.
- The ultrasonic sensor automatically emits the ultrasonic waves.
- The ultrasonic wave is reflected after hitting an obstacle.
- The ultrasonic sensor detects the reflected ultrasonic wave and measures the…