#Ultrasonic Sensor is used for the precise detection of objects. The ultrasonic transceivers, that are the #transmitters and #receivers, use the concept of converting electrical energy into ultrasonic sound.
The ultrasonic sensor emits sound waves at a frequency above human hearing and calculates the distance of any object or obstacle in its path. The distance is calculated by counting the time of flight, i.e., the time delay between transmitting the Ultrasonic signal and receiving it.
Apparatus Required
1. Ultrasonic sensor:
HC-SR04 model with an operating voltage of 5V,
measures distance between 2cm-40cm
accuracy of 3mm.
measuring angle = 15 degrees
operating frequency = 440Hz
Operating current < 15mA
4 pins: VCC, TRIG, ECHO, GND
2. Buzzer
A #buzzer is an audio signaling device, it can be mechanical, electromechanical, or piezoelectric.
A boundary is set within which the object can be detected when the object is within this boundary, the buzzer starts ringing, else it does not.
3. Arduino Uno R3
The #Arduino consists of digital and analog input/output pins that are interfaced with the ultrasonic sensor (used to send and receive data). the Arduino Uno IDE consists of a Serial Monitor that displays the output.
4. Jumper wires
They are used for making circuit connections.
5. Breadboard
Circuit connections are made upon this.
CIRCUITS:
The 4 pins of the Ultrasonic Sensor are:
Vcc
Trigger
Echo
Ground
1. Vcc connected to the 5V or Arduino.
2. The trigger is connected to pin 9 of the Arduino- which is the input pin and is kept high for 10 microseconds for the initialization of measurement by sending Ultrasonic waves.
3. The echo is connected to the pin 10 of the Arduino- Output pin which will be high for the time period which is equal to the time taken for the Ultrasonic wave to return to the sensor.
4. The ground is connected to the ground of the breadboard.
Buzzer:
1. The positive of the buzzer is connected to pin 11 of the Arduino
2. Ground connected to the ground of breadboard.
Ground: The ground of the breadboard is connected to the ground (GND) of Arduino, thereby making that line (that includes the ground of Ultrasonic Sensor and Buzzer as the common ground).
Circuit Diagram
CODE:
WORKING
How is the Object distance calculate?