Living in Bangalore, India, you have to deal with hustle and bustle of the city. This city never sleeps and its road are always packed. We, the students of Faculty of Engineering, Christ (Deemed to be University), Bangalore, seek to mitigate this problem with the help of data analysis and IoT solutions.
The biggest question in any project is to how to go about the implementation of an idea. We came across a library called OpenCV, this tool helps us in extracting density of traffic at any point of time. Edge Detection is one way to go about this idea, we use Canny Edge Detection to detect edges. Here is how Edge Detection works.
After performing Edge detection we calculate the means of each image processed by the algorithm using the mean of the reference image, in this case the reference image is an image when there is no traffic using this image we can then compare images generated in real time and teach the computer what high low traffic looks like. We should really be careful when we are selecting these images.
The image above displays the image processed by Canny Edge Detection.
Some Detail on the Components Used
For the server, I used Python’s framework called Django. For installation tutorials, please refer the following link:
For the MQTT part, I have used Paho on the server side.
Client side, you need to import an MQTT library you can get that by searching for it on
Now, how does everything fall in place? The following image illustrates how all the components fall in to place.
A view of the login screen:
A view of the main screen:
This image gives us the comparison of traffic we are dealing with at each junction.
A view of the API:
The API helps to transfer data from the camera to the server.
Note: The red board is a WIZ750SR and the blue board is an Arduino Uno.
Too complex to understand? Do not worry! We have made a video.
The above photos shows the connections to transfer data from your evaluation board to your Arduino board. We were unable to use Fritzing.org since their captcha was shutdown and were unable to sign up. We can however explain the connections.
Step 1: Connect a RS232 cable to your Wiznet evaluation board.
Step 2:Take a pair of jumper wires
Step 3:Connect one jumper wire to pinout number 2 and one jumper wire to pinout number 5
The diagram above will help you with the connections.
Step 3: Take the jumper wire connected to pin 5 and connect it to the GND in your Arduino
Step 4:Take the jumper wire connected to pin number 2 connect it to the RX or 0 digital
For the signal connections make sure to connect the lights for junctions A and C in parallel and B and D parallel as well.
Steps to Upload Code to Arduino
1) Select the ‘Arduino Uno’ board from the Board manager
2)Select right com port for your device
3) Then upload the code
4) While uploading the code make sure the TX and RX pins are not connected
Steps to Upload Code to the WIZnet Board
1)Compile the Code from Mbed OS
2) Use the ISP toolkit to upload the code to board
3) Before doing that set the boot switch on your board while uploading
4)After uploading reset the boot switch
5)Test your board with AT commands
Another Feature our project is detection of priority vehicles like ambulance,police cars and so on.However, for this project we have attempted the detection of Ambulance.
This we were able to do with the help of Haar Cascade.
How detection System works:
When we detect an ambulance a status is sent to the serve that status information is retrieved by the signal through our API.
To go with our project we have also made an autonomous car so that we can avoid incidents of drunken driving and sleep driving
Structure of our car