Introduction: Smart Parking System Using Node-MCU and IoT
I came to Chandigarh in 2007 and the traffic was much lesser as compared to the present scenario in the city. Now, it is 2017 and after a span of 10 years, everyone is familiar with the chaos in the parking spaces. Imagine, when you reach a parking area and you don't find a parking space. In such a situation, the owner will park his/her vehicle in an NO PARKING zone and in some cases have to pay the fine for the same. Now, Imagine a situation where you access the parking area from anywhere using twitter or just by typing an IP in your web browser on your mobile or laptop.This will save a lot of valuable time and also prevent you from paying fine. Let's now get to the technical part. I am assuming that you all are familiar with Arduino IDE.
The logic to detect cars and reject pedestrians:
In this project, two ultrasonic sensors are employed to detect cars
and other four-wheelers and reject all pedestrians.There are three possible conditions. 1. Only Sensor 1 is active(T1). 2. Both Sensor 1 AND Sensor 2 is active(T3). 3. Only Sensor 2 is active(T2). Every time a condition is met, a timer is started and all the three timers are stopped and values are stored in three different variables. The timers values are then compared and logic is developed.I have measured all the time values and noted them in a notebook and logic developed for entry was T1>=T3>=T2. Each time this condition is met in the software, an entry will be detected and accordingly, the entry variable will also be updated with the new value. To prevent errors in detection from the hardware, place the sensors 1.5m or 2m apart from each other and place sensors at a height of 100cm above from ground.
Step 1: Get All the Components
Here are the components that you will be needing to complete this project:
- 1 x Arduino Nano.
- 2 x Ultrasonic Sensor SR-04
- 4 x 4-pin connectors
- 1 x Node-MCU or ESP8266
- Telephonic Wire-10 meters
- General Purpose Board.
- Soldering Iron
All of the above components are cheaply and easily available on any electronics vendor.
Step 2: Wiring the Components
I hope the table provided are enough to make the connections. Tx Rx of Arduino is connected to Rx Tx of node MCU respectively. Arduino and node MCU can be powered up by using a power bank.
Grab the General purpose Board and solder all the components as per the circuit given. Trig and Echo pin of sensors can be connected to any data pins.
I tested a prototype on a breadboard.
Step 3: Setting Up
Connect the sensor to a stick or something similar to that.
Install the whole system as shown in the pic. The two sensors should be 1.5m or 2m apart and should be 100cm or more above the ground to sense for the object properly.Temperature and sunlight do not affect ultrasonic sensor as in IR sensors and hence they are a better choice.
Step 4: Output on ThingSpeak
In the graph, you can see a peak value. This is just a random value that I used for testing purposes.The values after that are the number of vehicles entered the site. This is just a prototype and can be used with 2 more sensors to count the exited vehicles. So, now we can calculate total vehicle left inside and accordingly tweet the information to everyone. Installation Scheme is shown in the above sketch and the output is also shown in the given thingspeak screenshot.
In thingspeak,we can also produce reactions to tweet when a certain condition is met. To know more about thingspeak and how to make a channel, Visit my blog: ROBOTICS.
Step 5: Working Video
Here is the working video of my project
Visit my Youtube Channel and Subscribe ,like and share the video to support me and to learn more about embedded projects and automation projects.
Step 6: Final Output and Code.
The output is informed to the user by twitter or the user can check the website or android application with channel number to know about whether there is space or not in a parking lot.
Here are the links to download code:
Any questions or doubts, ask in comments. I would try my best to get you out of your problems which you are facing.
Participated in the
Arduino Contest 2016