Create a Traffic Light with Arduino  Step by Step Guide ▷ 2020

If what you are looking for is build a traffic light with Arduino and program it perfectly like a professional you will have to read this article to the end. We will tell you all the secrets that you must know in this task.

For this we will mention the necessary materials that you will have to get to create a traffic light from scratch. In addition, you will find the step by step to program like a true expert all the commands from the Arduino IDE.

But no this is not all you will also see a list with the best Arduino kits to buy. Take a look and don’t miss any details.

What does it take to create a semaphore with Arduino from scratch?

To build a traffic light with Arduino from scratch you will need the following materials:

  • A arduino board, if possible it is of the type Arduino UNO R3.
  • A breadboard or insert plate. The size it will have will depend on the project and the volume of your traffic light. In general it will be able to be square of 4.5 centimeters.
  • 3 LEDs. One red, one yellow, and the third green. All should be 3mm.
  • 220Ω resistance, you must have one for each led.
  • Cables necessary so that you can connect all the elements.

Learn step by step how to create a simple semaphore with Arduino and program it like a pro

Learn step by step how to create a simple semaphore with Arduino and program it like a pro

The step by step you have to do to create a simple semaphore with Arduino and program it like a professional is:

Assemble all the elements

The first thing you will have to do is connect the red, yellow and green pins on the breadboard. For this, you must take into account their polarity, knowing that the negative pole is the one with the shortest leg.

This part It must be connected with 5V on the power board or GND, which will also be connected to each of the 220Ω resistors. While the long legs, that is the positive side, will be connected to the pin of the plate Arduino. To end, you will connect with cables all the necessary elements.

Schedule controls

What you will have to do now in open the Arduino IDE and to write the commands that will help you to operate in a robotized way that traffic light.

The first thing you will have to do is define the value of each of the pins, so you will have to write:

int rojo=2;

int amarillo=4;

int verde=7;

Next, you’ll need to declare an output value for each one:

void setup() {

pinMode(verde,OUTPUT);

pinMode(amarillo,OUTPUT);

pinMode(rojo,OUTPUT);

}

When you have finished entering these commands, you will have to set the actions that each of the colors will do:

void loop() {

digitalWrite(verde,HIGH);

delay(2000);

digitalWrite(verde,LOW);

delay(500);

delay(2000);

digitalWrite(amarillo,LOW);

delay(500);

digitalWrite(rojo,HIGH);

delay(2000);

digitalWrite(rojo,LOW);

delay(500);

}

List of the best Arduino kits and boards to create traffic lights that you should know

If you are looking to create traffic lights with Arduino boards, we present below a list of the best kits that you should take into account:

Flameer

Flameer

This 5V kit is very easy to installas it has 4 pins that must be installed in the GND well the plate for each of the colors. Its size is around 5 x 2 centimeters, so you can use it in any educational.

Prometec

In this store you will find the best kits for making a beginner level traffic light. In addition, you will have access to tutorials that will help you to program the plate in a simple way. They ship to Spain and Mexico, since the company has specialized stores in both countries.

Electronics Store

You can pay with PayPal or credit card for this kit for double traffic light with button. The set includes the Arduino board, the breadboard, 40 jumpers, 12 LEDs and 220 Ohms and 10K Ohms resistors. With this package you will also have access to programming, so building your traffic light with Arduino has never been so easy.

If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will also be of great help to more members of the community. Thank you! 😉

You may be interested:

Leave a Comment