Skip to content
Step by Step Internet 馃寪 Guides for learning to surf the Net

How to turn on several LEDs at the same time on Arduino? Step by step guide

Arduino is focused on bring and make it easier for people to use programming and electronics by creating systems that can meet different uses. In this sense, through this open source platform can develop various types of microcomputers single plate.

In this way, it contains all the necessary elements so that peripherals can be connected to the inputs and outputs of a microcontroller. One thing you should know is that can be programmed on computers such as macOS, Windows or GNU / Linux.

Specifically in this post, we will share a simple step-by-step guide for you to learn How to turn on several LEDs at the same time in Arduino ?. In addition to that, we share a list of projects with led lights that you can do with this board.

How many led lights can be used on an Arduino board?

As we mentioned earlier, there are many projects that can be carried out by using Arduino. However, depending on the type of plate used, different projects can be carried out. When it comes to connecting led lights to a board, you should know that you can connect as many as you want.

However, each type of plate has a specific limit, so depending on it, the uniform operation of the lights will be determined. So, if you are going to carry out a project that involves the integration of lights of this type, you must consider the capacity of the plate.

Therefore, we recommend you review:

  • Plate model that you use.
  • Maximum capacity or recommended of the plate model you chose.
  • Consumption decade led.

So, you will have a reference of how many LEDs you can connect without affecting performance of the plate or affect the lighting in general.

Learn step by step how to turn on several LEDs at the same time on Arduino

Learn step by step how to turn on several LEDs at the same time on Arduino

In this step-by-step guide we will explain how to turn on a sequence of several LEDs, simulating the shooting star effect. In this sense, a set of 12 lights will be turned on in sequence.

Keep reading so you can do it easily:

The materials to use

  • 12 LED lights (yellow, red and green colors).
  • An Arduino Uno-R3 Board or Arduino Mega 2560.
  • A computer.
  • A cable USB printer.
  • Card Breadboard.
  • Cables For the assembly.
  • 12 resistors electrical 220 ohm.


Arduino assembly

The realization of the circuit assembly is displayed first in the TinkerCad program. But, before doing so, it is necessary connect each led. To do this, you must know what their cathode and anode are. Once you have it clear, you should use pins 2 to 13 to connect each of the 12 LEDs. The anode of each led goes on a certain pin and the cathode will always go to ground.

Keep in mind that you must use a breadboard to help install the LEDs and the circuit by using cables, as well as resistors. After the circuit is armed in TinkerCad, It is time to start with the development of the program in the Arduino IDE. It should be noted that the SDI (Integrated Development Environment or Integrated Development Environment) It is the platform through which the codes are entered.

Arduino IDE

Arduino IDE

  • Select the Arduino board you’re working with, either the Arduino Uno-R3 or Arduino Mega 2560.
  • Press the Serial Port. Under which USB port the Arduino will connect to the computer.

It’s time to code:

  • The first thing to do is give it a name referring to what the code consists of. This is done by symbol // (You can put the title of the practice or the program). Likewise, it can be used as comments within the program.
  • Then you have to declare variables. A vector is created int pinArray[ ]= {2,3…}. The brackets are to indicate that a vector is being declared. Now, to select a specific vector input used pinArray[1] and will result in 3. The vectors in the IDE range from 0 to n.
  • It’s time to declare variables of type integer that define the time it will take to turn on one light and another (waitStart), the number of LEDs that light up simultaneously (tailLength) and the number of leds (lineSize). All three are of type int.
  • Next, in the segment corresponding to void setup each component of the vector is declared pinArray is of the type OUTPUT. It is done compactly using a loop for that goes from 0 until i is less (It) than the number of LEDs.
  • In the segment void setup indicates that the quantity of LEDs indicated in tailLength. Then, through an if statement, it is established that the next one is turned on from the tailLength Led, but the last one in the queue turns off. So on until the end of the number of LEDs is reached.
  • Once the development of the program has been completed, it is necessary compile to check for errors within the encoding. In case there aren’t any, it’s time to load the code onto the Arduino board for it to run.

