Smart Car Parking System using Arduino and TOF10120 Laser Range Sensor

(Last Updated On: June 28, 2021)

Smart Car Parking System:

In this tutorial, you will learn how to make the Smart Car Parking System using the Traffic LED Module, Arduino Uno or Arduino Nano, and TOF10120 Laser distance Sensor which is also known as the Time-of-flight Laser Rangefinder sensor or you can call this as the Laser Range Sensor.  In my previous tutorial, I used the same Laser distance sensor with the Nodemcu ESP8266 WiFi module which is a 3.3V compatible controller board and Blynk application for measuring the water level “IoT based Water Level Monitoring System”. With the help of this project I was able to monitor the Water level from anywhere around the world using my cell phone. Some boys and girls asked me if the same TOF10120 Laser Distance Sensor can be used in building the Car Parking System and this is the reason I am doing this project. Before, I am going to talk about the technical specs, circuit diagram, and programming. First, let me explain how this Smart Car Parking System actually works.

smart car parking system

I used this cutting mat as the parking area, I measured its length and then as per the measured length I defined different ranges in code to turn ON and turn OFF these LEDs one by one to help the driver safely park the car. When the car is about to enter into the parking area the Green LED turns ON, as you can see in the image above.

 

smart car parking system

And then the Yellow LED turns ON which let the driver know that you are almost there, this indicates that the car is half way inside the parking area, when the Red LED starts blinking it warns the driver to slow down and be careful, now at this point the driver can stop the car or the driver can continue to move until the Red LED stops blinking.

smart car parking system

This is just a prototype model to help you understand how to make the Smart Car Parking System using some inexpensive electronic components. You can change the distance values in the code and make a final product that you can use in a garage.

In my getting started tutorial on the TOF10120 I explained how to display the distance values on the Oled display module and I also explained how to control a 110/220Vac Light bulb without any physical contact. So, if you have never used the TOF10120 Laser distance sensor then I highly recommend watch my getting started tutorial on the TOF10120 Laser Range Sensor.

Without any further delay let’s get started!!!


Amazon Links:

12v Adaptor:

Arduino Uno

Arduino Nano

tof10120 laser range sensor

Traffic LED Module

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*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!

ToF10120 Specs, Feature, Applications, & Pinout:

smart car parking system

TOF10120 range sensor provides accurate and repeatable long range distance measurement for high-speed autofocus (AF). The innovative time-of-flight technology allows performance independent of object reflectance.

TOF10120’s time-of-flight sensing technology is realized by Sharp’s original SPAD (Single Photon Avalanche Diodes ) using low-cost standard CMOS process. It enables accurate ranging result, higher immunity to ambient light and better robustness to cover-glass optical cross-talk by special optical package design.



TOF10120 Features:

・940nm laser classified as class 1 under operation condition by IEC 60825-1:2014-3rd edition

・Small ceramic package(20×13.2×2.0mm)

・Long range absolute range measurement up to 1.8m within 5% accuracy at indoor.

・Reported range is independent of the target reflectance

・Operates in high infrared ambient light levels

・Advanced optical cross-talk compensation

・High speed ranging MAX 30ms

・Standard solder reflow compatible

・No additional optics

・Single power supply

・Txd interface for device control and data transfer

・Lead-free, RoHS compliant

TOF10120 Applications:

・High-speed AF

・Continuous AF for video

・User detection for Personal Computers/Laptops/Tablets

・Robotics (obstacle detection)

・Contactless Switch

・White goods (hand detection in automatic Faucets, refrigerator etc.)

TOF10120 Recommended Operating Conditions:

smart car parking system

As per the datasheet the recommended ranging range of the TOF10120 is between 100 and 1800 the unit is in mm (millimeters). The TOF10120 Laser Range Sensor Module can be easily powered up using 3 to 5 volts. Due to this wide range of input voltages the TOF10120 can be easily used with 5V and 3.3V compatible controller boards like Arduino boards, ESP8266, and ESP32 etc. The current consumption of the TOF10120 is 35mA. The ideal temperature range of the TOF10120 is from -20 to +70 Centigrade. Due to this wide temperature range, this module can be used in extreme weather conditions indoor and outdoor.


TOF10120 Ranging Conditions:

smart car parking system

The range accuracy changes as per the above conditions which depends on the Target Reflection and environment.

TOF10120 Pin Description:

smart car parking system

