Car Parking Sensor with dnyarduino

0
4594

INTRODUCTION:

Car Parking Sensor with dnyarduinoIn this paper in our daily lives many times against us to the car parking sensor application made distance measurement with you and applying ultrasonic sensor, Bazzar (whistle) and if the Bazzera by mesefa series or slow play application for we did on dnyarduino set is very simple 2- 3  and useful set of connections on the connection will be shared in the diagram.

First, let’s talk about the logic of the ultrasonic distance measuring sensors.

ULTRASONIC SENSOR:

YOU ASK

                                   ULTRASONIC SENSOR

Ultrasonic sensors send out sound waves in the range we are certain we multiply the value obtained in dayanır.bura them when we go back on the principle of detecting objects hit by the sound velocity has achieved the distance. X = V * t

The sound velocity 343m / s are used.

EASY CIRCUIT CONNECTIONS:

Car Parking Sensor with dnyarduino 1

 ARDUINO CODE:

#define trigPin 13
#define echoPin 12
void setup() {
// put your setup code here, to run once:
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(8, 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; //29.1 =10000/343 yani 343m/s*t(zaman) yerine m yi cm ye saniyeyide ms çevirdiğinde ve çarpmak yerine ters çevirip bölersen 29.1  elde ediliyor.
if(distance<=5){
// put your main code here, to run repeatedly:
digitalWrite(8,HIGH);
delay(50);
digitalWrite(8,LOW);
delay(50);
}
if(distance>=5 && distance<=10){
// put your main code here, to run repeatedly:
digitalWrite(8,HIGH);
delay(200);
digitalWrite(8,LOW);
delay(200);
}
if(distance>10 && distance<=15){
// put your main code here, to run repeatedly:
digitalWrite(8,HIGH);
delay(500);
digitalWrite(8,LOW);
delay(500);
}
if(distance>15 && distance<= 20){
// put your main code here, to run repeatedly:
digitalWrite(8,HIGH);
delay(50);
digitalWrite(8,LOW);
delay(50);
}}