Almost all cars these days use sensors to help you in parking. Most of these sensors are sonar sensors that can measure the proximity of large objects like walls and other cars.


Theory of Operation

    The sonar sensor works by sending an ultrasonic sound wave, which can’t be heard by humans. The sound wave propagates in a cone shape until it bounces of a surface and returns to the sensor. The sensor calculates the time the sound wave took to travel back and forth and by knowing the speed of sound, the distance can be calculated.

Technical Details

•    Operating Voltage: 5V DC
•    Operating Current: 15mA
•    Measure Angle: 15°
•    Ranging Distance: 2cm - 4m



int trig = 4; // Trig Pin
int echo = 2; //Echo Pin

void setup() {
// initialize serial communication:

void loop()
long duration, inches, cm;

// The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
pinMode(trig, OUTPUT);
digitalWrite(trig, LOW);
digitalWrite(trig, HIGH);
digitalWrite(trig, LOW);

// The echo pin is used to read the signal from the PING))): a HIGH
// pulse whose duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
duration = pulseIn(echo, HIGH);

// convert the time into a distance
// The speed of sound is 340 m/s or 29 microseconds per centimeter.
// The ping travels out and back, so to find the distance of the
// object we take half of the distance travelled.

cm = duration / 29 / 2;




We ship to the GCC and MENA regions.

Reliable and fast shipping to your door, quality assured.

More about shipping

Find us on

Just type @idea_link

Visit our profile