Pandabyte RGB LED Strip Module: Programming Guide

by pandabyte in Circuits > Arduino

23 Views, 0 Favorites, 0 Comments

Pandabyte RGB LED Strip Module: Programming Guide

ws2812rgb.png

Pandabyte RGB LED Strip Module is an addressable LED module used for learning programmable RGB lighting effects with microcontrollers such as Arduino compatible boards, ESP32, or Raspberry Pi Pico.

The module contains:

  1. 10 × WS2812B addressable RGB LEDs
  2. 1 × Push Button Switch

Each WS2812B LED can be individually controlled to generate colorful lighting animations and effects.

The onboard push button can be used for interactive control applications.

A key feature of this module is that it supports two connection methods:

  1. Traditional 4-pin header for standard jumper-wire connections
  2. OR
  3. 4-pin Grove connector for quick plug-and-play prototyping

The push button is designed to work in:

  1. INPUT_PULLUP mode

This means:

  1. Button released → HIGH
  2. Button pressed → LOW

In this guide, you will learn:

  1. Module pin configuration
  2. WS2812B LED strip control
  3. RGB color effects
  4. Push button input handling
  5. Circuit connections and Arduino programming examples


Supplies

item list.png

Hardware:

  1. PandaByte RGB LED Strip Module
  2. Development Board (We will use PandaByte xC3m ESP32C3 Dev board)
  3. Grove Shield/Expansion Board
  4. Cables: Dupont, USB, and Grove

Software:

  1. Arduino IDE
  2. FastLED Library
  3. https://github.com/FastLED/FastLED

Circuit Connections

ws2812.png

Perform the connection based on the table.

Install the Library

  1. Open Arduino IDE
  2. Go to:
  3. Sketch → Include Library → Manage Libraries
  4. Search for:
  5. FastLED
  6. Install the library

Programming

Program 1: RGB Color Changing Effect

Change the entire LED strip color continuously.

#include <FastLED.h>

#define LED_PIN 0
#define NUM_LEDS 10

CRGB leds[NUM_LEDS];

void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
}

void loop() {
// RED
fill_solid(leds, NUM_LEDS, CRGB::Red);
FastLED.show();
delay(1000);

// GREEN
fill_solid(leds, NUM_LEDS, CRGB::Green);
FastLED.show();
delay(1000);

// BLUE
fill_solid(leds, NUM_LEDS, CRGB::Blue);
FastLED.show();
delay(1000);

// YELLOW
fill_solid(leds, NUM_LEDS, CRGB::Yellow);
FastLED.show();
delay(1000);

// PURPLE
fill_solid(leds, NUM_LEDS, CRGB::Purple);
FastLED.show();
delay(1000);

// WHITE
fill_solid(leds, NUM_LEDS, CRGB::White);
FastLED.show();
delay(1000);
}

Program 2: LED Strip ON/OFF Control.

Using Push Button Use the push button to toggle the LED strip ON and OFF.

#include <FastLED.h>

#define LED_PIN 0
#define SWITCH_PIN 1
#define NUM_LEDS 10

CRGB leds[NUM_LEDS];

bool ledState = false;
bool lastButtonState = HIGH;

void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
pinMode(SWITCH_PIN, INPUT_PULLUP);
}

void loop() {

bool currentButtonState = digitalRead(SWITCH_PIN);

// Detect button press
if(lastButtonState == HIGH && currentButtonState == LOW) {

ledState = !ledState;

if(ledState) {
fill_solid(leds, NUM_LEDS, CRGB::Blue);
}
else {
fill_solid(leds, NUM_LEDS, CRGB::Black);
}

FastLED.show();
delay(200);
}

lastButtonState = currentButtonState;
}

Output

Program 1: RGB Color Changing Effect

  1. The entire LED strip will continuously change colors including:
  2. RED
  3. GREEN
  4. BLUE
  5. YELLOW
  6. PURPLE
  7. WHITE

Program 2: LED Strip ON/OFF Control Using Push Button

  1. Pressing the button will:
  2. turn ON the LED strip
  3. turn OFF the LED strip

Important Info

The module uses:

  1. 10 × WS2812B addressable RGB LEDs
  2. 1 × Push Button

WS2812B LEDs use a single-wire digital communication protocol.

Each LED can be individually controlled.

The RGB signal pin must be connected to a digital GPIO pin.

The switch pin should be configured using:

  1. INPUT_PULLUP

WS2812B LEDs typically require a stable 3.3V/5V power supply.