The WS2812B RGB Matrix 16x16 (Manufacturer Part ID: WS2812B-16x16-Matrix) is a high-performance LED matrix manufactured by Worldsemi. It consists of 256 individually addressable RGB LEDs arranged in a 16x16 grid. Each LED is capable of displaying 24-bit color, allowing for vibrant and dynamic lighting effects. The matrix is controlled via a single data line, making it easy to integrate into various projects.
Below are the key technical details for the WS2812B RGB Matrix 16x16:
Parameter | Value |
---|---|
Manufacturer | Worldsemi |
Part ID | WS2812B-16x16-Matrix |
LED Count | 256 (16x16 grid) |
LED Type | WS2812B (RGB, individually addressable) |
Input Voltage | 5V DC |
Power Consumption | ~60mA per LED (max brightness, white) |
Communication Protocol | Single-wire (based on NRZ) |
Data Input Pin | DIN (Data In) |
Data Output Pin | DOUT (Data Out) |
Refresh Rate | Up to 400 Hz |
Operating Temperature | -25°C to +80°C |
Dimensions | 160mm x 160mm |
The WS2812B RGB Matrix 16x16 has three main pins for operation:
Pin Name | Description | Notes |
---|---|---|
VCC | Power supply input (5V DC) | Connect to a stable 5V power source |
GND | Ground | Common ground for power and data |
DIN | Data input | Connect to the microcontroller's data output pin |
DOUT | Data output (optional) | Used to daisy-chain multiple matrices |
Below is an example of how to control the WS2812B RGB Matrix 16x16 using the Adafruit NeoPixel library:
#include <Adafruit_NeoPixel.h>
// Define the number of LEDs in the matrix
#define NUM_LEDS 256
// 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 the matrix with a rainbow effect
rainbowCycle(10); // Call the rainbowCycle function with a delay of 10ms
}
// Function to create a rainbow effect across the matrix
void rainbowCycle(uint8_t wait) {
uint16_t i, j;
for (j = 0; j < 256; j++) { // Cycle through all colors
for (i = 0; i < matrix.numPixels(); i++) {
// Calculate the color for each LED
matrix.setPixelColor(i, Wheel((i + j) & 255));
}
matrix.show(); // Update the matrix with new colors
delay(wait); // Wait before the next update
}
}
// Helper function to generate rainbow colors
uint32_t Wheel(byte WheelPos) {
WheelPos = 255 - WheelPos;
if (WheelPos < 85) {
return matrix.Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else if (WheelPos < 170) {
WheelPos -= 85;
return matrix.Color(0, WheelPos * 3, 255 - WheelPos * 3);
} else {
WheelPos -= 170;
return matrix.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}
}
No LEDs Lighting Up:
Flickering or Incorrect Colors:
Matrix Not Responding to Code:
Q: Can I cut the matrix into smaller sections?
A: Yes, the matrix can be cut along the designated lines, but you must ensure proper reconnection of power and data lines for the remaining sections.
Q: How do I daisy-chain multiple matrices?
A: Connect the DOUT pin of the first matrix to the DIN pin of the next. Update the NUM_LEDS
value in your code to reflect the total number of LEDs.
Q: What is the maximum distance for the data line?
A: For reliable operation, keep the data line under 1 meter. Use a level shifter or buffer for longer distances.
Q: Can I power the matrix directly from the Arduino?
A: No, the Arduino cannot supply enough current. Use an external 5V power supply capable of handling the matrix's power requirements.