Acoptex.Com

Learn ESP32, ESP8266, Arduino, and Raspberry Pi

Disco lights or Flowing LED Lights

In this project we will use LEDs to create flowing LED lights. Eight LEDs in a row successively light up and dim one after another, just like flowing water.

Basics: Project 012d

Project name: Disco lights or Flowing LED Lights

Sketch: sketch 

Libraries:

  • None

In this project, you needed these parts :

1.Arduino Uno R3 (you can also use the other version of Arduino)

2.Arduino IDE ( you can download it from here  )

3.Jumper cables

4. LED 8 pcs (different colors)

5. Resistor 8 pcs (220 Om)

6. Breadboard

Signals and connections of LED

The operating voltage of the LED is 1.8V and the operating current is 10mA-20mA. The Arduino Uno board can supply 5V or 3.3V power. We will use 5V for this project, so the minimum resistance of the current limiting resistor should be (5 V to 1.8 V)/20 = 160 Om. The 220 Om offered in the kit is suitable and you can also choose other resistors that meet the condition. The larger the resistance is, the dimmer the LED will get.

Wiring

The following picture shows the needed connections with the Arduino Uno 

Code

We simply need to turn on eight LEDs in turn. The eight LEDs are connected to pin 2-pin 9 respectively. Set them as High level and the corresponding LED at the pins will light up. Control the time of each LED brightening and you will see flowing LED lights.

Set an integer variable to int, and set pin2-pin9 as OUTPUT respectively. 

In code, we set the pin 2 to pin 9 as HIGH, then pin 9 to pin 2 as LOW, then pin 9 to pin 2 as HIGH, then pin 2 to pin 9 as LOW. 

Step by Step instruction

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your Arduino Uno board into your PC and select the correct board and com port
  4. Open up serial monitor and set your baud to 9600 baud
  5. Verify and upload the the sketch to your Arduino Uno board
  6. You should see 8 LEDs brighten one by one from the LED connected to pin 2 to that to pin 9, and then dim in turn from the LED at pin 9 to the one at pin 2. After that, the LEDs will light up from the LED at pin 9 to that at pin 2 and dim from the LED at pin 2 to that at pin 9. 
  7. This whole process will repeat until the circuit is powered off.

Summary

We have learned how to light up and dim one after another LEDs in row, just like flowing water.

 

Check for more DIY projects on Acoptex.lt and Acoptex.com!

If you are looking for high quality PCBs PCBWay is the best choice: