Mini Arduino LED Christmas Lights

Introduction: Mini Arduino LED Christmas Lights

About: Hi, this page is about robotics, electronics, embedded systems, drones, RC and other cool DIY stuff. I aim to manufacture robots & electronics. To see the projects I am developing, visit my github: https:/…

Are you looking for a simple electronics project to get some practice with Arduino and PWM? Try this out!

What you need can be found on eBay (links below):

1 x Arduino UNO + USB cable

6 x Colour LED's of your choice (I used 3 red, 3 yellow)

6 x 1k Resistors

8 x Male-to-male jumper cables (I used 6 orange ones for the PWM signals and 2 for GND)

4 x Short breadboard wires to make common grounds from the LED's

1 x Mini prototyping breadboard

The 1k resistors are probably overkill, you can use less ohmage for more brightness. Just be careful not to draw more than 40mA per output pin or sink more than 200mA per ground pin.

Step 1: Wire Up the Circuit As Shown in the Image:

***NOTE: the LED cathodes (i.e. the pin at the flat edge) are negative, so they connect to ground. Wiring the LED's in reverse might destroy your Arduino.***

Step 2: Copy or Download the Code Below & Upload to Arduino

6 LED Christmas Lights

This example shows how to fade six LED's on the pwm pins

using the analogWrite() function.

This concept code is based on the single led 'fade' example sketch.


int ledPin1 = 3; // first LED on pin 3

int ledPin2 = 5; // second LED on pin 5

int ledPin3 = 6; // third LED on pin 6

int ledPin4 = 9; // fourth LED on pin 9

int ledPin5 = 10; // fifth LED on pin 10

int ledPin6 = 11; // sixth LED on pin 11

int brightness1 = 0; // minimum brightness

int brightness2 = 255; // maximum brightness

int fadeAmount = 51; // how many points to fade the LED by

// the setup routine runs once when you press reset:

void setup() {

// declare led pins to be outputs:

pinMode(ledPin1, OUTPUT);

pinMode(ledPin2, OUTPUT);

pinMode(ledPin3, OUTPUT);

pinMode(ledPin4, OUTPUT);

pinMode(ledPin5, OUTPUT);

pinMode(ledPin6, OUTPUT); }

// the loop routine runs over and over again forever:

void loop() {

// set the brightness of LED's:

analogWrite(ledPin1, brightness1);

analogWrite(ledPin2, brightness2);

analogWrite(ledPin3, brightness1);

analogWrite(ledPin4, brightness2);

analogWrite(ledPin5, brightness1);

analogWrite(ledPin6, brightness2);

// change the brightness for next time through the loop:

brightness1 = brightness1 + fadeAmount;

brightness2 = brightness2 - fadeAmount;

// reverse the direction of the fading at the ends of the fade:

if (brightness1 == 0 || brightness1 == 255){

fadeAmount = -fadeAmount;


// wait for 30 milliseconds to see the dimming effect



Step 3: Done!

If you found this instructable useful, why not stay tuned for future projects by following me on Instructables and on Facebook / Twitter / Google+.

If you enjoyed this instructable and would like to see more like this, please consider supporting me by purchasing your materials for this project through the affiliate links in the materials section or donating below:

Bitcoin: 1Mqe7et24Lz4DY1RUN4iAQVHkvJsdFArKR

Ethereum: 0x6d8248db1cdea6a783cb6b41ae67bb8e6144f479

Litecoin: LW6PWESqsr8xHw6EJ9WLbsQsAyTvPnwnxJ

Dash: Xemv7jud697v8tQmKfNFoMxfkd17ZayH2t

Your support is greatly appreciated! Happy DIY'ing!

Be the First to Share


    • Lamps Challenge

      Lamps Challenge
    • CNC and 3D Printing Contest

      CNC and 3D Printing Contest
    • Puzzles Challenge

      Puzzles Challenge



    Question 2 years ago on Step 1

    Will the code work on a mega and I’ll just use the 12 pwm I/O can you show me how to wire 12 leds on a mega with code please thank you


    Answer 1 year ago

    Hi Rickstar2020, I don't have an arduino mega but I assume it would work just the same if you assign more analog pins in the code, just assign more pins and write to them following the pattern I've set out in my code above.
    To answer your other question about using more than 12 leds:
    I think you only really need 2 pins because there are only two brightness values in the code: brightness1 and brightness2 and half the leds have brightness1 and the other half have brightness2. If you wire half your leds in series to one pin (assign a value of brightness1) and half in series to another pin (assign it a value of brightness2) you can have more leds flashing in the same manner as this project but you may need to lower your resistor values so you have enough current running to power each led's then you don't even need a mega, an uno will be sufficient but keep in mind that microcontroller pins have a maximum current output, you have to find the datasheet of your specific microcontroller / development board to get that number.
    A better setup would be use 2 pins controlling some transistors which power your two strands of leds, then you aren't capped to microcontroller pin current limits. I can only give you this basic idea to point you in the right direction you'll need to search how to use transistors as that is your best option to control a large number of any kinds of loads (leds, motors, etc) using a microcontroller.


    Question 2 years ago on Introduction

    Can you have more leds on the arduino for example 12 or more leds or is there a way to use the arduino with something else to get 12 or more leds going thank you