New York, NY IMG HI 58° LO 56° Home About Contact
IMG-LOGO
Home Engineering Mechanics Automation Control Engineering Lab To detect the obstacles and alert using Arduino
Automation Control Engineering Lab Lab Experiments

To detect the obstacles and alert using Arduino



Aim

To detect the obstacles and alert using Arduino

Tools and Components required:

  1. Arduino UNO board
  2. Ultrasonic sensor
  3. Test Board
  4. Arduino Software
  5. Connecting Cables
  6. +5V buzzer/ LED

Circuit Diagram:

circuit-diagram

Theory

The ultrasonic sensor transmits sound waves and receives sound reflected from an object. When ultrasonic waves are incident on an object, diffused reflection of the energy takes place over a wide solid angle which might be as high as 180 degrees. Thus some fraction of the incident energy is reflected back to the transducer in the form of echoes. If the object is very close to the sensor, the sound waves returns quickly, but if the object is far away from the sensor, the sound waves takes longer to return. But if objects are too far away from the sensor, the signal takes so long to come back (or is very weak when it comes back) that the receiver cannot detect it. The sensor uses the time it takes for the sound to come back from the object in front to determine the distance of an object.

sensor

The distance to the object (L) can then be calculated through the speed of ultrasonic waves (v) in the medium by the relation, where,‘t’ is the time taken by the wave to reach back to the sensor and ‘Ɵ’ is the angle between the horizontal and the path taken. If the object is in motion, instruments based on Doppler shift are used. The ultrasonic sensor can measure distances in centimetres and inches. It can measure from 0 to 2.5 meters, with a precision of 3 cm.

Program:

int const trigPin = 10;

int const echoPin = 9;

int const buzzPin = 2;

void setup()

{

pinMode(trigPin, Ouput);

pinMode(echoPin, Input);

pinMode(buzzPin, Output);

}

void loop()

{

int duration, distance;

digitalWrite(trigPin, High);

delay(1);

digitalWrite(trigPin, Low);

duration = pulseIn(echoPin, High);

distance = (duration/2) / 29.1;

if (distance <= 50 && distance >= 0) {

digitalWrite(buzzPin, High);

} else {

digitalWrite(buzzPin, Low);

}

delay(60);

}

Result:The obstacle are detected using an ultrasonic sensor and arduino UNO.









Subscribe

Get all latest content delivered to your email a few times a month.