Introduction

Gravity: Digital RGB LED Module is a cascadable single RGB LED module compatible with RGB LED strip. The Gravity interface provides a more elegant manner for the connections between modules and most of mainstream controllers such as Arduino, micro:bit, Firebeetle Series, LattePanda, and Raspberry Pi with an abundant kinds of DFRobot IO expansion shield. Compared to the traditional RGB LED module, where three control signal pins are required for a single LED, this module only needs one signal pin for all LEDs in cascade. Thanks to such individual module design, RGB LED strip built by such independent modules can realize extremely low power consumption per meter compared to traditional RGB LED strip. And such feature makes it possible to cascade more than 100 modules with a total length up to several tens of meters but power requirement no more than 5V 2A. This also makes it much simpler and more flexible to configure the length of an RGB LED strip, without the need of cutting a RGB LED strip or soldering every LED pieces.

The module adopts the same high-brightness RGB LED in the traditional RGB LED strip, inheriting its excellent display performance and is fully compatible with the driving circuit or program. This requires little changes for existing programs to shift from RGB LED strip to RGB LED module string. Have fun with this tiny RGB LED module by cool effects of flashing, rainbow, even letters, pictures or animations.

Features

Application

Specification

Board Overview


No. Label Description
1 - Power supply GND
2 + Power supply VCC(3.3~5.3V)
3 DI Control data signal input
4 DO Control data signal output

Arduino Tutorial

This tutorial presents a basic usage of the module with Arduino UNO.

Requirements

Connection Diagram


Sample Code


#include <Adafruit_NeoPixel.h>

#define PIN_LED 3     // Control signal, connect to DI of the LED
#define NUM_LED 1     // Number of LEDs in a strip

// Custom colour1: Yellow
#define RED_VAL_1       255
#define GREEN_VAL_1     255
#define BLUE_VAL_1      0

// Custom colour2: Purple
#define RED_VAL_2       255
#define GREEN_VAL_2     0
#define BLUE_VAL_2      255

// Custom colour3: Cyan
#define RED_VAL_3       0
#define GREEN_VAL_3     255
#define BLUE_VAL_3      255

// Custom colour4: White
#define RED_VAL_4       255
#define GREEN_VAL_4     255
#define BLUE_VAL_4      255

Adafruit_NeoPixel RGB_Strip = Adafruit_NeoPixel(NUM_LED, PIN_LED, NEO_GRB + NEO_KHZ800);

void setup() {
  RGB_Strip.begin();
  RGB_Strip.show();
  RGB_Strip.setBrightness(128);    // Set brightness, 0-255 (darkest - brightest)
}

void loop() {

  colorWipe(RGB_Strip.Color(255, 0, 0), 1000);  // Red
  colorWipe(RGB_Strip.Color(0, 255, 0), 1000);  // Green
  colorWipe(RGB_Strip.Color(0, 0, 255), 1000);  // Blue

  colorWipe(RGB_Strip.Color(RED_VAL_1, GREEN_VAL_1, BLUE_VAL_1), 1000);   // Custom colour1: Yellow
  colorWipe(RGB_Strip.Color(RED_VAL_2, GREEN_VAL_2, BLUE_VAL_2), 1000);   // Custom colour2: Purple
  colorWipe(RGB_Strip.Color(RED_VAL_3, GREEN_VAL_3, BLUE_VAL_3), 1000);   // Custom colour3: Cyan
  colorWipe(RGB_Strip.Color(RED_VAL_4, GREEN_VAL_4, BLUE_VAL_4), 1000);   // Custom colour4: White

  rainbow(20);  // Rainbow
}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint16_t wait) {
  for (uint16_t i = 0; i < RGB_Strip.numPixels(); i++) {
    RGB_Strip.setPixelColor(i, c);
    RGB_Strip.show();
    delay(wait);
  }
}

void rainbow(uint8_t wait) {
  uint16_t i, j;

  for (j = 0; j < 256; j++) {
    for (i = 0; i < RGB_Strip.numPixels(); i++) {
      RGB_Strip.setPixelColor(i, Wheel((i + j) & 255));
    }
    RGB_Strip.show();
    delay(wait);
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if (WheelPos < 85) {
    return RGB_Strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if (WheelPos < 170) {
    WheelPos -= 85;
    return RGB_Strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
    WheelPos -= 170;
    return RGB_Strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}

Results

Applications

Employ the drawing software palette to display a desired color

In the sample code above, we set a color by first configuring the values of three primary colors

// Custom colour
#define RED_VAL       255
#define GREEN_VAL     255
#define BLUE_VAL      255

and then call the function

Color (RED_VAL, GREEN_VAL, BLUE_VAL);    // Set brightness, 0-255 (darkest - brightest)

But how to determine these RGB value for a specific color. This can be simply achieved by using drawing software "Paint" of the OS (take WIN10 as an example). The steps are as follows:


Module cascade

 #define NUM_LED 1     // Number of LEDs in a strip

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get DFR0605 Gravity: Digital RGB LED Module from DFRobot Store or DFRobot Distributor.

Turn to the Top