Arduino Traffic Light - Autodesk Tinkercad | Traffic light System with 7 segment display

Traffic lights are an essential part of modern urban infrastructure, regulating traffic flow and ensuring safety for drivers and pedestrians alike. In this blog post, we will explore how traffic lights work and how to build a simple traffic light system using Tinkercad, a web-based platform for designing and simulating electronic circuits.

The basic idea behind a traffic light is simple: use colored lights to communicate when it's safe to go and when it's not. The most common traffic light configuration includes three lights: red, yellow, and green. Red means stop, yellow means slow down or prepare to stop, and green means go.


What is Autodesk - Tinkercad ?


Autodesk Tinkercad is a free, web-based computer-aided design (CAD) application that allows users to create, design, and simulate 3D objects and electronic circuits. Tinkercad was developed by Autodesk, a leading provider of 3D design, engineering, and entertainment software, and is geared towards beginners and educators who want to introduce students to the world of 3D modeling and electronics.

Tinkercad offers a simple and intuitive interface that allows users to drag and drop pre-made shapes, text, and images to create their 3D designs. It also includes a wide range of tools for customization and editing, such as scaling, rotating, and mirroring objects, as well as Boolean operations for combining shapes.

In addition to 3D modeling, Tinkercad also features a built-in circuit simulator that allows users to create and test electronic circuits without the need for physical components. The simulator includes a library of components such as resistors, capacitors, and LEDs, and users can connect and program the components using the Arduino programming language.

Tinkercad is widely used in educational settings, as it provides an easy and fun way to teach concepts such as geometry, physics, and engineering to students. It also offers a range of learning resources, including tutorials, lesson plans, and project ideas, to help educators integrate Tinkercad into their curriculums.

Overall, Autodesk Tinkercad is a powerful and accessible tool for anyone interested in 3D modeling and electronics, from hobbyists and makers to educators and students. Its user-friendly interface and comprehensive features make it an excellent choice for beginners looking to explore the world of 3D design and electronics.


How to build Traffic Lights with 7 segment display using Autodesk Tinkercad?


To build a simple traffic light system using Tinkercad, we need three LED lights, a breadboard, and some jumper wires. First, we'll create a circuit for the red light. We connect the positive (anode) pin of the red LED to a digital pin on the Arduino board (in Tinkercad), and the negative (cathode) pin to the negative rail on the breadboard. Next, we repeat the same process for the yellow and green lights, connecting them to different digital pins on the Arduino board.

To control the traffic lights, we need to program the Arduino board to turn on and off each light at specific times. We can achieve this using a simple if-else statement. For example, if the red light is on, we want the yellow and green lights to be off. If the yellow light is on, we want the red and green lights to be off. And if the green light is on, we want the red and yellow lights to be off.






WIRING DIAGRAM :-




ARDUINO CODE  :-


// https://www.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g  //

// Traffic Lights //

// By MOHD SOHAIL //


int led1=2;      // Conncet a resistor of 220 ohms with GND terminal 

int led2=3;

int led3=4;

int led4=5;

int led5=6;

int led6=7;

int led7=8;

int green=11;     // connect 220 ohm resistor with LEDs 

int yellow=12;

int red=13;


void setup() {

 pinMode(led1, OUTPUT);

 pinMode(led2, OUTPUT);

 pinMode(led3, OUTPUT);

 pinMode(led4, OUTPUT);

 pinMode(led5, OUTPUT);

 pinMode(led6, OUTPUT);

 pinMode(led7, OUTPUT);

 pinMode(green, OUTPUT);

 pinMode(yellow, OUTPUT);

 pinMode(red, OUTPUT);

}


