Introduction to robotics

Introduction to Electronics

Introduction to Microcontroller (Arduino)

TinkerCad Circuit Design

Project 1: Distance Measurement Using Ultrasonic Sensor

Project 2: Intruder Alarm Project

Project 3: Car Parking System

Introduction to Ultrasonic Sensor


An Ultrasonic sensor is an Electronic device that measures distance by using ultrasonic sound waves. The ultrasonic sensor module has a transmitter or receiver to which the ultrasonic sound waves are transmitted or received for measuring the distance.

Ultrasonic waves travel faster than the speed of audible sound (i.e. the sound that humans can hear). Ultrasonic sensors have two main components: the transmitter (which emits the sound using piezoelectric crystals) and the receiver (which encounters the sound after it has traveled to and from the target).

PIN Configuration:


Pin Number Pin Name Description
1. Vcc This Vcc pin powers the sensor, with +5V
2. Trigger The trigger pin is an input pin. It must be kept high for 10us to initialize measurement by sending the Ultrasonic wave.
3. Echo This pin is an output pin. The echo pin goes high for a period of time which will be equal to the time taken for the Ultrasonic wave to return back to the sensor.
4. Ground The ground pin is connected to the Ground with -V.


Working Principle of Ultrasonic Sensor: 


The working principle of the Ultrasonic sensor is simple. An ultrasonic sound wave at 40kHz is sent by the transmitter of the sensor, which travels through the air. if there is an obstacle or object, the ultrasonic sound waves bounce back to the receiver of the sensor.

By calculating the travel time and the speed of sound ~ 343 meters/second, the distance can be calculated.

                                   Distance(D) = 1/2(Speed(S) × Time(T))

The Ultrasonic transmitter transmits an ultrasonic wave, this wave travels in the air and when it gets objected by any material it gets reflected back toward the sensor this reflected wave is observed by the Ultrasonic receiver module. 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.

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:

             Here:  T = 0.025 Seconds

                        S = 343 m/s

                        D = 1/2 (S x T)

   therefore       D =  1/2 (343 m/s x 0.025 s) = 4.2875 meters



Ultrasonic sensors are used primarily as proximity sensors. They can be found in automobile self-parking technology and anti-collision safety systems. Ultrasonic sensors are also used in robotic obstacle detection systems, as well as manufacturing technology. In comparison to Infrared (IR) Sensors in proximity sensing applications, ultrasonic sensors are not as susceptible to interference of smoke, gas, and other airborne particles (though the physical components are still affected by variables such as heat).  

Ultrasonic sensors are also used as level sensors to detect, monitor, and regulate liquid levels in closed containers (such as vats in chemical factories). Ultrasonic technology has enabled the medical industry to produce images of internal organs, identify tumors, and ensure the health of babies in the womb.