Introduction

In this project we will see how to do a 3×3 led square in Arduino. This project is essentially aesthetic. We will use Blue leds in this project.

Nevertheless, you can choose another color or a different color for each floor. You can also use RGB LED to have a color which change.

Difficulty

Necessaries Materials

We will see now the necessaries material for this project:

  • Arduino Uno card
  • 18 Blue leds
  • 9 resistors (220 ohms)
  • Wires (a dozen !)

Sketch of this project

What the resistor are useful for?

The resistor is used to protect your leds from a pic of current. If you need to calculate the value of resistor you need , you can find how to do it on our course.

Program of your project

int led_floor_bottom = 11;  // We assign the bottom floor of leds at the pins 11. 
int led_floor_middle = 10;  // We assign the bottom middle of leds at the pins 10. 
int led_floor_top = 9;  // We assign the top floor of leds at the pins 9. 

void setup() {
    pinMode(led_floor_bottom, OUTPUT); // We assign the leds of the bottom floor as an output
  pinMode(led_floor_middle, OUTPUT); //We assign the leds of the middle floor as an output
  pinMode(led_etage_top, OUTPUT); // We assign the leds of the top floor as an output
}

void loop() {
//  to blink the bottom floor 
digitalWrite(led_floor_bottom,HIGH);
delay(200);
digitalWrite(led_floor_bottom,LOW); 
  
 //  to blink the middle floor  
digitalWrite(led_floor_middle,HIGH); 
delay(200);
digitalWrite(led_floor_middle,LOW); 
  
// to blink the top floor  
digitalWrite(led_floor_top,HIGH); 
delay(200);
digitalWrite(led_floor_top,LOW); 
}

Modify the blink of your leds!

Our program permits to blink each floor of the square one by one during 200 ms. Nevertheless this program can be modified for to turn on all the floor in the same time or blink the led quicker of slower by playing with the delay.

How to realize the structure of the square?

At the end of the project you just need to realize the structure of the square to maintain the leds. To do that you have many solutions :
  • Use iron wires which will be connected to the leds
  • Make a structure the 3d printer
  • Make the structure with cardboard and hot glue

Simulation of your project

This is the simulation of the project on Tinkercad: