Arduino Easy Smart Home Series: 12 LED Light Chaser

Arduino Easy Smart Home Series: 12 LED Light Chaser

Make your LEDs dance in style! 🎉 This project lets you control 8 single-color LEDs with 10 unique patterns. Perfect for beginners and smart home enthusiasts, this chaser adds dynamic lighting effects to your setup and teaches you loops, arrays, and timing in Arduino.

Table of Contents

  • Introduction
  • Required Hardware
  • Arduino IDE Setup
  • Wiring the Components
  • Arduino Code
  • How It Works
  • Testing Your Project
  • Advanced Modifications
  • Common Issues and Troubleshooting
  • Learning Insights
  • Conclusion

1. Introduction

This 8 LED Light Chaser project is a fun and educational way to learn Arduino programming. It cycles through 10 different LED patterns, including forward, reverse, ping-pong, random blink, symmetrical, and Knight Rider styles. Ideal for beginners, it helps understand arrays, loops, and timing, while also being visually satisfying for decorative purposes or smart home setups.

2. Required Hardware

  • Arduino UNO (Approx. ₹2,100)
  • 8 Single-color LEDs (Approx. ₹850)
  • Resistors 220Ω for each LED pin (Approx. ₹420)
  • Jumper Wires (Approx. ₹420)
  • Breadboard (Approx. ₹850)
  • USB Cable for Arduino (Approx. ₹420)
  • Arduino IDE installed on your PC

3. Arduino IDE Setup

  1. Download and install the latest Arduino IDE from the official Arduino website.
  2. Connect your Arduino board to your PC via USB.
  3. Open Arduino IDE and select your board and COM port under Tools.

4. Wiring the Components

Follow these steps to wire the LEDs:

  • Connect each LED anode to digital pins 2–13 through a 220Ω resistor.
  • Connect all LED cathodes to GND.
  • Ensure wires are secure and resistors are correctly placed to avoid overcurrent.

5. Arduino Code

Upload this code to your Arduino to see all 10 styles in action:

// Compact 13-LED Chaser – 10 Styles

const int ledPins[] = {2,3,4,5,6,7,8,9,10,11,12,13};
const int numLEDs = sizeof(ledPins)/sizeof(ledPins[0]);
int style = 0;

void setup() {
  for(int i=0;i<numLEDs;i++) pinMode(ledPins[i], OUTPUT);
  randomSeed(analogRead(0));
}

void loop() {
  switch(style){
    case 0: styleForward(); break;
    case 1: styleReverse(); break;
    case 2: stylePingPong(); break;
    case 3: styleAlternating(); break;
    case 4: styleAllOnOff(); break;
    case 5: styleRandom(); break;
    case 6: styleSymIn(); break;
    case 7: styleSymOut(); break;
    case 8: styleKnight(); break;
    case 9: styleFastBlink(); break;
  }
  style = (style+1)%10;
}

void blink(int i){ digitalWrite(ledPins[i], HIGH); delay(100); digitalWrite(ledPins[i], LOW); delay(100); }
void onOffAll(){ for(int i=0;i<numLEDs;i++) digitalWrite(ledPins[i], HIGH); delay(100); for(int i=0;i<numLEDs;i++) digitalWrite(ledPins[i], LOW); delay(100); }

// 1. Forward
void styleForward(){ for(int i=0;i<numLEDs;i++) blink(i); }
// 2. Reverse
void styleReverse(){ for(int i=numLEDs-1;i>=0;i--) blink(i); }
// 3. Ping Pong
void stylePingPong(){ styleForward(); styleReverse(); }
// 4. Alternating
void styleAlternating(){ for(int i=0;i<numLEDs;i+=2) digitalWrite(ledPins[i], HIGH); delay(200); for(int i=0;i<numLEDs;i++) digitalWrite(ledPins[i], LOW); }
// 5. All On/Off
void styleAllOnOff(){ onOffAll(); }
// 6. Random
void styleRandom(){ blink(random(0,numLEDs)); }
// 7. Symmetrical Inward
void styleSymIn(){ for(int i=0;i<numLEDs/2;i++){ digitalWrite(ledPins[i], HIGH); digitalWrite(ledPins[numLEDs-1-i], HIGH); delay(150); digitalWrite(ledPins[i], LOW); digitalWrite(ledPins[numLEDs-1-i], LOW); } }
// 8. Symmetrical Outward
void styleSymOut(){ for(int i=numLEDs/2-1;i>=0;i--){ digitalWrite(ledPins[i], HIGH); digitalWrite(ledPins[numLEDs-1-i], HIGH); delay(150); digitalWrite(ledPins[i], LOW); digitalWrite(ledPins[numLEDs-1-i], LOW); } }
// 9. Knight Rider
void styleKnight(){
  for(int i=0;i<numLEDs;i++){ digitalWrite(ledPins[i], HIGH); if(i>0) digitalWrite(ledPins[i-1], LOW); delay(100); }
  for(int i=numLEDs-2;i>0;i--){ digitalWrite(ledPins[i], HIGH); digitalWrite(ledPins[i+1], LOW); delay(100); }
}
// 10. Fast Blink
void styleFastBlink(){ onOffAll(); }

6. How It Works

The Arduino controls the LEDs through digital pins. Each style defines a pattern, e.g., forward, reverse, ping-pong, alternating, symmetrical, random blink, and Knight Rider. Loops and arrays allow sequential control, while delay() sets the speed of the patterns. Cycling through the 10 styles creates dynamic, visually appealing lighting.

7. Testing Your Project

  1. Upload the code to your Arduino.
  2. Ensure the LEDs are wired correctly and powered.
  3. Observe all 10 patterns in sequence.
  4. Adjust delay values if you want faster or slower effects.

8. Advanced Modifications

  • Add a button to manually switch between styles.
  • Integrate a light sensor to trigger the chaser at night.
  • Use shift registers to control more than 13 LEDs.
  • Combine multiple chasers for a larger smart home display.

9. Common Issues and Troubleshooting

  • LED not lighting up – Check wiring and resistors.
  • Flickering LEDs – Ensure stable power supply.
  • Wrong pattern – Verify pin mapping and loop logic.

10. Learning Insights

  • Understanding arrays and loops in Arduino.
  • Digital output control and timing with delay().
  • Designing multiple LED patterns with a single program.
  • Hands-on experience in creating visual effects for smart home applications.

11. Conclusion

The 13 LED Chaser with 10 styles is a fun and educational Arduino project for beginners and smart home enthusiasts. It demonstrates arrays, loops, and timing, while offering visually appealing effects for decoration or practical purposes. Experiment with delays, sequences, and combinations to create your own custom patterns and expand your smart home lighting skills!

By Kaushal Haladi

Comments

Popular Posts