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. An ultrasonic sensor uses a transducer to send and receive ultrasonic pulses that relay back information about an object's proximity. Connect the GND on the ultrasonic sensor to GND on the Arduino. 1 year ago, How to increase distance between object . The code is quite similar to the one we used while interfacing single ultrasonic sensor with arduino, the only thing we changed here is the repetition. is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to,,,,,, and on Step 3, hi can you email me with the code because the code in the video description in not working if you can send me the code at, Question Connect the Trigger pin to pin 12 and Echo pin to pin 13 of Arduino. If you are a beginner to the Arduino, we recommend following our Arduino Mini Course that will help you getting started quickly with this amazing board. Now load the code in Arduino … hi guys, so this project is gonna be about how i make my ultrasonic sensor with buzzer using the arduino. Ultrasonic Sensor; Buzzer; Arduino Mega (any model) Jumper Wires; USB cable for Arduino or 12v, 1A adapter. 90% of Sketch is same as previous tutorial for measuring distance using ultrasonic sensor. larryd. * This example code is in the public domain, * Tutorial page:, // Arduino pin connected to Ultrasonic Sensor's TRIG pin, // Arduino pin connected to Ultrasonic Sensor's ECHO pin, // Arduino pin connected to Piezo Buzzer's pin, // generate 10-microsecond pulse to TRIG pin, // measure duration of pulse from ECHO pin. The sensor module consists of ultrasonic transmitter, receiver and the control circuit. * The echo terminals receives the ultrasound pulses and the sensor calculates the distance based on the time of the pulses. HC-SR04 ultrasonic sensor ; Piezo buzzer; LED ; 10k ohm resistor; Breadboard and connecting wires ; Connections . Ultrasonic Sensor Module: Ultrasonic sensor HC-SR04 is used here to detect the presences of any person at the door. You can upload the following example code to your Arduino using the Arduino IDE. The most used sensor is the HC-SR04 ultrasonic distance sensor. How would I code/connect more LED pins to this setup? Piezo buzzer. - In the setup you have to define the trigPin as an output and the echoPin as an Input and also start the serial communication for showing the results on the serial monitor. 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. Piezo Buzzer, Breadboard; Jumper Wire; Do connection as shown in diagram. - The HC-SR04 Ultrasonic Module has 4 pins, Ground, VCC, Trig and Echo. I have an Ultrasonic Distance Sensor with Passive Buzzer. Which is really good information to have if you’re trying to avoid your robot driving into a wall! Ultrasonic HC-SR04 library for Arduino. I will suggest you play with the code, try changing the time delay, add some melody instead of beeps or try to add an LED instead of a buzzer. I thought I have it so depending on the distance the HC-SR04 ultrasonic sensor detects, the Buzzer should change tone. However, the Arduino couldn't compile the code. Connect the Echo pin on the ultrasonic sensor to pin 3 on the Arduino. Ultrasonic Sensor (HC-SR04) The HC-SR04 ultrasonic module has 4 pins: Ground, VCC, trig and echo. Re: Need Help with Piezo Buzzer and Ultrasonic Sensor code #19 Mar 31, 2014, 04:05 am Last Edit : Mar 31, 2014, 04:24 am by KalELonRedkryptonite Reason : 1 Your help is MUCH APPRECIATED. You also learned about standalone functions in this lesson, and used and the serial monitor to track changes inside your Arduino. If you think the video tutorials are essential, please subscribe to our YouTube channel to give us motivation for making the videos. The purpose of this project is to make the buzzer sound every time the US sensor detects an obstacle. The ultrasonic distance sensor is used to measure the distance between the sensor and an object. Connect the Buzzer positive terminal to the Arduino pin 2 and the negative terminal to the Gnd.