Home
About Us
Achievement
Home
Raspberry-Pi Projects
_Raspberry Pi 4 Complete Guide
Arduino Project
_All Projects
Esp8266 Project
_All Projects
Esp32 Project
_Automation-with-feedback
Car Speed Detector
Just Do Electronics
April 20, 2020
Car Speed Detector using Arduino and IR Sensor
Circuit Diagram :-
Code :-
//Prateek //www.prateeks.in #include
LiquidCrystal lcd(12,11,10,9,8,7); int timer1; int timer2; float Time; int flag1 = 0; int flag2 = 0; float distance = 5.0; float speed; int ir_s1 = 2; int ir_s2 = 3; int buzzer = 4; void setup(){ pinMode(ir_s1, INPUT); pinMode(ir_s2, INPUT); pinMode(buzzer, OUTPUT); lcd.begin(16,2); lcd.clear(); lcd.setCursor(0,0); lcd.print(" WELCOME "); lcd.setCursor(0,1); lcd.print("JustDoElectronic"); delay(2000); lcd.clear(); } void loop() { if(digitalRead (ir_s1) == LOW && flag1==0){timer1 = millis(); flag1=1;} if(digitalRead (ir_s2) == LOW && flag2==0){timer2 = millis(); flag2=1;} if (flag1==1 && flag2==1){ if(timer1 > timer2){Time = timer1 - timer2;} else if(timer2 > timer1){Time = timer2 - timer1;} Time=Time/1000;//convert millisecond to second speed=(distance/Time);//v=d/t speed=speed*3600;//multiply by seconds per hr speed=speed/1000;//division by meters per Km } if(speed==0){ lcd.setCursor(0, 1); if(flag1==0 && flag2==0){lcd.print("No car detected");} else{lcd.print("Searching... ");} } else{ lcd.clear(); lcd.setCursor(0, 0); lcd.print("Speed:"); lcd.print(speed,1); lcd.print("Km/Hr "); lcd.setCursor(0, 1); if(speed > 50){lcd.print(" Over Speeding "); digitalWrite(buzzer, HIGH);} else{lcd.print(" Normal Speed "); } delay(3000); digitalWrite(buzzer, LOW); speed = 0; flag1 = 0; flag2 = 0; } }
0 Comments
Newer
Older
ESP32 Interfacing With LDR Sensor
Smart Street Light Using Arduino
How to Make a Conveyor Belt System | Counter Machine
Esp32 Cam Based Face Unlock
ESP32 Led Blink With Push Button
IoT Based Patient Health Monitoring System Using Blynk App
IoT Based Fingerprint Biometric Attendance System Using NodeMCU (Esp8266)
IoT Weight Scale using Load Cell HX711 & ESP8266
Arduino ebook
Vehicle Accident Alert System Using Accelerometer GPS And GSM
YouTube
Like on Facebook
Follow on Twitter
Follow on Google+
Follow on Instagram
Subscribe on Youtube
Hi WelCome To My Website If you have a creative mind and want to learn Electronics even without studying it then FRIENDS this Website And Youtube Channel is for you, I am crazy creators who love making Electronics things. I have a bunch of more than 130 Tutorial Videos on My YouTube Channel and I upload a new Tutorial every Sunday.
Tags
Arduino Project
Esp32 Project
Esp8266 Project
0 Comments