Arduino Lesson 4: The Light Show – Create a Multi-Colored Display!

In this lesson, we’ll expand our project by using multiple LEDs to create a dazzling light show! Get ready to experiment with different colors and patterns.

Objective: Learn how to create a colorful light show using multiple LEDs.

Materials:

  • Arduino Uno board
  • Breadboard
  • Multiple LEDs (different colors)
  • 220-ohm resistors (one for each LED)
  • Jumper wires
  • Computer with Arduino IDE software installed
  1. Review: Recap previous lessons and components.
  2. Building the Circuit: Connect multiple LEDs with resistors to the breadboard and Arduino board. Each LED should be connected to a different digital output pin.
  3. Programming the Show: Write a program to control the LEDs, making them blink in different sequences, colors, and patterns. Encourage creativity and exploration.

Step 1: Connecting the LEDs and Resistors

  1. Connect each LED and resistor as you did in Lesson 1: Make sure each LED’s longer leg is connected to a power rail and the resistor’s other leg is connected to the same row as the LED’s shorter leg.
  2. Connect each LED’s longer leg to a different digital output pin on the Arduino: We’ll use pins 13, 12, and 11 in this example.

Step 2: Programming the Arduino

  1. Open the Arduino IDE.
  2. Copy and paste the following code (adjust the pin numbers if you’re using different pins):
const int ledPins[] = {13, 12, 11}; // LED pins

void setup() {
  for (int i = 0; i < 3; i++) {
    pinMode(ledPins[i], OUTPUT); // Set all LED pins as output
  }
}

void loop() {
  digitalWrite(ledPins[0], HIGH); // Turn LED 1 on
  digitalWrite(ledPins[1], LOW); // Turn LED 2 off
  digitalWrite(ledPins[2], LOW); // Turn LED 3 off
  delay(500);
  
  digitalWrite(ledPins[0], LOW); // Turn LED 1 off
  digitalWrite(ledPins[1], HIGH); // Turn LED 2 on
  digitalWrite(ledPins[2], LOW); // Turn LED 3 off
  delay(500);

  digitalWrite(ledPins[0], LOW); // Turn LED 1 off
  digitalWrite(ledPins[1], LOW); // Turn LED 2 off
  digitalWrite(ledPins[2], HIGH); // Turn LED 3 on
  delay(500);
}
  1. Upload the code to the Arduino board.

Step 3: Observe the Light Show

  • You should see the LEDs turn on one at a time, creating a simple light show sequence.

Congratulations! You’ve created a multi-colored light display!

Let’s Experiment:

  • Change the colors: Use LEDs of different colors to create a more colorful show.
  • Modify the pattern: Change the delay() values and the order of digitalWrite() commands to create different patterns.
  • Add more LEDs: Connect more LEDs to create even more complex light shows!

Next Steps:

  • Explore more advanced concepts like sensors, motors, and communication protocols.
  • Encourage independent projects and problem-solving with Arduino.
  • Introduce online resources and communities for further learning and inspiration.

Remember:

  • Safety First: Always supervise children during activities involving electricity.
  • Make it Fun: Keep the learning process engaging and encourage creative exploration.
  • Build Confidence: Celebrate achievements and encourage perseverance in problem-solving.

Have fun creating your own light shows and unleash your creativity with Arduino!