How to use Ultrasonic sensor (HC-SR04) using Arduino Uno to detect any nearby object
This sensor is used to identify the presence of near by object without making physical connection.
HC-SR04 is widely used for distance measurement and object identification. It has a typical working range from 2 cm to 400 cm (1 inch to 13 feet)
Distance =(0.034*travel time)/2
Distance between sensor and object can be calculated using given formula:
Ultrasonic sensor (HC-SR04)
Arduino Uno board
Few jumper wires
1.
2.
3.
Get the code in Github
Ultrasonic sensor has 4 oins: 1. VCC 2. GND 3. TRIG 4. ECHO