Note that so that the Arduino IDE understands the commands, a semicolon must be placed at the end of each statement (;). Finally, we share how it looks in code so that you can see how the procedures explained above were reflected in the Arduino IDE.

Let’s see:

List of the best projects with led lights with Arduino that you can do yourself

Thanks to the creation of the arduino, people can let your imagination run wild and make way for a series of projects very interesting.

To give you an idea, below we share a list with the best projects you can do with RGB LEDs and Arduino:

Color cube

Color cube with Arduino

This is a very fun project and it helps you to place it in different spaces. This color cube It can change depending on the time you have or every few seconds. It is ideal to use as a diode lamp and decorate spaces. Regarding its construction, you will need 512 RGB led diodes, a microcontroller which can be a Arduino UNO, a cable or battery to power the diodes, 6 crystals and a base to support the structure.

When you have all the materials, you should join the diodes to form a cube or that resemble said shape. The trick to achieve this is to bend one pin of the diode perpendicular to it, creating a right angle with the other pin. Notably, there will be one side without any connection to each other, but all will be attached to an RGB led diode. After the structure has the desired shape, you have to attach the excess pins to the microcontroller board.

Subsequently, it should be mentioned that the side of this cube must have some 8 x 8 diodes, creating a cube of 8 x 8 x 8 RGB LEDs. In this way, the pins of the diodes that are loose are attached to the board. Then, on the plate is enter a program that turns on progressively and with different colors. When the assembly is ready, the crystals will be used to create a kind of layer that protects and covers the diodes.

Informational sign

This project is more useful than the previous one and serves different purposes. To do it, you will need about 510 RGB Led diodes or you can substitute it for strips of the same type. The goal is to build a rectangle of about 10 x 51 LEDs. You will also need 3 acrylic sheets that will serve as the support and protector for the sign. In addition to that, it also requires cables for wiring, a battery to give power and a microcontroller board. (Arduino UNO).

The way to carry out this project, is to elaborate the structure and place the diodes on it. We recommend using one of the acrylic sheets as a support for the LED lights, since being transparent, the end result will not be appreciated. Then, with a thin cable add the diodes and connect them to the microcontroller. When everything is connected correctly, you must connect the microcontroller to the battery and in it, enter the program you want.

With the program, the following functions will be executed:

  • Turn on determined LEDs.
  • Each diode will have a colour determined.

The result is super interesting, since it is possible to create letters, signs or symbols that can be used in different situations.

Touch table with lights

This last idea is very funny, but it is the most complex of all. In this case, apart from the led lights and the Arduino, use of touch sensors or IR sensors will be used.

The materials with which they are going to work are:

  • Table with transparent surface.
  • 10 x 16 matrix RGB LED diodes.
  • 10 x 16 matrix IR touch sensors.
  • SD or MicroSD card for data storage.
  • Module from Bluetooth.
  • License plate Arduino.
  • Smart speaker with connection by Bluetooth.

First of all, they must create nodes or keys that form the junction of the touch sensor together with the diode, and what will be the controls that will be pressed when playing with the table. Thus, each node can emit information if the panel is touched and subsequently emit a light.

With this mechanism, it will be possible to play tetris, visual memory games, snake, etc. with the table. Total 160 nodes will be used, which can be distributed in the form of a matrix of 10 x 16. This matrix must be placed under the glass of the table. It should be noted that the glass on the table must be replaced by a softer surface such as acrylic plastic. The purpose of this is that the sensor works when pressed.

Once that is done, you have to create the program that works and executes with said matrix. Games such as tetris can be implemented. Just insert it into the board and it connects to the die. To make it even more attractive, sound can be added through a bluetooth speaker that connects to the bluetooth sensor that has the microcontroller board. This is a small summary of these different kind of Arduino projects, so you know everything you can achieve based on these ideas. Definitely, worth a try.