Back-up radar with arduino

Introduction

Interested in having speed cameras that tell you when you’re too close to a car?

That’s the project we’d like to carry out. The novelty of this project is that it has two levels of difficulty:

  • Radar in the garage
  • Reversing radar in the car

1.Radar in garage

Difficulty:

This is the first level of difficulty in the project. The aim is to have the radar outside the car, glued to the garage wall. When the car gets too close, the buzzer will sound and you’ll be able to stop in time.

It’s the simplest project because you don’t have to cut holes in your rear bumper or run wires through your car.

2. Radar on your bumper

Difficulty:

The second level of difficulty in the project is to install the radar in your car. The aim of this project is to add a radar to the rear of your bumper so that you know how close you are to the object when you park. The distance between the object and your car will be shown on a lcd screen in centimeters, and a buzzer will sound if you get too close to the object.

Materials required

We will now list the hardware required for the project:

Schematic diagram

What's the potentiometer for?

The potentiometer adjusts the screen brightness. You can do without it by connecting 5V directly to the brown wire, and the GND that runs from the potentiometer to the screen can be connected directly to the Arduino board.

Schematic diagram

In the program, the maximum distance between the object and the car at which the buzzer will sound is 15 centimetres. Here’s the program:

//library for LCD screen
#include <LiquidCrystal.h>//setting up pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int buzzer_pin = 8; // buzzer pin
int cm = 0; // Initialize value to 0

//function to acquire the distance from the distance sensor
long readUltrasonicDistance(int triggerPin, int echoPin) {
    pinMode(triggerPin, OUTPUT);  
    digitalWrite(triggerPin, LOW);
    delayMicroseconds(2);
    digitalWrite(triggerPin, HIGH);
    delayMicroseconds(10);
    digitalWrite(triggerPin, LOW);
    pinMode(echoPin, INPUT);
    return pulseIn(echoPin, HIGH);
}


void setup(){
    lcd.begin(16, 2); // Initialize screen  
    pinMode(buzzer_pin, OUTPUT); //set the buzzer to output
}

void loop(){
    // We write the distance on the LCD screen
    lcd.print("Distance: ");
    lcd.print(cm);
    lcd.print(" cm");
    delay(10);

    cm = 0.01723 * readUltrasonicDistance(7, 7); // The value is converted into centimetres
   delay(100); 

    if (cm < 15){ // If the car is less than 15 cm from the object, the buzzer sounds.
       tone(buzzer_pin, 1000, 1000);
    }

    lcd.clear(); // Erase what's written on the LCD screen
}

You can modify the distance at which the buzzer will start sounding with line 36 in the if parenthesis.

How to protect your circuit?

To protect your circuit, whether the Arduino board is in your garage or in your car, you can create a box using a 3d printer or cardboard.

Simulation of the project

Here is the project simulation on Tinkercad: