Gravity: I2C 8x16 RGB LED Matrix
Panel SKU: DFR0522
Introduction
Single color dot matrix LED displays are common in the market while small RGB displays are in
short supply. This Gravity: I2C 8x16 RGB LED Matrix Panel produced by DFRobot has 7 colors and
more than 20 images in default, supporting user-defined image setting. It can also show Numbers,
Letters and Symbols, and support display scroll. Controlled by IIC agreement, Gravity: I2C 8x16
RGB LED Matrix Panel is easy to connect and convenient to control. Just a special Arduino library
can accomplish all designs, which totally free from complex wiring and codes. It can be widely
applied to projects like robots, smart home monitoring systems and toy cars…
Specification
•
•
•
•
•
•
Operating Voltage: 5.0V
Operating Current: ≤150mA
Communication: IIC/I2C
LED Backlight: RGB Adjustable (7 colors)
Operating Temperature: 0-70℃
Size: 2.44in x 1.06in (62mm x 27mm)
PinOut
Gravity-I2C 8x16 RGB LED Matrix Panel Back
Num
Label
Description
1
+
+
2
-
-
3
C
IIC Clock Line
4
D
IIC Data Line
Built-in Images
Gravity-I2C 8x16 RGB LED Matrix Panel Built-in Images
Colors
Gravity-I2C 8x16 RGB LED Matrix Panel Colors
Library Functions
Print String
Prototype:void print(String ,unsigned char color)
•
•
•
•
•
•
•
•
•
•
•
Function: Print a string in the panel.
Parameters:
String: string, with “ ” enclosed
Color: color to show
Red: RED
Green: GREEN
Yellow: YELLOW
Blue: BLUE
Purple: PURPLE
Cyan: CYAN
White: WHITE
E.g.
#include
#include
DFRobot_RGBPanel panel;
void setup() {
}
void loop() {
panel.print("DF1", BLUE); //Display DF1 in BLUE
}
Print Numbers and Variables
Prototype:void print(int val,unsigned char color)
•
•
•
•
•
•
•
•
•
•
•
Function: Print Numbers and Variables in the plane.
Parameters:
Val: int values or int variables
Color: color to show
Red: RED
Green: GREEN
Yellow: YELLOW
Blue: BLUE
Purple: PURPLE
Cyan: CYAN
White: WHITE
E.g.
#include
#include
DFRobot_RGBPanel panel;
void setup() {
}
void loop() {
int a=12;
panel.scroll(Left);
panel.print(a, BLUE); //Print variable a in BLUE.
while(1);
}
Scroll Display
Prototype:void scroll(unsigned char dir)
•
•
•
Function: Scroll Display
Parameters:
Scroll in left: Left
•
•
Scroll in right: Right
Stop scroll: None
E.g.
#include
#include
DFRobot_RGBPanel panel;
void setup() {
}
void loop() {
panel.scroll(Left);
//Set to scroll in left
panel.print("DFRobot", BLUE); //Show "DFRobot" in BLUE
while(1);
}
Display Pixels
Prototype:void pixel(unsigned char x,unsigned char y,unsigned char color)
•
•
•
•
•
•
•
•
•
•
•
•
Function: Spicify a pixel to show
Parameters:
x:pixel position in x direction(value:0~7)
y:pixel position in y direction(value:0~15)
Color: color to show
Red: RED
Green: GREEN
Yellow: YELLOW
Blue: BLUE
Purple: PURPLE
Cyan: CYAN
White: WHITE
E.g.
#include
#include
DFRobot_RGBPanel panel;
void setup(){
Serial.begin(9600);
}
// Set the 1st LED to off, other 7 LEDs show GREEN, YELLOW, BLUE, PURPLE, CYA
N, WHITE respectively.
void loop(){
panel.pixel(0,0,QUENCH);
panel.pixel(0,1,RED);
panel.pixel(0,2,GREEN);
panel.pixel(0,3,YELLOW);
panel.pixel(0,4,BLUE);
panel.pixel(0,5,PURPLE);
panel.pixel(0,6,CYAN);
panel.pixel(0,7,WHITE);
}
Clear Display
Prototype:void clear();
•
Function: Clear the display.
•
Parameters: None
E.g.
#include
#include
DFRobot_RGBPanel panel;
void setup(){
}
//Show"DF1"in the panel and flash in every second.
void loop(){
panel.print("DF1", BLUE);
delay(1000);
panel.clear();
delay(1000);
}
Show All
Prototype:void fillScreen(unsigned char color)
•
•
•
•
•
•
•
•
•
•
Function:
Parameters:
Color: color to show
Red: RED
Green: GREEN
Yellow: YELLOW
Blue: BLUE
Purple: PURPLE
Cyan: CYAN
White: WHITE
E.g.
#include
#include
DFRobot_RGBPanel panel;
void setup(){
}
//Fill in the display panel in BLUE and flash in every second.
void loop(){
panel.fillScreen(BLUE);
delay(1000);
panel.clear();
delay(1000);
}
Show Built-in Images
Prototype:void display(unsigned char picIndex,unsigned char color)
•
•
•
•
•
•
•
•
•
•
Function: show built-in 23 images in the display panel, number as 0~22.
Parameters:
Color: color to show
Red: RED
Green: GREEN
Yellow: YELLOW
Blue: BLUE
Purple: PURPLE
Cyan: CYAN
White: WHITE
E.g.
#include
#include
DFRobot_RGBPanel panel;
void setup(){
Serial.begin(9600);
}
//Show No.3 image in RED and flash in every second.
void loop(){
panel.display(3,RED);
delay(1000);
panel.clear();
delay(1000);
}
Tutorial
Connect hardware accoridng to the PinOut instruction, download Sample Code to the DFRduino
UNO R3 (or similar), upload successfully. Then RGB Maxtrix colorful effect could be seen.
Requirements
•
•
•
•
Hardware
DFRduino UNO R3 (or similar) x1
Gravity: I2C 8x16 RGB LED Matrix Panel x1
IIC Data Line x1
•
•
Software
Arduino IDE (Version requirements: V1.6.+), Click to Download Arduino IDE from Arduino®
Connection Diagram
Sample Code
Click to download libraries and examples.
How to install Libraries in Arduino IDE.
/*!
* file DFRobot_RGBPanel_IIC_demo.ino
*
* connect RGBPanel and Arduino ,then download this example
*
* Copyright
[DFRobot](http://www.dfrobot.com), 2016
* Copyright
GNU Lesser General Public License
*
* version
* date
V0.1
2017-11-15
*/
#include
#include
DFRobot_RGBPanel panel;
void setup() {
}
void loop() {
String s = "DFRobot";
//Define the string"DFRobot"
panel.clear();
//Clear the display.
panel.fillScreen(RED); //Fill in the display in RED for 2s.
delay(2000);
panel.clear();
//Clear the display.
panel.fillScreen(GREEN); //Fill in the display in GREEN.
delay(2000);
//Show GREEN for 2s.
panel.clear();
panel.fillScreen(BLUE); //Fill in the display in BLUE for 2s.
delay(2000);
panel.clear();
panel.scroll(Left);
//Set to scroll in left
panel.print(s, RED); //Show "DFRobot" in RED
while(1);
}
Expected Results
Result: Fill in RGB LED Panel in RED, GREEN and BLUE respectively, and show ”DFRobot”.
More Documents
•
Hardware Design Resource
https://www.dfrobot.com/wiki/index.php/Gravity:_I2C_8x16_RGB_LED_Matrix_Panel_SKU:_DFR0522 6-5-18