Pixel LED 7 Ws2812




In this project, we will build a Pixel LED Seven Segment Display using 28 WS2812B addressable LEDs (4 LEDs per segment × 7 segments).

We will control it using Arduino and make it count from 0 to 9 automatically.


Instead of using traditional 7-segment modules, we are creating a custom digital display using RGB LEDs, which allows color change, brightness control, and animation effects.


🧰 Components Required


Arduino Uno

28 × WS2812B / NeoPixel LEDs

330Ω resistor (recommended on data line)

1000µF capacitor (recommended across 5V & GND)

5V power supply

Wires


        --- A ---
     |                 |
     F             B
     |                 |
        --- G ---
     |                 |
     E             C
     |                 |
        --- D ---


Project wiring order  { F, A, B, C, D, E, G }

LED Index mapping:

Segment LED Index Range


F 0–3

A 4–7

B 8–11

C 12–15

D 16–19

E 20–23

G 24–27


Arduino UNO

--------------

5V   → LED VCC

GND  → LED GND

D14  → LED DATA (through 330Ω resistor)


Add:

1000µF capacitor between 5V and GND (important for stability)

Common GND required



What is WS2812 Pixel LED

WS2812 is a type of individually addressable RGB LED with a built-in driver IC. It’s widely used in LED strips, matrices, and pixel displays due to its ease of control and vibrant color output. Here's a quick breakdown:




🔧 Technical Overview

  • Type: RGB LED (Red, Green, Blue)
  • Controller: Built-in WS2811 IC inside the LED package
  • Voltage: Typically 5V DC
  • Control: Single data line (one-wire communication)
  • Protocol: Proprietary timing-based protocol (not standard I2C/SPI)
  • Daisy-chaining: LEDs are connected in series, and each one passes the data to the next

💡 Key Features

  • Individually addressable: Each LED can be set to a different color/brightness.
  • Simple wiring: Just 3 wires — VCC, GND, and Data In
  • Fast refresh rate: Good for animations and smooth effects
  • Compact: Comes in small SMD packages like 5050

📦 Common Forms

  • LED strips (e.g., 30, 60, 144 LEDs/meter)
  • LED rings, panels, and matrices
  • Single LED modules for DIY projects

⚙️ Control Options

  • Controlled using microcontrollers like:
    • Arduino
    • ESP8266 / ESP32
    • Raspberry Pi
  • Libraries:
    • FastLED
    • Adafruit NeoPixel

  • Circuit Diagram



-------------------------------------------------------------------------------------------------------------------------
// Arduino Code by Manmohan Pal

#include <Adafruit_NeoPixel.h>

#define LED_PIN     14
#define NUM_LEDS    28     // 7 segments × 4 LEDs
#define BRIGHTNESS  60
#define LEDS_PER_SEG 4

Adafruit_NeoPixel strip(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);

// Segment order: {F, A, B, C, D, E, G}
// 1 = ON, 0 = OFF

byte digits[10][7] = {

  // F  A  B  C  D  E  G
  {1, 1, 1, 1, 1, 1, 0}, // 0
  {0, 0, 1, 1, 0, 0, 0}, // 1
  {0, 1, 1, 0, 1, 1, 1}, // 2
  {0, 1, 1, 1, 1, 0, 1}, // 3
  {1, 0, 1, 1, 0, 0, 1}, // 4
  {1, 1, 0, 1, 1, 0, 1}, // 5
  {1, 1, 0, 1, 1, 1, 1}, // 6
  {0, 1, 1, 1, 0, 0, 0}, // 7
  {1, 1, 1, 1, 1, 1, 1}, // 8
  {1, 1, 1, 1, 1, 0, 1}  // 9
};

void setup() {
  strip.begin();
  strip.setBrightness(BRIGHTNESS);
  strip.show();
}

void loop() {

  for (int num = 0; num <= 9; num++) {

    for (int seg = 0; seg < 7; seg++) {

      for (int led = 0; led < LEDS_PER_SEG; led++) {

        int ledIndex = seg * LEDS_PER_SEG + led;

        if (digits[num][seg] == 1) {
          strip.setPixelColor(ledIndex, strip.Color(0, 255, 0)); // GREEN
        } else {
          strip.setPixelColor(ledIndex, strip.Color(0, 0, 0));    // OFF
        }

      }
    }

    strip.show();
    delay(1000);
  }
}
---------------------------------------------------------------------------------------------------------------------------


No comments:

Post a Comment

Wifi Home automation Diy kit

 Wifi Home automation Diy kit By Manmohan Pal Wifi Home Automation Kit Hi, This is Manmohan Pal, I am glad to present a DIY kit for Home Aut...