How to Make a Car Parking Sensor Using Arduino?

As we know that not all cars come with parking sensors. If we want to install an external parking sensor, it costs a lot of money. But luckily we can make a low-cost parking sensor by using Arduino.

Car Parking Sensor (Copied from Instructables)

In this project, the driver will be indicated with a beep of a buzzer while reverse parking. A small ultrasonic sensor will be attached above the rear number plate that will calculate the distance of the car from the object behind. If the distance decreases a specific range, it will beep a buzzer and let the driver know when to stop.

How to Set Up a Car Parking Sensor in Your Car?

Now, let us move forward and gather further information to start our project.

Step 1: Collecting the Components

Before we start working on this project, making a list of components, that will be used, and studying them is always a good approach. So below are the components that we are going to use in this project.

Step 2: Studying the Components

Now all the components that will be used in this project are known, let’s study them a little bit so that we know how these things are working.

Arduino Uno is a microcontroller board that is used to perform various tasks in different circuits. It needs a Code in C language to operate. We are using the Arduino Uno board in this project but you can also use Arduino Nano or a Node MCU.

HC-SR04 board is an ultrasonic sensor which is used to determine the distance between two objects. It consists of a transmitter and a receiver. The transmitter converts the electrical signal into an ultrasonic signal and the receiver converts the ultrasonic signal back to the electrical signal. When the transmitter sends an ultrasonic wave, it reflects back after colliding with a certain object. The distance is calculated by using the time, that ultrasonic signal takes to go from the transmitter and come back to the receiver.

Ultrasonic Sensor

Step 3: Making the Circuit

Now, as we know how the components work, let’s go ahead and assemble theses components together and make a circuit as shown below. The Ultrasonic sensor is powered by 5V through Arduino, its trigger pin connected to the Pin5 and Echo pin s connected to the Pin6  of the Arduino. The buzzer is connected to the Pin4 of Arduino.

Circuit Diagram

Now we will set these components in our car. Attach the HC-SR04 module above your number plate and make a way for the connecting wires through the hatchback of your car to the inside rear of the car close to the speakers. Put the rest of the circuit in a small plastic box and place it in the rear of the car near the speakers. Now take a small piece of connecting wire and connect Vin pin of Arduino to the positive terminal of the Speaker.

Step 4: Getting Started with Arduino

If you are not already familiar with Arduino IDE, don’t worry, because here is the procedure to burn a code on Arduino using the IDE. First, download the latest version of Arduino IDE from Arduino

  1. Connect the Arduino board to your laptop. Go to Control Panel > Hardware and Sound > Devices and Printers to check the name of the port to which Arduino is connected.
  2. Open the Arduino IDE and go to Tools > Boards. Set the board to Arduino/Genuino UNO.
  3. Go to Tools > Port and set the port number that you saw in the control panel.
  4. Download the code attached below and copy it on your IDE. Click the Upload button to burn the code on your microcontroller board.

Click here to download the code.

Step 5: Code

The code is very simple but it is explained below.

1). All the pins of Arduino that will be used are initialized at the start.

const int trigPin = 11;
const int echoPin = 10;
const int buzzPin = 6;

long duration;
float distance;

2). void setup() is a function that defines the pins of Arduino to be used as INPUt or OUTPUT. It also sets the baud rate, which is the communication speed of the microcontroller board.

void setup() 
{
  Serial.begin(9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT); 
  pinMode(buzzPin, OUTPUT);
}

3). void loop() is the function that runs continuously in a cycle. In this loop, the ultrasonic signal is transmitted and the distance is calculated by using the duration of travel. If the distance is less than 100cm, the buzzer will beep.

void loop() 
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);
distance = 0.034*(duration/2);

if (distance < 100)
{
digitalWrite(buzzPin,HIGH);
}
else 
{
digitalWrite(buzzPin,LOW);
}
delay(300);
}

This was the whole procedure to make a low-cost and efficient parking sensor for your car. Now you can enjoy making your own parking sensor at home.

Appuals.com is a participant in the Amazon Services LLC Associates Program, and we get a commission on purchases made through our links.

Hamza Iqbal


Hey! I am Hamza. I am an Electrical Engineer who has a very innovative approach towards daily life stuff. I tend to make life easier by making circuits and designs to automate things around me. I mainly work with printed circuit boards on proteus to bring life to my inventions.
Close