In this illustration we will going to wire the Ultrasonic HC-SR04 with our Arduino board, to build a parking sensor which emits a beep as the sensor approaches or detect an obstacle. The closer the obstacle, the greater the frequency of the beep.

Required Components

1x Ultrasonic Ranging Sensor Module HC-SR04
1x buzzer
1x Solder Less Bread Board
1x Jumper Wire
1x Resistor 330 Ohms

Wiring Diagram


This diagram composed of Arduino and HC-SR04 Ultrasonic Ranging Sensor and a Buzzer with resistance of 330 Ohms to limit the current.

The TONE, Normally used to produce sounds with Arduino, shows conflict with the library Ultrasonic also used in this project. The sound of the beep can be change as required by changing the value variable frequency and time. The pin Trigger sensor will connected to pin 13 of the Arduino and the pin Echo sensor will connected to Arduino pin 10. The sensor running at 5v. the buzzer goes on port 2 of the MCU Arduino. The variable cmMsec stores the value of the distance between the sensor and the obstacle. A series of command IF check the value cmMsec and update the variable delay which is used later in the program to determine the beeper drive frequency. The values read by the sensor can also be monitored by the serial.

Arduino Sketch

Download Code library for Tone Generator | Zip


Wiring HC-SR04 Ultrasonic on Reverse Parking Sensor
Tagged on:     

4 thoughts on “Wiring HC-SR04 Ultrasonic on Reverse Parking Sensor

  • at

    I just could not leave your website prior to suggesting that I actually
    loved the standard info an individual provide
    in your guests? Is gonna be back steadily to check up on new posts

  • at

    Having read this I thought it was very informative.
    I appreciate you spending some time and effort to put this content together.
    I once again find myself personally spending a lot of time both reading and commenting.
    But so what, it was still worth it!

  • at

    I always spent my half an hour to read this webpage’s posts everyday along with a mug of coffee.

  • at

    Good day! This is my first visit to your blog!
    We are a team of volunteers and starting a new project in a community in the same niche.
    Your blog provided us useful information to work on. You have
    done a marvellous job!


Leave a Reply

Your email address will not be published. Required fields are marked *