This project uses an Arduino Uno and an HC-SR04 ultrasonic sensor to measure distance. The distance is calculated based on the time taken for sound waves to return to the sensor.
- Arduino Uno
- HC-SR04 Ultrasonic Sensor
- Jumper wires
- Breadboard (optional)
- Connect the VCC of the HC-SR04 to Arduino 5V
- Connect the GND of the HC-SR04 to Arduino GND
- Connect the TRIG pin to Arduino pin 9
- Connect the ECHO pin to Arduino pin 10
The code is written in Arduino IDE. It measures the distance and outputs the result on the Serial Monitor.