GithubHelp home page GithubHelp logo

trafficsystem's Introduction

TrafficSystem-F

Metropolia Realtime operating system project 2019
Metropolia UAS, 2019.

Introduction
The project demo my ability to make a simple realtime operating system in Linux. I need to create a master process, which control other subprocesses.

AWS code - Traffic light system
Link to the code of master process and subprocesses: https://github.com/Usin2705/TrafficSystem/tree/master/TrafficSystemAWS

The master process can start and also close other subprocess. It also reponsible for closing all subprocesses and logging. The subprocess control a mqtt publisher, which will send the MQTT command to ESP32 to controll the traffic light.

While the traffic system is running, all traffic lights will syncronize to make a smooth traffic. The syncronize is done via pipes. The first traffic light (TRAFFIC0) will start first, then send the signal to the 2nd traffic light. Only when receive the signal through pipe, the 2nd traffic light will start. Whenever the 1st traffic light turn from yellow to red, it will again signal the next traffic light.

ESP32 code - Individual traffic light
Link to the code of ESP32: https://github.com/Usin2705/TrafficSystem/blob/master/TrafficLightsESP32/TrafficLight/TrafficLight/TrafficLight.ino

To change the traffic light number, we need to change the line 48:

const char* MQTT_TOPIC = "TRAFFIC2"; //Replace this one for the traffic light number

At the moment, I only have TRAFFIC0, TRAFFIC1 and TRAFFIC2. It's also the topic of MQTT, so each traffic light will listen to different MQTT topic

The ESP32 has 2 main tasks:

  • Log into wifi, then try to connect to MQTT broker (which are supposed to run in AWS server 24/24). Then listen to it's MQTT topic and turn on the correct light, or turn off the traffic light.
  • If the broker is down, due to no internet connection, AWS server is turned off or MQTT broker is turned off, then the traffic light will enter "Self Service" mode. In this mode, each traffic light will turn the light following this sequence R - Y - G - Y - R, with Red and Green have 20 seconds countdown, while Yellow have 4 second countdown.

trafficsystem's People

Contributors

usin2705 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.