From the signal names of the TOF10120 it’s quite clear that this RangeFinder supports both the UART and the I2C communication. Pin number1 is the ground. Pin number2 is the VDD. Pin number3 is the RXD. Pin number4 is the TXD. Pin number 5 is the SDA and finally pin number6 is the SCL. Out of the 6 pins of the TOF10120 I will use only 4 pins. GND, VDD, SDA, and SCL. So, I am going to cut the RXD and TXD wires.

smart car parking system

TOF10120 I2C Address:

As per the datasheet the I2C address of the TOF10120 is 0xA4. But i2c addressing uses the high 7 bits so it’s 0x52 which is equivalent to 82. You can also find the I2C address of the TOF10120 by using the I2C Scanner code which is available below in the programming section.

For more details download the TOF10120 datasheet.


Traffic LED Module:

smart car parking system

I am going to use this Traffic LED module as the indicator for the Driver. These LEDs are provided with current limiting resistors so, there is no need to connect any resistors. The Traffic LED module has a total of 4 male headers. The GND pin can be connected with the controller GND or it can also be connected with a digital pin, this way the entire traffic module can be digitally controlled so the 5v signal will turn off the module and the GND or LOW signal will enable the module. The pin labeled as R is for the Red LED, the pin labeled as Y is for the Yellow LED, and this pin labeled as G is for the Green LED. The High signal will turn on the LED.

Smart Car Parking System Circuit Diagram:

smart car parking system

The regulated 5V power supply based on the LM7805 linear voltage regulator is used to power up the Arduino Nano. Don’t forget to add these 470uF decoupling capacitors. Connect the regulated 5volts with the VIN pin of the Arduino Nano. The SCL and SDA pins of the TOF10120 Laser distance sensor are connected with the Arduino’s A5 and A4 pins. A5 is the SCL and A4 is the SDA. While the power supply wires are connected with the Arduino’s 5V and ground. The Traffic LED module GND pin is connected with the Arduino’s pin number 5, the Red LED is connected with the Arduino’s pin number 4, the Yellow LED is connected with pin number 3, and the Green LED is connected with the Arduino’s pin number 2.


PCB designing:

smart car parking system

Download Gerber Files:

Next, I designed a PCB for the Arduino Nano, which I will use as the Development board. I added female headers for the 3.3V, 12V, 5V, and ground. The area on the right side can be used as the Vero Board for soldering other electronic components. I also added female headers on the left and right sides of the Arduino Nano for connecting the jumper wires. This way you can also connect other sensors and electronic devices.

smart car parking system

I have already explained the making of this Arduino Nano based development board and used it with the TOF10120 Sensor and I2C Oled display Module for measuring the distance. So, if you want to learn the very basics then I highly recommend read my getting started tutorial on the TOF10120 Laser Distance Sensor.

smart car parking system

Finally, I started off by connecting the Traffic LED Module with the Arduino Pins 5, 4, 3, and 2 and then using these male headers I connected the GND, Voltage, SCL, and SDA wires of the TOF10120 Laser Distance Sensor. When you have connected your TOF10120 Laser Range Sensor then you use the following code to find the I2C address.



I2C Scanner Code:

After uploading the above code. Open the serial monitor and you will see the i2c address of the TOF10120 Laser Rangefinder sensor. As per the datasheet the I2C address of the TOF10120 is 0xA4. But i2c addressing uses the high 7 bits so it’s 0x52 which is equivalent to 82.

smart car parking system

This is equivalent to 82. Now you know the i2c address, now you can go ahead and fix this sensor.

Mounting the TOF10120 Laser Distance Sensor:

smart car parking system

The TOF10120 Sensor needs to be mounted at some proper height so that it can easily detect the car and measure the distance. You can make a custom made plastic enclosure using 3d printing technology, this way you will be able to easily mount this sensor on walls, metal sheets, wood, and so on. For the demonstration purposes, I temporarily fixed this sensor on this old broken empty laptop charger. The TOF10120 Sensor height looks good. The Whole setup is completed.

I wrote the Arduino code as per the Cutting Mat Area which I am thinking of as the Car Parking Area.


Smart Car Parking System Arduino Programming:

Before, you start the programming; first of all, make sure you download the Wire.h library. This code is the modified version of the code I used in the getting started tutorial. The only modification is the addition of these pins which are used to control the Traffic module and some if conditions which turns ON and turns OFF these LEDs as per the measured distance. Currently, I am measuring the distance in Inches, but if you want you can covert this into feet. So, that’s all about the programming. For the step by step explanation and practical demonstration watch video tutorial given below. Don’t forget to like, share, and subscribe.


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...

Leave a Reply

%d bloggers like this: