Arduino Distance Detector with a Buzzer and LED’s




This is a simple guide on how to make a distance detector using an Arduino, a HC-SRO4 Ultrasonic Sensor, a Buzzer, and some LED’s.  The ultimate goal of this tutorial is to use the buzzer and LED’s to display how far the object is from the ultrasonic sensor.

Step 1: Materials Needed

The Materials needed for this project are:(1x) Arduino Uno
(1x) Breadboard
(1x) HC-SRO4 Ultrasonic Sensor
(1x) Buzzer
(2x) Green LEDs
(2x) Yellow LEDs
(2x) Red LEDs
(7x) 330 ohm Resistors
A lot of jumper wiresArduino Distance Detector with a Buzzer and LED's




Step 2: Setup

The photo above shows the setup of the project.  The jumper wires should be connected as follows:Connect a jumper wire from the 5 volt pin on the Arduino to the bottom channel of the breadboard
Connect another jumper wire from a ground pin on the arduino to the upper channel of the breadboardBuzzer -> pin 3(On Ultrasonic Sensor)
Echo -> pin 6
Trig -> pin 7

(In Order from Right to Left)
LED1 -> pin 8
LED2 -> pin 9
LED3 -> pin 10
LED4 -> pin 11
LED5 -> pin 12
LED6 -> pin 13

The jumper wires connected to the LEDs should be connected to the lead on the right, while the left lead of the LED should connected to the ground channel via a 330 ohm resistor.

Step 3: Assembly: Breadboard

First things first, let’s connect the 5 volt and ground pin to the breadboard.  Again, the wire attached to the 5 volt pin should be connected to the bottom channel of the breadboard, while the wire attached to the ground pin should be connected to the upper channel of the breadboard.

Step 4: Assembly: Ultrasonic Sensor

Now it’s time to attach the HC-SRO4 ultrasonic sensor.  It is easiest to place the ultrasonic sensor as far right to the breadboard as possible.  Referring back to the setup picture, you should connect the ground pin on the ultrasonic sensor to the ground channel on the breadboard.  Next connect the Echo pin on the sensor to pin 6 on the Arduino.  Now connect the Trig pin on the sensor to pin 7 on the Arduino, and lastly connect the VCC pin on the sensor to the 5 volt channel on the breadboard.  If you did that all correctly, your assembly should look like the picture above.Arduino Distance Detector with a Buzzer and LED's SchematicStep 5: Assembly: LEDs

Next is connecting the LED’s to the breadboard and Arduino.  Once again referring back to the setup picture, attaching the LEDs is pretty basic, just with a lot of repetition.  The way to connect them is to connect the anode, or the longer leg, or the one on the right, to a pin on the Arduino with a jumper wire, and to connect the cathode, or the shorter leg, or the one on the left, to the ground channel on the breadboard using a 330 ohm resistor.  Then just repeat that step for all six of the LEDs, with the red LED all the way on the right being connected to pin 8 on the Arduino, the anode of the red LED to the left of that one being connected to pin 9 on the Arduino, and so on.  The last LED, that being the green LED all the way on the left, should have it’s anode, or right leg, connected to pin 13 on the Arduino.  Once you have done that, your setup should look something like this.

 

For more detail: Arduino Distance Detector with a Buzzer and LED’s




This Post / Project can also be found using search terms:

  • arduino distance detector with a buzzer and leds
  • Arduino Distance Detector with a Buzzer and LED\s
  • arduino distance detector with buzzer and led
  • programme arduino declanche une alarm
Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
Premoboard
Premoboard

PremoBoard can be controlled by any system via the USB port: it is an expansion board designed for (but not...

Close
Scroll to top