Arduino HC-SR04 Project

Obstacle detection system with Arduino

Purpose of this project:

In this project an obstacle detection system will be built with Arduino. This system mainly uses an ultrasound sensor, buzzer and LED.

When the ultrasonic sensor detects an obstacle at a distance < 3cm, the Arduino orders the buzzer to ring and the red LED to light up.

Necessary components

  • Arduino UNO
  • ultrasonic sensor (HC-SR04)
  • buzzer
  • 1 resistance 220Ω
  • 1 red LED
  • connecting wires


To make the assembly, we can connect :

For LED and buzzer:

  • the terminals (+) of the red LED and buzzer to the digital pin 1 of  Arduino.
  • the (-) terminals of the red LED and buzzer at the GND pin of  Arduino.

For HC-SR04 sensor:

  • TRIG pin to pin 2 of Arduino
  • Echo pin tp pin 3 of Arduino.
  • VCC pin to 3.3V of Arduino
  • GND pin to GND of Arduino

or the LCD display:

  • the SDA pin at the Arduino analog pin A4.

  • the SCL pin at the Arduino analog pin A5.

  • the VCC pin at the Arduino 5v pin.

  • the GND pin at the Arduino GND pin


The Obstacle Detection System program is as follows:



0 commentaire

Leave a comment

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Scroll to Top