Project description

The purpose of this project, called „Remote reverse parking”, is to bring the IoT domain to the automobile industry. In the last years, IoT had a massive jump in popularity and usage in domains like smart homes, electronic devices, but the presence in the automobile industry is in a incipient stage.

The project simulates the behavior of a car that can be parked remotely, without a driver inside the car, using a WEB page connected via Wi-Fi to the car.

For the implementation, I used ESP32 microcontroller, a DC motor, a DC motor controller (L293D integrated Circuit), an ultrasonic sensor (HC-SR04), 2 LEDs, one buzzer and a breadboard power supply module.

Hardware description

In my project I used the next components:

1. Microcontroller ESP32:

ESP32 is a low-power system on a chip microcontroller, development board, that is characterized by a small price, but offering very good capabilities, especially for IoT applications, making usage of the built-in Wi-Fi and Bluetooth capabilities.

Project usage:

  • The ESP32 is the main part of the project, is used to create the web server and controls all the hardware components of the project.

Image 1: ESP32

2. HC-SR04 ultrasonic sensor:

The sensor is used to measure distance to an object. It uses one transmitter to send an ultrasonic wave that will travel in air until reaching an obstacle and then will be reflected back to the sensor’s receiver module.

Project usage:

  • Used to measure the distance between the simulated car and an eventual obstacle.
  • Based on the measured distance, the DC motor is controlled, reducing the speed, until a full stop, when the distance is small.
  • It is connected to the 5V ESP32 output, the „trigger” pin, used to send the wave, to ESP32 pin GPIO 5, and „echo” pin, used to receive the wave, to ESP32 GPIO 18 pin.

Image 2: HC-SR04 ultrasonic sensor

3. DC Motor, L293D motor controller and breadboard power supply module:

The DC motor is standard, with operating voltage between 3V – 6V.

L293D IC is a motor controller capable to drive 2 DC motors, and is used to control the motor speed.

The breadboard power supply is used to generate 3.3V or 5V output, from a 9V-12V external source, for example a battery, and is connected directly to the VCC and ground pins of the breadboard.

Project usage:

  • The DC motor is used to simulate the car moving, will star to run at a constant speed, and when getting close to an obstacle, based on some distance intervals, the speed will be reduced. The motor is connected directly to the L293D controller.
  • L293D controller is used to control the DC motor speed, using the PWM ESP32 pins. The module power supply is connected to the output of the breadboard power supply, the pins for controlling the DC motor direction are connected to ESP32 GPIO 26 and GPIO 27, and the „enable” pin, used to set the motor speed, to GPIO 14.
  • The dedicated breadboard power supply module was added to power only the DC motor and L293D module, and is alimented by a 9V battery.

Image 3: DC motor, L293D motor driver and Breadboard Power Supply

4. LEDs and buzzer:

Project usage:

  • The LEDs and buzzer are used in the project to generate external warnings for the eventual peoples that will be near the car, to let them now that it will start moving.
  • The 2 used LEDs are started when the car is turned on, from the web page, they will blink in synchrony, miming the hazard lights. The LEDs are connected to GPIO 32 and 33 pins, and to the ground with a 330Ω resistors.
  • The buzzer starts to emit sounds when the remote parking is started, and the DC motor starts to run. In the project I used an active buzzer, with integrated oscillator to generate the sounds, and is connected to ESP32 pin 23.

Image 4: Yellow LED and Active Buzzer

The implementation on the breadboard is presented in the next images:

Image 5: Breadboard implementation

Image 6: Real breadboard implementation

The electrical diagram of the circuit is presented in the next image:

Image 7: Schematic

Software description

The code for the project is implemented using „Arduino IDE”.

Software implementation key features

  • Wi-Fi connection and web server

For the project, ESP32 board is set to operate in „Station Mode”. This means that the board is connected to a Wi-Fi router, retrieves the IP address and creates a web server based on it. The web server can be accessed by another device connected to the same Wi-Fi network.

To facilitate the connection to Wi-Fi, 2 libraries are used:

  1. „WiFi.h” – Provides dedicated Wi-Fi methods for connecting the ESP32 to internet;
  2. „WebServer.h” – Provides methods to set up the web server and handle HTTP requests.
  • Auto-refresh data in the web page

The distance to an obstacle will be showed in the web page, and since the value is not fixed, is changing, I had 2 options, either refresh the web page at a certain fix time period, or update only the distance in the background. Since it is a more cleaner and correct way, I choose the second option.

To achieve the auto-refresh of the distance value, I used „AJAX” (Asynchronous JavaScript and XML), a technique used to update only portions of a web page, fast and dynamic, without refreshing the hole page.

Code modifications required:

  1. Create a new function, linked to the web server, using „.on” method, that will handle the distance change,
  2. Integrated a JavaScript section in the HTML code, that will call, every second, the function mentioned before, and the displayed distance value will be updated in the web page.

Software implementation overview

We can split the code functionality in 3 parts, representing the functioning states, what will be presented to the user in the web page and how the software manages the hardware.

First part

When the microcontroller is booted and the program starts, after the connection to the Wi-Fi is established, the main web page can be accessed, see the preview image below:

Image 8: Home web page

In this step, all the hardware components are turned off.

From this step, we can go on and start the car.

Second part

After the car is started we go to the second web page, where the option to start the remote parking is available.

In this stage the LEDs will start to blink, noticing visually the user that the car is running.

From here 2 options are available, turn off the car and go back to „First part” or start remote parking and go to the „Third part”

Third part

When the remote parking is started, the web page will be updated, and the start button for remote parking can now be used to stop the parking.

When getting closer to an obstacle, a pop-up warning message will appear on the web page, noticing the user that an obstacle is detected and the distance to it, as shown below:

Image 9: Remote parking started - web page

From the hardware control side, the DC motor will start to run at constant speed, and will decrease the speed when the distance to obstacle, measured with HC-SR04, is decreasing. Also the buzzer will generate sounds in the background.

Next available user options are: stop the remote parking, during the parking process or after the parking is done, and go to „Second part”, or stop the car completely and go to „First part”.

The work flow and software implementation of the project is described in the next diagram:

Image 10: State diagram

Further development

Having a solid and tested starting point, I plan to continue developing the project in both hardware and user interface directions.

First, I want to switch from a basic web page interface to an Android/IOS Application, that will make the user-car interaction more easy. Also functionality for front parking will be added.

Secondly, on the hardware side, I want to add one more ultrasonic sensor, used for the front parking, and maybe even switch to more accurate distance sensors or even cameras.


Implementing this project gave me the opportunity to work and learn how to use an Arduino controlled development board, ESP32, with Wi-Fi capabilities. The internet and wireless connections are now part of our lives more than ever before, and will still be in the future, so learning to take advantage of this capabilities is very benefic.

Also, the IoT domain is in a continue expansion, making the human interaction with electronic devices more easy, and I think the domain chose by me for the project, automotive industry, can take advantage from integrating IoT solutions, more than in present.

Source code, Demo video and Presentation

Reference pages

iothings/proiecte/2021/remote_reverse_parking.txt · Last modified: 2022/01/27 22:16 by vlad_alexandru.albu
CC Attribution-Share Alike 3.0 Unported Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0