Pixel LED light for home decoration | Pixel LED circle

Pixel LED light for home decoration | Pixel LED circle

Pixel LED light for home decoration | Pixel LED circle

Welcome to the SriTu Hobby website as usual. Today we are going to talk about a topic that many people like. That is, this tutorial includes step by step how to make a pixel LED circle. Also, mainly Arduino UNO board and WS2811 pixel LED string is used for this. It mainly includes 5 LED patterns. You can mainly apply the knowledge in this tutorial for pixel LED programming.

Structure of this Pixel LED circle

This pixel LED circle has 48 LEDs. That is, it uses a WS2811 pixel LED string containing 50 LEDs. Also, it consists of 4 circles and 12 lines.  We will talk later about how to connect these LEDs. Also, the library called “FastLED.h” is used to control the pixel LEDs. This pixel LED circle contains five patterns using this library.

OK, let’s do this project step by step. The required components are given below.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Firstly, identify these components.

Arduino UNO boardArduino UNO board

WS2811 pixel LED stringWS2811 pixel LED string

Jumper wiresJumper wires

Foam board or cardboardFoam board

5v power supply5v power supply

Step 2

Secondly, draw a circle with a radius of 5.5 on the foam board or cardboard. Afterward, cut it out.draw a circle with a radius of 5.5 on the foam board or cardboard. Afterward, cut it out.

draw a circle with a radius of 5.5 on the foam board or cardboard. Afterward, cut it out.
draw a circle with a radius of 5.5 on the foam board or cardboard. Afterward, cut it out.

Step 3

Thirdly, draw 6 lines at equal distances.draw 6 lines at equal distances.

Step 4

Now, divide these lines into 4 pieces as matching 4 LEDs. divide these lines into 4 pieces as matching 4 LEDs

divide these lines into 4 pieces as matching 4 LEDs

Step 5

Then, dig holes in the places marked above.dig holes in the places marked above

dig holes in the places marked above

Step 6

Afterward, connect the LEDs through these holes. To do this, use the picture below.connect the LEDs through these holes

connect the LEDs through these holes
connect the LEDs through these holes
connect the LEDs through these holes

Step 7

Now, connect this LED string to the Arduino board. For that, use the circuit diagram below.connect this LED string to the Arduino board

Step 8

OK, now let’s creates the program for this project. It is as follows.

  • FastLED Library — Download
  • The complete program of this project – Download
#include <FastLED.h>
#define DATA_PIN 2
#define lines 12
#define circles 4
#define BRIGHTNESS 100
CRGB leds[lines * circles];
#define t 150

void setup() {
  FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, lines * circles);
  FastLED.setBrightness(BRIGHTNESS);

}
void loop() {
  flagcolor(2);
  colorRing(4);
  pattern3(2);
  pattern4(2);
  pattern5(1);
}

int bulb(int L, int C) {
  uint16_t a;
  if (L & 0x01) {
    uint8_t x = (circles - 1) - C;
    a = (L * circles) + x;
  } else {
    a = (L * circles) + C;
  }
  return a;
}

Code explanation

Firstly, the FastLED library is included. Also, data PIN, lines, circles, and LEDs brightness are included.

#include <FastLED.h>
#define DATA_PIN 2
#define lines 12
#define circles 4
#define BRIGHTNESS 100

Next, an array is created for the LED circle. It includes lines and circles. After, the delay time is included.

CRGB leds[lines * circles];
#define t 150

In the setup function, the library is started and the brightness of these pixel LEDs is set.

void setup() {
FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, lines * circles);
FastLED.setBrightness(BRIGHTNESS);

}

The loop function consists of five patterns. They are described one by one below.

void loop() {
flagcolor(2);
colorRing(4);
pattern3(2);
pattern4(2);
pattern5(1);
}

flagcolor(2);

