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.

<p>Piece of cake to make, thanks!</p>
<p>Really cool! I love arduino things like this! </p>

About This Instructable




Bio: I work for an IT company in Boise, ID where I do computer/server/networking/IT things. I got an Arduino to work on solidifying ... More »
More by Jedimaster0:Distance Detector with Buzzer and LED meter. 
Add instructable to: