Project showcase
Is The Overtaking Car Keeping Enough Side Distance To You?

Is The Overtaking Car Keeping Enough Side Distance To You? © GPL3+

Simple and effective method (some police is using too) how to measure the side distance to an overtaking car.

  • 2 views
  • 0 comments
  • 0 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)
(+ solder)
Crimp Tool (generic)
(+ a few ferrules)
Side cutter (generic)
08wx9696 40
Tape, Electrical
For isolating
Cutter knife (generic)

Apps and online services

About this project

TheIdea

Until April 28, 2020 in Germany you have to keep at least 1.5 m (4.9 feet) side distance while overtaking a bicyle. If you violated the law you're going to receive a fine (30 EUR/34 USD).

But how does the police check the side distances between a car and a bicyle? During my research I found an article about the Salzburg's police department. I wondered how the device works so I tried to build one by myself.

After The Idea

Due to german/european law I would have to censor every license plate and every person. Because of that I couldn't record a video in action. But it's working well.

I would like to have a 3d printed case but I don't have a 3d printer so I took a stable shoe box. For mounting it to my handlebars I used some GoPro stuff.

(on the left side is a wall aka car)

In the code I'm operating only with centimeters.

#include <LiquidCrystal.h>
int trigger=7;
int echo=6; 
int blue=8;
int green=9;
int yellow=10;
int red=13;
long distance,duration;
LiquidCrystal lcd(12,11,5,4,3,2);
void setup() {
 pinMode(trigger,OUTPUT);
 pinMode(echo,INPUT);
 lcd.begin(16,2);
 pinMode(blue,OUTPUT);
 pinMode(green,OUTPUT);
 pinMode(yellow,OUTPUT);
 pinMode(red,OUTPUT);
}
void loop() {
 lcd.clear();
 digitalWrite(trigger, LOW); 
 delay(5); 
 digitalWrite(trigger, HIGH); 
 delay(10);
 digitalWrite(trigger, LOW);
 duration = pulseIn(echo, HIGH); 
 distance = ((duration/2) * 0.03432) - 20; 
 lcd.print(distance);
 if(distance>400 || distance<30){ //failure or not making sense to measure
   digitalWrite(blue,HIGH);
   digitalWrite(green,LOW);
   digitalWrite(yellow,LOW);
   digitalWrite(red,LOW);
 }else if(distance<400 && distance>150){ //enough distance
   digitalWrite(blue,LOW);
   digitalWrite(green,HIGH);
   digitalWrite(yellow,LOW);
   digitalWrite(red,LOW);    
 }else if(distance<150 && distance>100){ //too little distance
   digitalWrite(blue,LOW);
   digitalWrite(green,LOW);
   digitalWrite(yellow,HIGH);
   digitalWrite(red,LOW);
 }else if(distance<100 && distance>30){ //far too little distance
   digitalWrite(blue,LOW);
   digitalWrite(green,LOW);
   digitalWrite(yellow,LOW);
   digitalWrite(red,HIGH);
 }
 delay(100); //repeating fast enough to have a current value but slow enough having enough time to read the value
}

Here some pictures:

I was even able to drive normally without getting affected by the device.

I'm open to all (positive/negative...) feedback.

Code

Ultrasonic_Seitenabstand.inoC/C++
#include <LiquidCrystal.h>
int trigger=7;
int echo=6; 
int blue=8;
int green=9;
int yellow=10;
int red=13;
long distance,duration;
LiquidCrystal lcd(12,11,5,4,3,2);
void setup() {
  pinMode(trigger,OUTPUT);
  pinMode(echo,INPUT);
  lcd.begin(16,2);
  pinMode(blue,OUTPUT);
  pinMode(green,OUTPUT);
  pinMode(yellow,OUTPUT);
  pinMode(red,OUTPUT);
}

void loop() {
  lcd.clear();
  digitalWrite(trigger, LOW); 
  delay(5); 
  digitalWrite(trigger, HIGH); 
  delay(10);
  digitalWrite(trigger, LOW);
  duration = pulseIn(echo, HIGH); 
  distance = ((duration/2) * 0.03432) - 20; 
  lcd.print(distance);
  if(distance>400 || distance<30){ //failure or not making sense to measure
    digitalWrite(blue,HIGH);
    digitalWrite(green,LOW);
    digitalWrite(yellow,LOW);
    digitalWrite(red,LOW);
  }else if(distance<400 && distance>150){ //enough distance
    digitalWrite(blue,LOW);
    digitalWrite(green,HIGH);
    digitalWrite(yellow,LOW);
    digitalWrite(red,LOW);    
  }else if(distance<150 && distance>100){ //too little distance
    digitalWrite(blue,LOW);
    digitalWrite(green,LOW);
    digitalWrite(yellow,HIGH);
    digitalWrite(red,LOW);
  }else if(distance<100 && distance>30){ //far too little distance
    digitalWrite(blue,LOW);
    digitalWrite(green,LOW);
    digitalWrite(yellow,LOW);
    digitalWrite(red,HIGH);
  }
  delay(100); //repeating fast enough to have a current value but slow enough having enough time to read the value
}

Schematics

Schematic
The most non 5V and non ground cables are colored as in the pictures.
Ultrasonic seitenabstand steckplatine aktualisiert g0fg9w3mp0

Comments

Similar projects you might like

The TrafficLight

Project showcase by Advaith Jagathesan

  • 18,264 views
  • 1 comment
  • 26 respects

PDDU(Portable Distance Display Unit)

Project tutorial by jayadevkamath

  • 507 views
  • 1 comment
  • 1 respect

Simple Ultrasonic Distance Measurer With LCD Display

Project showcase by onatto22

  • 17,372 views
  • 6 comments
  • 38 respects

Robotic Car controlledover Bluetooth with Obstacle Avoidance

Project showcase by S.Ranjith Reddy

  • 16,630 views
  • 9 comments
  • 26 respects

Measuring Distance with Sound

by Giannis Arvanitakis

  • 12,620 views
  • 2 comments
  • 37 respects
Add projectSign up / Login