Introduction: Smart Traffic Lights
Why i made this project
I'm a student at Howest Kortijk. It's a school project for my second semester MCT.
When i'm driving my car and it's calm on the streets, it is useless to stand in front of red lights when there is no other traffic in the opposite direction. So i wanted to make a system that makes sure you don't stand in front of useless traffic lights. What many people do is driving fast until they come close to the traffic lights and that is not good so i'm gonna place a speed detector further from the lights. When you drive by to fast at this sensor the red lights will turn on.
Step 1: Bill of Materials
The total cost of the project for me was 121,30€
- IR Sensor
- Ultrasonic sensor
- LCD 1602A
- Traffic lights
- Wooden planks
- Power adapter
- Soldering machine
For a more detailed overview of the parts and where to buy them, I made a pdf.(the pages are meant to be held next to each other)
Step 2: The Housing
For the housing i got some help from my dad.
We started by sawing some wooden planks. We saw two planks of 60cm x 90cm, 2 planks 10cm x 60cm and one plank 10cm x 90cm.
We hang the planks of 10cm x 60cm on the sides and we sticked them together with the bottom plank of 60cm x 90cm. For the back we used the plank of 10cm x 90cm and also sticked them to the bottom plank.
For the roof where the construction is we used hinges so you could open the roof plank and look at your wiring.
Step 3: Fritzing Schema
The wiring looks complicated but it isn't. You have to do the same wiring sometimes so it isn't really that hard.
For The LCD display i used an PCF8574 so i would have enough GPIO pins on my PI for the rest of my components.
Step 4: Setup
I used 2 breadbords to make my circuit. For the wiring i drilled holes in the plank so you can hide everything under the plank.
Step 5: Normalised Database
I made a database to save the speed of the passing cars. With all these values you can make history of the speeds or a history from the cars who where speeding.
There is also a table for the sensor where you can set up the name of the sensor and the unit from the sensor.
I also made a location table. In this table i saved the status of the lights, the street where the lights stand and the intersection. If you wanna expend the project with multiple intersections you can save it there. But you can also save if the lights have to be automatic, off or on. Identically with the traffic lights.
Step 6: Writing the Code
To write the code, i used following programs:
- MySQL Workbench: to make the database
I wont go into detail here on how I wrote the code, you can find that information on my Github repository i made for this project: https://github.com/DepreesterEwoud/Project1