void flagcolor(byte x) {
  for (int a = 0; a < x; a++ ) {
    for (int b = 0; b < 4; b++) {
      leds[bulb(0, b)] = CRGB::Blue;
      leds[bulb(1, b)] = CRGB::Blue;
      leds[bulb(2, b)] = CRGB::Blue;
      leds[bulb(3, b)] = CRGB::Blue;
      leds[bulb(4, b)] = CRGB::Blue;
      leds[bulb(5, b)] = CRGB::Blue;
      leds[bulb(6, b)] = CRGB::Blue;
      leds[bulb(7, b)] = CRGB::Blue;
      leds[bulb(8, b)] = CRGB::Blue;
      leds[bulb(9, b)] = CRGB::Blue;
      leds[bulb(10, b)] = CRGB::Blue;
      leds[bulb(11, b)] = CRGB::Blue;
      FastLED.show();
      delay(t);
    }
    for (int b = 0; b < 4; b++) {
      leds[bulb(0, b)] = CRGB::Yellow;
      leds[bulb(1, b)] = CRGB::Yellow;
      leds[bulb(2, b)] = CRGB::Yellow;
      leds[bulb(3, b)] = CRGB::Yellow;
      leds[bulb(4, b)] = CRGB::Yellow;
      leds[bulb(5, b)] = CRGB::Yellow;
      leds[bulb(6, b)] = CRGB::Yellow;
      leds[bulb(7, b)] = CRGB::Yellow;
      leds[bulb(8, b)] = CRGB::Yellow;
      leds[bulb(9, b)] = CRGB::Yellow;
      leds[bulb(10, b)] = CRGB::Yellow;
      leds[bulb(11, b)] = CRGB::Yellow;
      FastLED.show();
      delay(t);
    }

    for (int b = 0; b < 4; b++) {
      leds[bulb(0, b)] = CRGB::Red;
      leds[bulb(1, b)] = CRGB::Red;
      leds[bulb(2, b)] = CRGB::Red;
      leds[bulb(3, b)] = CRGB::Red;
      leds[bulb(4, b)] = CRGB::Red;
      leds[bulb(5, b)] = CRGB::Red;
      leds[bulb(6, b)] = CRGB::Red;
      leds[bulb(7, b)] = CRGB::Red;
      leds[bulb(8, b)] = CRGB::Red;
      leds[bulb(9, b)] = CRGB::Red;
      leds[bulb(10, b)] = CRGB::Red;
      leds[bulb(11, b)] = CRGB::Red;
      FastLED.show();
      delay(t);
    }
    for (int b = 0; b < 4; b++) {
      leds[bulb(0, b)] = CRGB::White;
      leds[bulb(1, b)] = CRGB::White;
      leds[bulb(2, b)] = CRGB::White;
      leds[bulb(3, b)] = CRGB::White;
      leds[bulb(4, b)] = CRGB::White;
      leds[bulb(5, b)] = CRGB::White;
      leds[bulb(6, b)] = CRGB::White;
      leds[bulb(7, b)] = CRGB::White;
      leds[bulb(8, b)] = CRGB::White;
      leds[bulb(9, b)] = CRGB::White;
      leds[bulb(10, b)] = CRGB::White;
      leds[bulb(11, b)] = CRGB::White;
      FastLED.show();
      delay(t);
    }
    for (int b = 0; b < 4; b++) {
      leds[bulb(0, b)] = CRGB::Orange;
      leds[bulb(1, b)] = CRGB::Orange;
      leds[bulb(2, b)] = CRGB::Orange;
      leds[bulb(3, b)] = CRGB::Orange;
      leds[bulb(4, b)] = CRGB::Orange;
      leds[bulb(5, b)] = CRGB::Orange;
      leds[bulb(6, b)] = CRGB::Orange;
      leds[bulb(7, b)] = CRGB::Orange;
      leds[bulb(8, b)] = CRGB::Orange;
      leds[bulb(9, b)] = CRGB::Orange;
      leds[bulb(10, b)] = CRGB::Orange;
      leds[bulb(11, b)] = CRGB::Orange;
      FastLED.show();
      delay(t);
    }
  }
}

colorRing(4);

