Distance Detector With Buzzer and LED Meter.

Introduction: Distance Detector With Buzzer and LED Meter.


This is a simple distance detection circuit with the use of an ultrasonic sensor, a buzzer, a row of LEDs, and 2 relays (optional).

The ultrasonic distance sensor will light a row of LEDs depending on distance. Then if a change in distance is detected, that exceeds your threshold, a buzzer will sound and the optional relays can toggle a device (a light).

All options are configurable such as the threshold, number of LEDs, maximum perceived distance, etc...

You can download the Fritzing application to assist in the build/codeing process here: http://fritzing.org/download/


  • Garage parking sensor
  • Electronic measuring device
  • Security alarm
  • Motion detection
  • Add complexity to your everyday shenanigans.

This is my first project on the Arduino and using C++ so please be gentle ;)

*** Now with Mario sounds!!! ***

Step 1: Build It

Build the circuit using the listed parts:

  • 1 Ultrasonic sensor (I use the 4 prong model)
  • 1 Buzzer
  • 2 Relays (optional)
  • 8 LEDs (4 red, 2 yellow, 2 green)
  • 8 220 ohm resistors
  • A plethora of jumpers

Step 2: Code It

Using the supplied code, write your program. I have included comments in the code to explain what each section is doing. You can then modify the code to fit your needs.

Step 3: Resources

Be the First to Share


    • Unusual Uses Contest

      Unusual Uses Contest
    • Cookie Speed Challenge

      Cookie Speed Challenge
    • Reclaimed Materials Contest

      Reclaimed Materials Contest



    Question 1 year ago

    If you see this, I have a question, while the wiring and directions were easy to follow, after inputing the code and uploading all I got was a tune from the buzzer, no distance detection, is there anything I need to do to start this project other than uploading it?


    5 years ago

    Piece of cake to make, thanks!


    5 years ago

    Really cool! I love arduino things like this!