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


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]


Team Members

Justine Lee

Mihir Sathe

Kaj Kuchina

Mountain Road Model


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() {
  delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
  if (sonar[0].ping_cm() < THRESH) {
    digitalWrite(led_g, HIGH);
    digitalWrite(led_r, LOW);
  else if (sonar[1].ping_cm() < THRESH) {
    digitalWrite(led_g, LOW);
    digitalWrite(led_r, HIGH);
  else {
    digitalWrite(led_g, LOW);
    digitalWrite(led_r, LOW);


Traffic Light STL:


NewPing Arduino Library :