Traffic Light Circuit

by Iris Lin11 in Circuits > Arduino

190 Views, 0 Favorites, 0 Comments

Traffic Light Circuit

Screen Shot 2021-05-09 at 1.46.58 AM.png

This website will teach you how to make your own traffic light that can teach your kids the rules and the precautions while crossing the roads. This product is a real traffic light model with a small map and a small number of people, which will make the function more real.

Supplies

20 jumper wires

1 bread board

1 arduino leonardo

1 straw

1 cardboard

1 red led light

1 green led light

1 yellow led light

1 black color paper

1 A4 paper

1 black marker

1 reel of tape

1 glue

1 iron wire

1 USB cable for arduino

3 resistance

Traffic Light Box

Cuboid template.jpeg
Cuboid template 2.jpeg

1. Draw the sketch that you want on the cardboard

2. Cut the shape out along the peripheral of the shape

3. Cut 3 holes on both A1&A2 (The distance of the 3 holes have to be divide evenly)

4. Cut a hole on the left side of B2

5. Fold the box along the dotted line

6. Stick the cardboard into the box but don't stick A1

7. Stick tape onto the three holes on both A1&A2

Pillar, Light Bulb and Wire

IMG_8201.JPG
IMG_8200.JPG
IMG_8199.JPG

1. Take out A4 paper

2. Draw line patterns using a black marker on the A4 paper

3. Reel the A4 paper and put it into the straw

4. Connect the light bulb onto jumper wires

5. Stick each color of the light bulb onto B1 align to the three holes on both A1&A2

6. Cut 2 small pieces of cardboard

7. Stick in the middle of each light bulb in order to isolate the light of each area

8. Stick two of the wires that are on the same light bulb together with tape

9. Pull all the wires out of the box through the hole on B2

10. Plug the straw into B2 and make all the wires in the straw

11. Make a base for the traffic light with the iron wire

12. Connect all the wires on the light bulb onto another wire to make it longer

13. Put the Straw onto the base to make the traffic light stand

14. Stick the last part of the cardboard in order to form a box

Circuit

Screen Shot 2021-05-09 at 12.29.42 AM.png
IMG_8206.JPG

1. Connect the negative electrode to the GND and the positive electrode to 5V

2. Connect the wire one side to digital pins and another side to the wire that connects to the longer leg of the light bulb

3. Connect the wire of the shorter side of the light bulb to the resistance

4. Connect the resistance back to the negative electrode

5. Repeat step 2-4 for twice

Code

Screen Shot 2021-05-09 at 12.32.26 AM.png

void setup( ){ // put your setup code here, to run once:

pinMode( 13 , OUTPUT); // sets the digital pin as output

pinMode( 12 , OUTPUT); // sets the digital pin as output

pinMode( 11 , OUTPUT); // sets the digital pin as output

}

void loop( ){ // put your main code here, to run repeatedly:

digitalWrite( 13 , HIGH ); // sets the digital pin on/off

digitalWrite( 12 , LOW ); // sets the digital pin on/off

digitalWrite( 11 , LOW ); // sets the digital pin on/off

delay( 5000 ); // waits a few milliseconds

digitalWrite( 13 , LOW ); // sets the digital pin on/off

digitalWrite( 12 , HIGH ); // sets the digital pin on/off

digitalWrite( 11 , LOW ); // sets the digital pin on/off

delay( 500 ); // waits a few milliseconds

digitalWrite( 12 , LOW ); // sets the digital pin on/off

digitalWrite( 13 , LOW ); // sets the digital pin on/off

digitalWrite( 11 , LOW ); // sets the digital pin on/off

delay( 100 ); // waits a few milliseconds

digitalWrite( 12 , HIGH ); // sets the digital pin on/off

digitalWrite( 13 , LOW ); // sets the digital pin on/off

digitalWrite( 11 , LOW ); // sets the digital pin on/off

delay( 100 ); // waits a few milliseconds

digitalWrite( 12 , LOW ); // sets the digital pin on/off

digitalWrite( 13 , LOW ); // sets the digital pin on/off

digitalWrite( 11 , LOW ); // sets the digital pin on/off

delay( 100 ); // waits a few milliseconds

digitalWrite( 12 , HIGH ); // sets the digital pin on/off

digitalWrite( 13 , LOW ); // sets the digital pin on/off

digitalWrite( 11 , LOW ); // sets the digital pin on/off

delay( 100 ); // waits a few milliseconds

digitalWrite( 12 , LOW ); // sets the digital pin on/off

digitalWrite( 11 , LOW ); // sets the digital pin on/off

digitalWrite( 13 , LOW ); // sets the digital pin on/off

delay( 100 ); // waits a few milliseconds

digitalWrite( 12 , HIGH ); // sets the digital pin on/off

digitalWrite( 11 , LOW ); // sets the digital pin on/off

digitalWrite( 13 , LOW ); // sets the digital pin on/off

delay( 100 ); // waits a few milliseconds

digitalWrite( 12 , LOW ); // sets the digital pin on/off

digitalWrite( 11 , LOW ); // sets the digital pin on/off

digitalWrite( 13 , LOW ); // sets the digital pin on/off

delay( 100 ); // waits a few milliseconds

digitalWrite( 12 , HIGH ); // sets the digital pin on/off

digitalWrite( 11 , LOW ); // sets the digital pin on/off

digitalWrite( 13 , LOW ); // sets the digital pin on/off

delay( 100 ); // waits a few milliseconds

digitalWrite( 12 , LOW ); // sets the digital pin on/off

digitalWrite( 11 , LOW ); // sets the digital pin on/off

digitalWrite( 13 , LOW ); // sets the digital pin on/off

delay( 100 ); // waits a few milliseconds

digitalWrite( 12 , HIGH ); // sets the digital pin on/off

digitalWrite( 11 , LOW ); // sets the digital pin on/off

digitalWrite( 13 , LOW ); // sets the digital pin on/off

delay( 100 ); // waits a few milliseconds

digitalWrite( 12 , LOW ); // sets the digital pin on/off

digitalWrite( 11 , HIGH ); // sets the digital pin on/off

digitalWrite( 13 , LOW ); // sets the digital pin on/off

delay( 3000 ); // waits a few milliseconds

}

https://create.arduino.cc/editor/iris_lin/94c90665-4271-47e4-863f-558ea3501cce/preview

Final Product

Arduino - Traffic Light

This is the final version of my traffic light model.