void loop() {

 //9 

 digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,0);

 digitalWrite(led6,1);

 digitalWrite(led7,1);

 digitalWrite(green,0);

 digitalWrite(yellow,0);

 digitalWrite(red,1);

 delay(1000);


 //8

 digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,1);

 digitalWrite(led6,1);

 digitalWrite(led7,1);

 digitalWrite(green,0);

 digitalWrite(yellow,0);

 digitalWrite(red,1);

 delay(1000);


 //7

 digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,0);

 digitalWrite(led5,0);

 digitalWrite(led6,0);

 digitalWrite(led7,0);

 digitalWrite(green,0);

 digitalWrite(yellow,0);

 digitalWrite(red,1);

 delay(1000);


 //6

  digitalWrite(led1,1);

 digitalWrite(led2,0);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,1);

 digitalWrite(led6,1);

 digitalWrite(led7,1);

 digitalWrite(green,0);

 digitalWrite(yellow,0);

 digitalWrite(red,1);

 delay(1000);


 //5

  digitalWrite(led1,1);

 digitalWrite(led2,0);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,0);

 digitalWrite(led6,1);

 digitalWrite(led7,1);

 digitalWrite(green,0);

 digitalWrite(yellow,0);

 digitalWrite(red,1);

 delay(1000);


 //4

  digitalWrite(led1,0);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,0);

 digitalWrite(led5,0);

 digitalWrite(led6,1);

 digitalWrite(led7,1);

 digitalWrite(green,0);

 digitalWrite(yellow,0);

 digitalWrite(red,1);

 delay(1000);


 //3

  digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,0);

 digitalWrite(led6,0);

 digitalWrite(led7,1);

 digitalWrite(green,0);

 digitalWrite(yellow,0);

 digitalWrite(red,1);

 delay(1000);


 //2

  digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,0);

 digitalWrite(led4,1);

 digitalWrite(led5,1);

 digitalWrite(led6,0);

 digitalWrite(led7,1);

 digitalWrite(green,0);

 digitalWrite(yellow,0);

 digitalWrite(red,1);

 delay(1000);


 //1

  digitalWrite(led1,0);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,0);

 digitalWrite(led5,0);

 digitalWrite(led6,0);

 digitalWrite(led7,0);

 digitalWrite(green,0);

 digitalWrite(yellow,0);

 digitalWrite(red,1);

 delay(1000);

 

 //0

  digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,1);

 digitalWrite(led6,1);

 digitalWrite(led7,0);

 digitalWrite(green,0);

 digitalWrite(yellow,0);

 digitalWrite(red,1);

 delay(1000);


  //4

  digitalWrite(led1,0);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,0);

 digitalWrite(led5,0);

 digitalWrite(led6,1);

 digitalWrite(led7,1);

 digitalWrite(green,0);

 digitalWrite(yellow,1);

 digitalWrite(red,0);

 delay(1000);


 //3

  digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,0);

 digitalWrite(led6,0);

 digitalWrite(led7,1);

 digitalWrite(green,0);

 digitalWrite(yellow,1);

 digitalWrite(red,0);

 delay(1000);


 //2

  digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,0);

 digitalWrite(led4,1);

 digitalWrite(led5,1);

 digitalWrite(led6,0);

 digitalWrite(led7,1);

 digitalWrite(green,0);

 digitalWrite(yellow,1);

 digitalWrite(red,0);

 delay(1000);


 //1

  digitalWrite(led1,0);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,0);

 digitalWrite(led5,0);

 digitalWrite(led6,0);

 digitalWrite(led7,0);

 digitalWrite(green,0);

 digitalWrite(yellow,1);

 digitalWrite(red,0);

 delay(1000);

 

 //0

  digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,1);

 digitalWrite(led6,1);

 digitalWrite(led7,0);

 digitalWrite(green,0);

 digitalWrite(yellow,1);

 digitalWrite(red,0);

 delay(1000);


 //9 

 digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,0);

 digitalWrite(led6,1);

 digitalWrite(led7,1);

 digitalWrite(green,1);

 digitalWrite(yellow,0);

 digitalWrite(red,0);

 delay(1000);


 //8

 digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,1);

 digitalWrite(led6,1);

 digitalWrite(led7,1);

 digitalWrite(green,1);

 digitalWrite(yellow,0);

 digitalWrite(red,0);

 delay(1000);


 //7

 digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,0);

 digitalWrite(led5,0);

 digitalWrite(led6,0);

 digitalWrite(led7,0);

 digitalWrite(green,1);

 digitalWrite(yellow,0);

 digitalWrite(red,0);

 delay(1000);


 //6

  digitalWrite(led1,1);

 digitalWrite(led2,0);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,1);

 digitalWrite(led6,1);

 digitalWrite(led7,1);

 digitalWrite(green,1);

 digitalWrite(yellow,0);

 digitalWrite(red,0);

 delay(1000);


 //5

  digitalWrite(led1,1);

 digitalWrite(led2,0);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,0);

 digitalWrite(led6,1);

 digitalWrite(led7,1);

 digitalWrite(green,1);

 digitalWrite(yellow,0);

 digitalWrite(red,0);

 delay(1000);


 //4

  digitalWrite(led1,0);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,0);

 digitalWrite(led5,0);

 digitalWrite(led6,1);

 digitalWrite(led7,1);

 digitalWrite(green,1);

 digitalWrite(yellow,0);

 digitalWrite(red,0);

 delay(1000);


 //3

  digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,0);

 digitalWrite(led6,0);

 digitalWrite(led7,1);

 digitalWrite(green,1);

 digitalWrite(yellow,0);

 digitalWrite(red,0);

 delay(1000);


 //2

  digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,0);

 digitalWrite(led4,1);

 digitalWrite(led5,1);

 digitalWrite(led6,0);

 digitalWrite(led7,1);

 digitalWrite(green,1);

 digitalWrite(yellow,0);

 digitalWrite(red,0);

 delay(1000);


 //1

  digitalWrite(led1,0);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,0);

 digitalWrite(led5,0);

 digitalWrite(led6,0);

 digitalWrite(led7,0);

 digitalWrite(green,1);

 digitalWrite(yellow,0);

 digitalWrite(red,0);

 delay(1000);

 

 //0

  digitalWrite(led1,1);

 digitalWrite(led2,1);

 digitalWrite(led3,1);

 digitalWrite(led4,1);

 digitalWrite(led5,1);

 digitalWrite(led6,1);

 digitalWrite(led7,0);

 digitalWrite(green,1);

 digitalWrite(yellow,0);

 digitalWrite(red,0);

 delay(1000);

}




Post a Comment

0 Comments