Stoplight

by rlmcgauvran310 in Circuits > Arduino

438 Views, 0 Favorites, 0 Comments

Stoplight

IMG_3157.JPG

This is a simple stoplight project for beginners. This project includes three LEDs that light up in stoplight order using the Arduino Web Editor code. Red, yellow, and green light up in succession with a short delay in between each light. Children will love to pretend this is a stoplight for toy cars or dolls. It can be completed in a matter of minutes with very few materials required. The reason I chose to complete this project is that I work with students who are completely new to physical computing and the small pieces would be a hindrance or hazard if we used many more than those required for the stoplight.

Supplies

Arduino UNO board

Breadboard

7 wires

3 LEDs (Red, Yellow, Green)

3 220 ohm resistors

USB cable to connect to computer

Computer

Arduino Web Editor

Stoplight Sketch

Step 1: Prepare the Board

IMG_3159.JPG
IMG_3160.JPG
IMG_3161.JPG

First, you must prepare the board.

I have attached photos of where I set up each component on the board and which wires are connected to which pin.

Each LED is set up in an almost identical way. The cathode (shorter end of the LED) is in a row with the anode (longer/bent end) below it. On the same row as the cathode, the resistor is connected to the negative. On the same row as the anode, a wire connects to a pin on the Arduino UNO board giving the light its power. Red is connected to pin 6, yellow to pin 5, and green to pin 4.

A wire connects the positive to the 5V pin and the negative to the GND pin. Two wires connect the positives to positives and the negatives to negatives on the breadboard. This wouldn't be necessary since I wasn't using that side of the board.

Step 2: Prepare the Code

Screen Shot 2022-05-19 at 6.11.24 PM.png

In order for the lights to do what they are supposed to do, they must be told so. In order to tell them what to do, we must code in the Arduino Web Editor.

I edited the public sketch "Blink" to make this work for the three lights. You could copy my code and use it as is, or make your own edits like lighting longer, more or less delay, adding more lights, etc.

My stoplight sketch link.

Step 3: Achieve Traffic Safety

Stoplight

Sit back and relax! The stoplight will take care of everything from here.