Loading...
DEW2022

Smart Traffic Lights – Team 5

Who we are

Ambulight Corp cloud service provider for real-time vehicle tracking and traffic signal-changing solutions based in Germany. We serve our government and B2B customers with a holistic cloud tracking architecture system, equipped with smarter connected IoT devices for more accurate detection and signal-changing performance.

Vision

Our Vision is to create a safer, smarter, and more reliable traffic system that connects to the roads around the world, mainly focussing on city traffic.

Mission

To minimize traffic issues and accidents by utilizing smart and innovative technology solutions.

Value proposition

Our ambulance tracking system with a connected traffic signal-changing solution can reduce delays paramedics face in traffic and supports hospitals in their mission to save people’s lives quickly.

Problem Statement

Paramedics have faced the traffic issue of delivering the emergency patients during peak hours, which has delayed their journey time back and forth the pick-up points and hospitals. This seriously threatens patients’ lives. Currently, paramedics would need to wait for civilian drivers to clear out the road in order for them to get through.

Persona

Solution

Prototyping

To solve this issue, we came up with a technological solution by integrating an ambulance tracking system with traffic light signals. This could help to reduce the ambulance delay issue and save more patients’ lives. Furthermore, it would benefit the government by reducing the accident rate derived from ambulance crashes and it could enhance the image of the healthcare system.

simple representation of the basic concept

After refining our basic concept, we designed a prototype with a Raspberry Pi and LEDs and worked with Bluetooth signals instead of GPS.

Prototype with a Raspberry Pi and LEDs
demonstration

The Code

import RPi.GPIO as GPIO
import time
import bluetooth

signal_vorhanden = False
nearby_devices = [] 

RED_PIN = 17
YELLOW_PIN = 27
GREEN_PIN = 22

RED_PIN2 = 24
YELLOW_PIN2 = 23
GREEN_PIN2 = 25

addr = "ADRESSE"

GPIO.setmode(GPIO.BCM)
GPIO.setup(RED_PIN, GPIO.OUT)
GPIO.setup(YELLOW_PIN, GPIO.OUT)
GPIO.setup(GREEN_PIN, GPIO.OUT)
GPIO.setup(RED_PIN2, GPIO.OUT)
GPIO.setup(YELLOW_PIN2, GPIO.OUT)
GPIO.setup(GREEN_PIN2, GPIO.OUT)

GPIO.output(RED_PIN, GPIO.HIGH)
GPIO.output(GREEN_PIN2, GPIO.HIGH)


def ampelschalten_rotzugruen():
    global signal_vorhanden
    GPIO.output(YELLOW_PIN, GPIO.HIGH)
    time.sleep(2)
    GPIO.output(YELLOW_PIN, GPIO.LOW)
    GPIO.output(RED_PIN, GPIO.LOW)
    GPIO.output(GREEN_PIN, GPIO.HIGH)
    signal_vorhanden = True

def ampelschalten_gruenzurot():
    global signal_vorhanden
    GPIO.output(GREEN_PIN, GPIO.LOW)
    GPIO.output(YELLOW_PIN, GPIO.HIGH)
    time.sleep(2)
    GPIO.output(YELLOW_PIN, GPIO.LOW)
    GPIO.output(RED_PIN, GPIO.HIGH)
    signal_vorhanden = False

def checksignal():
    global nearby_devices
    global signal_vorhanden
    nearby_devices = bluetooth.discover_devices(lookup_names=False)
    print(nearby_devices)
    if addr in nearby_devices and signal_vorhanden == False:
        ampel2gruenrot()
        time.sleep(1)
        ampelschalten_rotzugruen()
        time.sleep(0.1)
    elif addr in nearby_devices and signal_vorhanden == True:
        pass
    elif addr not in nearby_devices and signal_vorhanden == True:
        ampelschalten_gruenzurot()
        time.sleep(1)
        ampel2rotgruen()
    elif addr not in nearby_devices and signal_vorhanden == False:
        pass

def ampel2rotgruen():
    GPIO.output(YELLOW_PIN2, GPIO.HIGH)
    time.sleep(2)
    GPIO.output(YELLOW_PIN2, GPIO.LOW)
    GPIO.output(RED_PIN2, GPIO.LOW)
    GPIO.output(GREEN_PIN2, GPIO.HIGH)

def ampel2gruenrot():
    GPIO.output(GREEN_PIN2, GPIO.LOW)
    GPIO.output(YELLOW_PIN2, GPIO.HIGH)
    time.sleep(2)
    GPIO.output(YELLOW_PIN2, GPIO.LOW)
    GPIO.output(RED_PIN2, GPIO.HIGH)

def closeprogram():
        GPIO.output(GREEN_PIN, GPIO.LOW)
        GPIO.output(YELLOW_PIN, GPIO.LOW)
        GPIO.output(RED_PIN, GPIO.LOW)
        GPIO.output(GREEN_PIN2, GPIO.LOW)
        GPIO.output(YELLOW_PIN2, GPIO.LOW)
        GPIO.output(RED_PIN2, GPIO.LOW)
        time.sleep(0.1)
        GPIO.cleanup()
        time.sleep(0.1)

while True:
    try:
        checksignal()
    except KeyboardInterrupt:
        closeprogram()
        break