Smart Traffic Lights

by DepreesterEwoud in Circuits > Sensors

490 Views, 1 Favorites, 0 Comments

Smart Traffic Lights

IMG_20200614_190003.jpg

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.

Bill of Materials

The total cost of the project for me was 121,30€

Used parts

  • IR Sensor
  • Ultrasonic sensor
  • HC-SR04
  • LDR
  • SensorDisplay
  • LCD 1602A
  • Leds
  • Buzzer
  • Traffic lights
  • Wooden planks
  • PCF8574
  • Hinges
  • Nails
  • Glue
  • Power adapter

Used tools

  • Woodsaw
  • 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)

Downloads

The Housing

IMG_20200609_133124.jpg
IMG_20200609_133256.jpg
IMG_20200609_133010.jpg
IMG_20200601_111927.jpg
IMG_20200601_111939.jpg
IMG_20200614_194759.jpg
IMG_20200601_111943.jpg
IMG_20200614_194824.jpg
IMG_20200614_194806.jpg
IMG_20200614_195114.jpg

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.

Fritzing Schema

electronica.jpg
schema.jpg

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.

Setup

IMG_20200614_171829.jpg
IMG_20200614_171850.jpg
IMG_20200614_195128.jpg
IMG_20200614_195125.jpg

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.

Normalised Database

database.PNG

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.

Writing the Code

To write the code, i used following programs:

  • Visual studio code: to program the front-end in HTML, CSS and Javascript but also the backend in Python
  • 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