void colorRing(int x) {
  for (int a = 0; a < x; a++ ) {
    for (int b = 0; b < 4; b++) {
      leds[bulb(0, b)] = CRGB::Blue;
      leds[bulb(1, b)] = CRGB::Blue;
      leds[bulb(2, b)] = CRGB::Blue;
      leds[bulb(3, b)] = CRGB::Blue;
      leds[bulb(4, b)] = CRGB::Blue;
      leds[bulb(5, b)] = CRGB::Blue;
      leds[bulb(6, b)] = CRGB::Blue;
      leds[bulb(7, b)] = CRGB::Blue;
      leds[bulb(8, b)] = CRGB::Blue;
      leds[bulb(9, b)] = CRGB::Blue;
      leds[bulb(10, b)] = CRGB::Blue;
      leds[bulb(11, b)] = CRGB::Blue;
      FastLED.show();
      delay(100);
      leds[bulb(0, b)] = CRGB::Black;
      leds[bulb(1, b)] = CRGB::Black;
      leds[bulb(2, b)] = CRGB::Black;
      leds[bulb(3, b)] = CRGB::Black;
      leds[bulb(4, b)] = CRGB::Black;
      leds[bulb(5, b)] = CRGB::Black;
      leds[bulb(6, b)] = CRGB::Black;
      leds[bulb(7, b)] = CRGB::Black;
      leds[bulb(8, b)] = CRGB::Black;
      leds[bulb(9, b)] = CRGB::Black;
      leds[bulb(10, b)] = CRGB::Black;
      leds[bulb(11, b)] = CRGB::Black;
      FastLED.show();
      delay(100);
    }
    for (int b = 2; b > 0; b--) {
      leds[bulb(0, b)] = CRGB::Blue;
      leds[bulb(1, b)] = CRGB::Blue;
      leds[bulb(2, b)] = CRGB::Blue;
      leds[bulb(3, b)] = CRGB::Blue;
      leds[bulb(4, b)] = CRGB::Blue;
      leds[bulb(5, b)] = CRGB::Blue;
      leds[bulb(6, b)] = CRGB::Blue;
      leds[bulb(7, b)] = CRGB::Blue;
      leds[bulb(8, b)] = CRGB::Blue;
      leds[bulb(9, b)] = CRGB::Blue;
      leds[bulb(10, b)] = CRGB::Blue;
      leds[bulb(11, b)] = CRGB::Blue;
      FastLED.show();
      delay(100);
      leds[bulb(0, b)] = CRGB::Black;
      leds[bulb(1, b)] = CRGB::Black;
      leds[bulb(2, b)] = CRGB::Black;
      leds[bulb(3, b)] = CRGB::Black;
      leds[bulb(4, b)] = CRGB::Black;
      leds[bulb(5, b)] = CRGB::Black;
      leds[bulb(6, b)] = CRGB::Black;
      leds[bulb(7, b)] = CRGB::Black;
      leds[bulb(8, b)] = CRGB::Black;
      leds[bulb(9, b)] = CRGB::Black;
      leds[bulb(10, b)] = CRGB::Black;
      leds[bulb(11, b)] = CRGB::Black;
      FastLED.show();
      delay(100);
    }
  }
}

pattern3(2);

void pattern3(int x) {
  for (int a = 0; a < x; a++ ) {
    for (int b = 0; b < 12; b++) {
      leds[bulb(b, 0)] = CRGB::Blue;
      leds[bulb(b, 1)] = CRGB::Blue;
      leds[bulb(b, 2)] = CRGB::Blue;
      leds[bulb(b, 3)] = CRGB::Blue;
      FastLED.show();
      delay(t);
    }
    for (int b = 0; b < 12; b++) {
      leds[bulb(b, 0)] = CRGB::Yellow;
      leds[bulb(b, 1)] = CRGB::Yellow;
      leds[bulb(b, 2)] = CRGB::Yellow;
      leds[bulb(b, 3)] = CRGB::Yellow;
      FastLED.show();
      delay(t);
    }
    for (int b = 0; b < 12; b++) {
      leds[bulb(b, 0)] = CRGB::Red;
      leds[bulb(b, 1)] = CRGB::Red;
      leds[bulb(b, 2)] = CRGB::Red;
      leds[bulb(b, 3)] = CRGB::Red;
      FastLED.show();
      delay(t);
    }
    for (int b = 0; b < 12; b++) {
      leds[bulb(b, 0)] = CRGB::White;
      leds[bulb(b, 1)] = CRGB::White;
      leds[bulb(b, 2)] = CRGB::White;
      leds[bulb(b, 3)] = CRGB::White;
      FastLED.show();
      delay(t);
    }
    for (int b = 0; b < 12; b++) {
      leds[bulb(b, 0)] = CRGB::Orange;
      leds[bulb(b, 1)] = CRGB::Orange;
      leds[bulb(b, 2)] = CRGB::Orange;
      leds[bulb(b, 3)] = CRGB::Orange;
      FastLED.show();
      delay(t);
    }
  }
}

