Control Lab 464-5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

Control Lab ME 464

Experiment #5
Ultrasonic Sensor
• Ultrasonic is made up of two words “Ultra” meaning “Beyond” and “Sonic” meaning
“Sound”

• Sound waves in which the frequencies are above the limits of human audibility i.e. > 20 KHZ
are called Ultrasonic.
An ultrasonic sensor is an electronic device that measures the distance of a target object by
emitting ultrasonic sound waves “ pulse”, and converts the reflected sound into an electrical
signal “echo”

They have two main components: the transmitter (which emits the sound using piezoelectric
crystals) and the receiver (which encounters the sound after it has travelled to and from the
object “target”).

3
Ultrasonic sensors are often called as Sonar sensors and we can use them for many
applications like:

•Distance measuring (Robotics applications, Parking applications, Collision detection)

•Depth and level monitoring (Liquid level monitoring)

•Object presence detection (Home automation, Automated parking, Security Applications).


Working Principle of Ultrasonic Sensor
Ultrasonic sensors emit short, high-frequency sound pulses at regular intervals. These propagate in the air at the
velocity of sound. If they strike an object, then they reflected back as an echo signals to the sensor, which itself
computes the distance to the target based on the time-span between emitting the signal and receiving the echo.

Since we can measure the time gap between the trigger signal and echo signal we can measure the distance to the
obstacle. (for normal calculations we take the speed of sound in Air as 340 m/s.
7
1.We need to transmit trigger pulse of at least 10 us to the HC-SR04 Trig Pin.
2.Then the HC-SR04 automatically sends Eight 40 kHz sound wave and wait for rising edge output at Echo pin.
3.When the rising edge capture occurs at Echo pin, start the Timer and wait for falling edge on Echo pin.
4.As soon as the falling edge is captured at the Echo pin, read the count of the Timer. This time count is the time required by
the sensor to detect an object and return back from an object.
8
9
Features of an Ultrasonic Sensor

1. Supply voltage: 5V (DC).


2. Supply current: 15mA.
3. Modulation frequency: 40Hz.
4. Output: 0 – 5V (Output high when obstacle
detected in range).
5. Beam Angle: Max 15 degrees.
6. Distance: 2 cm – 400 cm.
In order to calculate the distance between the sensor and the object, the sensor
measures the time it takes between the emission of the sound by the transmitter to
its contact with the receiver.

The formula for this calculation is D = ½ T x C (where D is the distance, T is the


time, and C is the speed of sound ~ 340 meters/second). For example, if a scientist
set up an ultrasonic sensor aimed at a box and it took 0.025 seconds for the sound
to bounce back, the distance between the ultrasonic sensor and the box would be:

13
Interfacing Ultrasonic with Arduino

15
Programming

16
pulseIn() pulseIn(pin, value)

Reads a pulse (either HIGH or LOW) on a pin. For example, if value is HIGH, pulseIn() waits for the
pin to go from LOW to HIGH, starts timing, then waits for the pin to go LOW and stops timing.
Returns the length of the pulse in microseconds or gives up and returns 0 if no complete
pulse was received within the timeout.

17

You might also like