SMARTNESS IS THE KEYI 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 using Arduino IDE.
Ultrasonic SensorUltrasonic sensor has 4 pins namely VCC, GND, TRIG, ECHO. The ultrasonic sensor sends pulses of high frequency and as soon as it gets reflected from the object(if any object is there within 400cm), Echo pin will receive the signal and indicate that an object has been detected.Click here to know how to detect objects and measure the distance using ultrasonic sensor.
Logic for detecting carsIn 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.
Wiring the circuit
If you are going to use my code for your project, make sure to make the connections as folllowing.
Here is the CODE For entry detection.
Once the Enteries are detected, get ready to see some magic with few lines of code. Make the following connections.Tx of Arduino to Rx of Node-Mcu.
Rx of Arduino to Tx of Node-Mcu.
Before uploading this code to node-mcu, make sure Arduino is turned off and proper board is selected in the Arduino IDE.
Here is the Code For WiFi connection and data upload.
To know about Thingspeak libraries and ESP8266 libraries and making a new channel on Thingspeak Click Here. Firstly the serial data is read and then written on the Thingspeak using the above code.
Here are the output and twitter notification.
This is how i tested the system(Make sure to decrease the height of sensor,its an old pic :P)
If you are facing any problems or having any problems in this project, ask in comments.
Working Video is on My Youtube Channel.
Keep Learning and Keep sharing the Knowledge.