2019WinterTeam4

From MAE/ECE 148 - Introduction to Autonomous Vehicles
Revision as of 22:43, 22 March 2019 by Winter2019team4 (talk | contribs)
Jump to: navigation, search

Introduction

The goal of our project is to create a smart traffic light. We created structures for ultrasonic sensors to detect the car's presence and manage traffic. Utilizing the idea of smart infrastructure, smart cars are able to become more effective and optimizing traffic. We are able to turn off street lighting when it is unused and give priority to emergency vehicles. This simple model minimizes cost and complexity. This project surrounds the problem of directing traffic when 2 way streets merge into 1 on a mountain road.

Our GitHub repository can be found here: [1]

Team4car.jpg

Team Members

Justine Lee

Mihir Sathe

Kaj Kuchina


Mountain Road Model

MountainModel.png

Circuit Schematics

Arduino US LED bb.jpg

Arduino US LED schem.jpg


STL Models

Arduino Code

#include <NewPing.h>
#define SONAR_NUM 2      // Number of sensors.
#define MAX_DISTANCE 100 // Maximum distance (in cm) to ping.
#define THRESH 40
#define led_g 7
#define led_r 8
NewPing sonar[SONAR_NUM] = {   // Sensor object array.
  NewPing(10, 9, MAX_DISTANCE), // Each sensor's trigger pin, echo pin, and max distance to ping.
  NewPing(6, 5, MAX_DISTANCE),
};
void setup() {
  Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
  pinMode(led_r, OUTPUT);
  pinMode(led_g, OUTPUT);
  digitalWrite(led_g, LOW);
  digitalWrite(led_r, HIGH);
}
void loop() {
  Serial.print(sonar[0].ping_cm());
  Serial.print(",");
  delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
  Serial.println(sonar[1].ping_cm());
  if (sonar[0].ping_cm() < THRESH) {
    digitalWrite(led_g, HIGH);
    digitalWrite(led_r, LOW);
    delay(1000);
  }
  else if (sonar[1].ping_cm() < THRESH) {
    digitalWrite(led_g, LOW);
    digitalWrite(led_r, HIGH);
  }
  else {
    digitalWrite(led_g, LOW);
    digitalWrite(led_r, LOW);
  }
}

Resources

Traffic Light STL:

https://www.thingiverse.com/thing:2826057 

NewPing Arduino Library :

https://playground.arduino.cc/Code/NewPing