

The WS2812 RGB LED Matrix 5x8 (Manufacturer Part ID: WS2812B-25P) by Adafruit is a compact and versatile LED matrix consisting of 40 individually addressable RGB LEDs arranged in a 5x8 grid. Each LED is capable of producing 24-bit color, allowing for vibrant and dynamic displays. The matrix is controlled via a single data line, making it easy to integrate into microcontroller-based projects.








| Parameter | Value |
|---|---|
| Manufacturer | Adafruit |
| Part ID | WS2812B-25P |
| LED Count | 40 LEDs (5x8 grid) |
| LED Type | WS2812B (RGB, individually addressable) |
| Operating Voltage | 5V DC |
| Operating Current | ~60mA per LED at full brightness |
| Communication Protocol | One-wire (single data line) |
| Data Input Voltage | 3.3V or 5V logic compatible |
| Dimensions | ~50mm x 80mm |
| Refresh Rate | ~400Hz |
The WS2812 RGB LED Matrix has three main pins for operation:
| Pin Name | Description | Notes |
|---|---|---|
| VCC | Power supply input (5V) | Connect to a 5V power source |
| GND | Ground | Connect to the ground of the circuit |
| DIN | Data input | Connect to the microcontroller's data output pin |
VCC pin to a stable 5V power source and the GND pin to the ground. Ensure the power supply can handle the current requirements (up to 2.4A for all LEDs at full brightness).DIN pin to a digital output pin of your microcontroller. Use a resistor (330-470Ω) in series with the data line to protect the LEDs from voltage spikes.VCC and GND pins to stabilize the power supply.Below is an example of how to control the WS2812 RGB LED Matrix using the Adafruit NeoPixel library:
#include <Adafruit_NeoPixel.h>
// Define the number of LEDs in the matrix
#define NUM_LEDS 40
// Define the pin connected to the DIN pin of the matrix
#define DATA_PIN 6
// Create a NeoPixel object
Adafruit_NeoPixel matrix = Adafruit_NeoPixel(NUM_LEDS, DATA_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
matrix.begin(); // Initialize the NeoPixel library
matrix.show(); // Turn off all LEDs initially
}
void loop() {
// Example: Light up all LEDs in red
for (int i = 0; i < NUM_LEDS; i++) {
matrix.setPixelColor(i, matrix.Color(255, 0, 0)); // Set LED to red
}
matrix.show(); // Update the matrix to display the colors
delay(1000); // Wait for 1 second
// Example: Turn off all LEDs
for (int i = 0; i < NUM_LEDS; i++) {
matrix.setPixelColor(i, matrix.Color(0, 0, 0)); // Turn off LED
}
matrix.show(); // Update the matrix to turn off LEDs
delay(1000); // Wait for 1 second
}
LEDs Not Lighting Up
Flickering or Incorrect Colors
Matrix Not Responding to Commands
Q: Can I power the matrix with a USB port?
A: While possible, it is not recommended to power the matrix via USB if running many LEDs at high brightness, as USB ports typically provide only 500mA. Use a dedicated 5V power supply for best results.
Q: How do I chain multiple matrices together?
A: Connect the DOUT pin of the first matrix to the DIN pin of the next matrix. Update the NUM_LEDS value in your code to reflect the total number of LEDs.
Q: Can I control the matrix with a 3.3V microcontroller?
A: Yes, the WS2812B is compatible with 3.3V logic. However, for long data lines, a level shifter may be required for reliable operation.