pattern4(2);

void pattern4(int x) {
  for (int a = 0; a < x; a++ ) {
    for (int b = 0; b < 11; b++ ) {
      leds[bulb(0 + b, 0)] = CRGB::Yellow;
      leds[bulb(0 + b, 1)] = CRGB::Yellow;
      leds[bulb(0 + b, 2)] = CRGB::Yellow;
      leds[bulb(0 + b, 3)] = CRGB::Yellow;
      leds[bulb(1 + b, 0)] = CRGB::Yellow;
      leds[bulb(1 + b, 1)] = CRGB::Yellow;
      leds[bulb(1 + b, 2)] = CRGB::Yellow;
      leds[bulb(1 + b, 3)] = CRGB::Yellow;
      FastLED.show();
      delay(100);
      leds[bulb(0 + b, 0)] = CRGB::Black;
      leds[bulb(0 + b, 1)] = CRGB::Black;
      leds[bulb(0 + b, 2)] = CRGB::Black;
      leds[bulb(0 + b, 3)] = CRGB::Black;
      leds[bulb(1 + b, 0)] = CRGB::Black;
      leds[bulb(1 + b, 1)] = CRGB::Black;
      leds[bulb(1 + b, 2)] = CRGB::Black;
      leds[bulb(1 + b, 3)] = CRGB::Black;
      FastLED.show();
    }
    for (int b = 0; b < 11; b++ ) {
      leds[bulb(0 + b, 0)] = CRGB::Red;
      leds[bulb(0 + b, 1)] = CRGB::Red;
      leds[bulb(0 + b, 2)] = CRGB::Red;
      leds[bulb(0 + b, 3)] = CRGB::Red;
      leds[bulb(1 + b, 0)] = CRGB::Red;
      leds[bulb(1 + b, 1)] = CRGB::Red;
      leds[bulb(1 + b, 2)] = CRGB::Red;
      leds[bulb(1 + b, 3)] = CRGB::Red;
      FastLED.show();
      delay(100);
      leds[bulb(0 + b, 0)] = CRGB::Black;
      leds[bulb(0 + b, 1)] = CRGB::Black;
      leds[bulb(0 + b, 2)] = CRGB::Black;
      leds[bulb(0 + b, 3)] = CRGB::Black;
      leds[bulb(1 + b, 0)] = CRGB::Black;
      leds[bulb(1 + b, 1)] = CRGB::Black;
      leds[bulb(1 + b, 2)] = CRGB::Black;
      leds[bulb(1 + b, 3)] = CRGB::Black;
      FastLED.show();
    }
    for (int b = 0; b < 11; b++ ) {
      leds[bulb(0 + b, 0)] = CRGB::Blue;
      leds[bulb(0 + b, 1)] = CRGB::Blue;
      leds[bulb(0 + b, 2)] = CRGB::Blue;
      leds[bulb(0 + b, 3)] = CRGB::Blue;
      leds[bulb(1 + b, 0)] = CRGB::Blue;
      leds[bulb(1 + b, 1)] = CRGB::Blue;
      leds[bulb(1 + b, 2)] = CRGB::Blue;
      leds[bulb(1 + b, 3)] = CRGB::Blue;
      FastLED.show();
      delay(100);
      leds[bulb(0 + b, 0)] = CRGB::Black;
      leds[bulb(0 + b, 1)] = CRGB::Black;
      leds[bulb(0 + b, 2)] = CRGB::Black;
      leds[bulb(0 + b, 3)] = CRGB::Black;
      leds[bulb(1 + b, 0)] = CRGB::Black;
      leds[bulb(1 + b, 1)] = CRGB::Black;
      leds[bulb(1 + b, 2)] = CRGB::Black;
      leds[bulb(1 + b, 3)] = CRGB::Black;
      FastLED.show();
    }
  }
}

