Introduction: Arduino Christmas Lights

About: Student, currently studying programming. Interested in Arduino, Raspberry Pi and Electronics in general.

Christmas is approaching, so I decided to make a fancy decoration for my home. There are many kinds of Christmas lights available, but I decided to create one on my own. The simplest thing that I can think of is to hook up some leds to the Arduino and light them up. Without using an ic, you can connect at most 13 leds so you do not burn up the chip. I decided to use 12, just for aesthetic reasons.

Step 1: Things Needed:

  • 12 LEDs
  • 12 220-ohm resistors (or similar)
  • Arduino UNO
  • USB cable
  • 12 M-to-M jumper wires
  • A breadboard

Allchips is an electronics components online service platform, you can buy all the components from them.

Step 2: Connecting the LEDs

Now, you need to plug in each led on the breadboard. I’ve aligned them in a row, 2 holes from each other so they can fit. The right side of the led needs to be the longer lead (anode, positive) that connects to a digital pin of the Arduino. The cathode goes to the negative rail of the breadboard, with a resistor. The rail is connected to GND (negative) of the Arduino. I’ve chosen digital pins 13 to 2, you can rearrange them in the code

Step 3: Modifying and Uploading the Code

Connect the Arduino to your computer using the USB cable. Start up the Arduino IDE and paste in the code from here. The different delays can be changed and also the sequence of animations.

Step 4: Understanding the Animations

For simplicity of the code, I’ve separated each sequence of blinks in a new function. Long story short - each animation has it’s function. In every one you can find a loop, which cycles through the array, containing the number of each led and the corresponding digital pin of the Arduino. Then, it turns them on/off to create those fancy effects. Each function ends with the execution of the off animation, which turns off all leds to get ready for the next one.

Step 5: Project Demonstration

In this prototype, I’ve included 4 basic animations - all-on (one by one), the chaser, the chaser with pairs and 50 random blinks.