My model works with the lhelp of HC-SRO4
Working of HC-SR04
As shown above the HC-SR04l Ultrasonic (US) sensor is a 4 pin module, whose pin names are Vcc, Trigger, Echo and Ground respectively. This sensor is a very popular sensor used in many applications where measuring distance or sensing objects are required. The module has two eyes like projects in the front which forms the Ultrasonic transmitter and Receiver. The sensor works with the simple high school formula that
Distance = Speed × TimeThe Ultrasonic transmitter transmits an ultrasonic wave, this wave travels in 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 as shown in the picture below
Now, to calculate the distance using the above formula, we should know the Speed and time. Since we are using the Ultrasonic wave we know the universal speed of US wave at room conditions which is 330m/s. The circuitry inbuilt on the module will calculate the time taken for the US wave to come back and turns on the echo pin high for that same particular amount of time, this way we can also know the time taken. Now simply calculate the distance using a micro controller or microprocessor.
Once sitting in my biology lab thinking of a model for my an competition. I thought of this project to do something to do for people who are seen different from other. this will surely help people with some disability.
Components
Arduino uno R3
HC-SR04 ultasonic distance sensor
Jumper wire male to male
small breadboard
buzzer
motor
battery 9 V
Code is as follows#define trigPin 13
#define echoPin 12
#define motor 7
#define buzzer 6
void setup()
{ pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(motor, OUTPUT);
pinMode(buzzer, OUTPUT);
}
void loop()
{ long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance < 70) // Checking the distance, you can change the value
{
digitalWrite(motor, HIGH); // When the the distance below 100cm
digitalWrite(buzzer, HIGH);
} else
{
digitalWrite(motor, LOW);// when greater than 100cm
digitalWrite(buzzer, LOW);
} delay(501);
}
Comments