Safe distance maintaining Car to Avoid accident using Ultrasonic Sensor

(Last Updated On: June 27, 2020)

safe distance

Safe Distance maintaining Robot Car Description:

In this tutorial, you will learn how to make an automatic safe distance maintaining a control system for a Car to avoid accidents using the Ultrasonic sensor and Arduino Uno. With the help of such a control system, the car speed is automatically adjusted depending on the distance… This control system is entirely based on the Arduino, Ultrasonic Sensor, and L298N motor driver.  In this Tutorial, I will also explain what the safe distance is, and how the safe distance maintaining technology can be used in real cars. I will share with you two methods that can be used in real cars, which will help you stay safe.


This is the 4th  version of the Robot Car. While in the 3rd version

 

I used the flex sensor and the joystick together to control the same robot car, in this project the flex sensor was used as the accelerator and the joystick was used to control the car’s forward, left, right and reverse movement, I named this project as wireless hand gesture + joystick robot car…

While in the 2nd version

 

https://www.electroniclinic.com/wireless-joystick-controlled-robot-car-using-arduino-433mhz-rf-and-l298n-motor-driver/

 I used only the joystick to control the speed and movement of the robot Car. The program used in this project was a little bit complex, so that’s why I decided to make another version of this robot and use a separate sensor for the speed controlling. So that’s why I created version 3.


While in the first version

I used an Android cell phone to control the Robot Car using the hc-05 Bluetooth module.

This Tutorial is based on my previous tutorials,L298N Motor driver Getting Started tutorial:

in this tutorial I explained, how to assemble the robot parts and how to use the L298N motor driver to control the forward, left , right, and reverse movement. In this tutorial, I also explained how to control the speed of a dc motor using the pulse width modulation. …

If you are a beginner and you have never used the L298N motor driver then I highly recommend you should first watch this tutorial and then you can resume from here.


The components and tools used in this project can be purchased from Amazon, the components Purchase links are given below:

Arduino Uno:
Mega 2560:
Robot Car chassis kit:
L298N dual H-Bridge motor driver:
HC-SR04 Ultrasonic Sensor:

DISCLAIMER:

Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

 

Safe Distance:

safe distance

You may already know the danger of following a car too closely as a violation of the law and how frequently it causes accidents..In this tutorial, we will focus on how to avoid this problem. You will learn how to judge a safe following distance,


safe distance

so that you can always maintain enough space in front of you whenever you drive, to picture this space in your minds eyes, think of it as a space cushion as it is often called.

safe distance

Following distance is defined as the distance between you and the vehicle in front of you when you are both moving on the road way.

safe distance

When driving you must always be prepared for the car in front of you to stop, slow down or react to unexpected road conditions ahead. It could be that the vehicle in front of you is slowing for stop traffic in front of them or reacting to traffic signals, children, animals etc.


In the past say when your parents were learning to drive, the way that the idea of a space cushion was generally taught in driver education classes was in terms of car lengths. So for example you would have learned that there should be roughly one full car length between you and the car in front of you for every 10 miles per hour of speed that you are traveling.

safe distance

So if you are traveling at 50 miles per hour you should be five car lengths behind the car in front of you..Driving Professionals finally realized that for most of us figuring out how many car lengths you are behind another car is really difficult…

To solve this problem you will need to make an automatic system that can measure the distance between you and the car in front of you. For distance measurement, we can use the Ultrasonic sensor.  The ultrasonic sensor with Arduino can be used in different ways. For example

    1. You can make an automatic deceleration system. As the distance between you and the car in front of you decreases, your car speed will automatically reduce to maintain the safe distance. Now implementing this technology on real cars can be really difficult without the help of skilled programmers and mechanical experts, as this will require some changes in the car mechanical system. So don’t try this on a real car, but you can use this on a robot car to understand this concept.

safe distance

ii. you can use some LEDs. Let’s say for every 1 meter of the distance you can light up one led. As a normal ultrasonic sensor is capable of measuring the distance up to 5 meters, it means you can use 5 LEDs. so this way you know exactly how far you are from the car in front of you and then manually you can increase or decrease the speed. Now you can try this by yourself as its safe.


safe distance

3. Or you can use a buzzer that is activated when the distance between you and the car in front of you is less than 5 meters. This method works best in situations when you are not looking at the LEDs. So method number 2 and 3 can be combined together and can be implemented in real cars without any problem.

safe distance

Using LEDs and buzzer are very simple, which you can do by yourself and these two methods can be used in real cars without any problems and it won’t need any changes in the car control system. In this episode I will show you how to make an automatic deceleration system for a robot car, just to present to you how cool it would be if this technology is implemented in every car.


Interfacing motors and Ultrasonic Sensor with Arduino:

For the connections explanation watch video Tutorial.

Safe distance maintaining car Circuit Diagram:

safe distance

Safe distance maintaining car Arduino Programming:

For the step by step program explanation watch video given at the end of this Article. If you have any questions let me know in a comment.


Program 2: Led’s Controlling

Watch Video Tutorial:

Recommended For You

About the Author: Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

1 Comment

Leave a Reply