pattern5(1);

void pattern5(int x) {
  for (int a = 0; a < x; a++ ) {
    for (int b = 0; b < 12; b++) {
      leds[bulb(b, 0)] = CRGB::Blue;
      leds[bulb(b, 1)] = CRGB::Blue;
      leds[bulb(b, 2)] = CRGB::Blue;
      leds[bulb(b, 3)] = CRGB::Blue;
      FastLED.show();
      delay(100);
    }
    for (int b = 11; b >= 0; b--) {
      leds[bulb(b, 0)] = CRGB::Black;
      leds[bulb(b, 1)] = CRGB::Black;
      leds[bulb(b, 2)] = CRGB::Black;
      leds[bulb(b, 3)] = CRGB::Black;
      FastLED.show();
      delay(100);
    }

    for (int b = 0; b < 12; b++) {
      leds[bulb(b, 0)] = CRGB::Yellow;
      leds[bulb(b, 1)] = CRGB::Yellow;
      leds[bulb(b, 2)] = CRGB::Yellow;
      leds[bulb(b, 3)] = CRGB::Yellow;
      FastLED.show();
      delay(100);
    }
    for (int b = 11; b >= 0; b--) {
      leds[bulb(b, 0)] = CRGB::Black;
      leds[bulb(b, 1)] = CRGB::Black;
      leds[bulb(b, 2)] = CRGB::Black;
      leds[bulb(b, 3)] = CRGB::Black;
      FastLED.show();
      delay(100);
    }

    for (int b = 0; b < 12; b++) {
      leds[bulb(b, 0)] = CRGB::Red;
      leds[bulb(b, 1)] = CRGB::Red;
      leds[bulb(b, 2)] = CRGB::Red;
      leds[bulb(b, 3)] = CRGB::Red;
      FastLED.show();
      delay(100);
    }
    for (int b = 11; b >= 0; b--) {
      leds[bulb(b, 0)] = CRGB::Black;
      leds[bulb(b, 1)] = CRGB::Black;
      leds[bulb(b, 2)] = CRGB::Black;
      leds[bulb(b, 3)] = CRGB::Black;
      FastLED.show();
      delay(100);
    }

    for (int b = 0; b < 12; b++) {
      leds[bulb(b, 0)] = CRGB::White;
      leds[bulb(b, 1)] = CRGB::White;
      leds[bulb(b, 2)] = CRGB::White;
      leds[bulb(b, 3)] = CRGB::White;
      FastLED.show();
      delay(100);
    }
    for (int b = 11; b >= 0; b--) {
      leds[bulb(b, 0)] = CRGB::Black;
      leds[bulb(b, 1)] = CRGB::Black;
      leds[bulb(b, 2)] = CRGB::Black;
      leds[bulb(b, 3)] = CRGB::Black;
      FastLED.show();
      delay(100);
    }

    for (int b = 0; b < 12; b++) {
      leds[bulb(b, 0)] = CRGB::Orange;
      leds[bulb(b, 1)] = CRGB::Orange;
      leds[bulb(b, 2)] = CRGB::Orange;
      leds[bulb(b, 3)] = CRGB::Orange;
      FastLED.show();
      delay(100);
    }
    for (int b = 11; b >= 0; b--) {
      leds[bulb(b, 0)] = CRGB::Black;
      leds[bulb(b, 1)] = CRGB::Black;
      leds[bulb(b, 2)] = CRGB::Black;
      leds[bulb(b, 3)] = CRGB::Black;
      FastLED.show();
      delay(100);
    }
  }
}

Full program of this project — Download

Step 9

Now, select board and port. After, upload this code to the Arduino board.select board and port. After, upload this code to the Arduino board.

select board and port. After, upload this code to the Arduino board.
select board and port. After, upload this code to the Arduino board.

Step 10

Lastly, connect the 5v power supply as the circuit diagram above. OK, enjoy this project. The full video guide is given below. So, we will meet in the next tutorial.connect the 5v power supply as the circuit diagram above. OK, enjoy this project

Pixel LED light for home decoration | Pixel LED circle

 

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *