Contributors:
jimblom IntroductionAre you looking to add a lot of color to your project? These massive RGB LED panels are an awesome place to start. You can create animations, games, or all sorts of other fun displays with them. Depending on the manufacturer, these panels can come in different sizes, LED pitch, and scan rates. Here are the ones that SparkFun currently carries in the catalog:
These 32x32 RGB LED panels are an awesome place to start to add color to a project! You can create animations, games, or usef…
RGB LED Matrix Panel - 32x64 COM-14718These 32x64 RGB LED panels are an awesome place to start to add color to a project! You can create animations, games, or usef…
Retired Warning:Due to the limitations of the Arduino library used in this tutorial, a 64x64 RGB LED matrix panel will
notwork with a standard Arduino (Arduino Uno with Atmega328P, etc). You will need a Teensy, Raspberry Pi, FPGA, or a development board that has a higher processing speed and memory. Try looking at the
Resources and Going Furtherat the end of this tutorial for more information on alternatives to drive the 64x64 panels.
RGB LED Matrix Panel - 64x64 COM-14824These 64x64 RGB LED panels are an awesome place to start to add color to a project! You can create animations, games, or usef…
Retired Note:The 16x32 version has been retired from our catalog, but we are keeping the information in the tutorial for reference.
RGB LED Panel - 16x32 COM-12583Are you looking to add a lot of color to your project? These large 32x16 RGB LED panels are an awesome place to start. You ca…
RetiredIn this tutorial we'll show you just how, exactly, these panels operate. We'll dig into the hardware hookup and examine how to best power them. Then we'll work up a demo sketch and control them with Arduino.
A 16x32 RGB LED panel to the left, and a 32x32 panel to the right.
Required MaterialsOn top of either size panel, you'll also need:
Before following along with this tutorial, we recommend reading through these tutorials first:
What is an Arduino?What is this 'Arduino' thing anyway? This tutorials dives into what an Arduino is and along with Arduino projects and widgets.
Light-Emitting Diodes (LEDs)Learn the basics about LEDs as well as some more advanced topics to help you calculate requirements for projects containing many LEDs.
Powering the Panel Power ConnectorWarning! Don't use the 5V supply from your Arduino. Those are only spec'ed to supply about 800mA, and the Arduino's already eating into that capacity a bit.
These panels require a regulated 3.3-5V supply for power. And that supply needs to be able to source a good amount of current -- up to 2A in the worst case (all pixels bright, hot, white). For a 32x64, one of these panels was pulling about ~3.36A-3.43A without a heat sink -- so about up to 4A worst case. A 4-pin (2 for VCC, 2 for GND), 0.15"-pitch polarized connector should be used to supply power to the panel. Depending on the manufacturer, the color and location of the power connector may be different.
Power CableIncluded with the panel is a dedicated cable for power. It's a 0.15" pitch 4-pin polarized connector. The included cable is terminated with both a female polarized connector, and a pair of spade terminals.
Here are a few methods we've used to power the panel. If you are powering the Arduino with a different voltage, make sure to connect GND in order to have the same reference voltage.
Longer-Term: 12V/5V Power Supply Breakout BoardThis is our recommended combo:
Your final connection should look similar to the closeup of the connection below with the LED panel's forked spade connector and wires inserted into the screw terminals.
Longer-Term: 12V/5V Power Supply Splicing WiresYou can also splice the wires using the following combinations:
The ingredients for our power supply and cable.
To begin, we snipped the spade connectors off of the panel power supply cable. And then stripped the newly unterminated ends.
Then we spliced the Molex pigtail to the LED panel's power cable by connecting the red wires together. Do the same for the black wires (make sure you use the black wire next to the red on the Molex pigtail). Make sure you are connecting to the 5V and GND pins and NOT the 12V pin. Before connecting to the RGB Matrix Panel, test the connection with a multimeter.
Spliced Wires
Finally, cover the splice with heat shrink or electrical tape, and voila! That's a beautiful power cable.
Finished panel power supply cable.
This is a nice, sturdy interface between the panel and a solid power supply. If you're looking for something easier, but less reliable check the below option.
Long-Term: Mean Well Switching Power SupplyFor those that want to push the panels to the limit (i.e. setting the pixels on a 32x64 panel at full white at maximum capacity), combine:
Grab a 5V wall adapter. Both been tested to work with the panels as well. At least in the short term.
Use the power supply in conjunction with a female barrel jack adapter and screwdriver to get a quick and dirty connection between the spade and barrel jack.
The final connection should look like the image below.
Hardware HookupBefore we can get into the code portion, there's quite a bit of wiring to do. The RGB panels have a pair of 16-pin (2x8) IDC connectors, and we need to wire up to most of those pins. Conveniently, both panels have the connector pins labeled (the unlabeled pins are ground). As we're hooking up to the panel, make sure you use the connector labeled Input. The labeling may be slightly different depending on the manufacturer.
Connector labels on a 32x32 panel. 16x32 has the same layout, except that D is a no connect (NC) instead. 32x64 has the same layout but no labels.
Note to 16x32 Panel Users: The 32x16 panel has the exact same pinout as the 32x32, except there is no "D" pin. Instead of "D", that pin (12 on the connector) is a no connect (NC), you can leave it alone.
Labels on 32x64 and 16x32 Panel Users:On top of that, some panels do not have labels on the connector pins -- instead there is an
arrow (◄) indicating pin 1, in the top-left corner of the connector (it's obscured by the frame, but visible if you peek in at the right angle). That pin 1 arrow indicator points to the "R0" pin, and the pinout follows that of the 32x32 panel from there. We have also seen panels come with their pins label
G1, G2, R1, R2, B1 & B2instead of
G0, G1, R0, R1, B0 & B1. The wiring will be the same for both cases by connecting to the connector on the left.
Hookup TableHere are the pin connections between LED panel connector and Arduino:
Panel Pin Label Cable Connector Pin # Arduino Uno (Atmega328P)For a more step-by-step approach, follow along below. We use male-to-male premium jumper wires to wire between the included ribbon cable and our Arduino.
Connect Data Pins: R0, B0, G0, R1, G1, and B1These LED driver (shift register) data pins are hard-coded in the Arduino library and can't be moved. As listed in the table above, R0, G0, B0, R1, G1, and B1 go to the Arduino Uno's pins 2 through 7 respectively. If you're wiring the panel up to an Arduino Mega, these pins should be connected to pins 24-29 respectively.
For reference when wiring the pins, try looking down at the IDC connector with red wire on top. The cable connector's pin 1 is relative to the top right. If you look really closely at the molding, you may also arrow (◄) pointing to that pin. Also, note that the tab for polarity is on the right side on either end of the cable.
IDC Connector Highlighted w/ Arrow Pointing to Pin 1
Tip: The odd numbered pins will be along the right side with the polarity marker and the tab. The pin holes on the left will be even numbered. Depending on the manufacturer, you may have received a black connector instead of a grey.
Once you decide what side to connect, start wiring pin 1 by connecting a red wire for R0. Then connect pin 2 by connecting a green wire for G0. After connecting pin 3 using a blue wire for B0, continue wiring the pins based on the hookup table.
To help keep track of what side you are connecting to, feel free to label your connections with a marker.
Connecting the Clock PinThis is the last pin that has some restriction on where it can go -- it must be connected to one of Arduino's port B pins. That means it must be either 8, 9, 10, 11, 12, or 13. The example code has it defined as pin 11 in the hookup table. Make sure to check your pin definition for the clock as it may vary with the code you are using.
Connecting to A, B, C, (D for 32x32 users), OE, and STB PinsThese five (or six if you're using a 32x32 matrix) pins can be plugged in anywhere you may have space on your Arduino. Although, there's probably not a lot of room left... We chose to stick A, B, and C in pins A0, A1, and A2 respectively. OE connects to pin 9. STB to pin 10. And, if you're using a 32x32 matrix, D goes to A3 as stated in the hookup table.
Feel free to swap those up if your application requires. Just make sure you switch it up in the example code too.
Connecting to Ground(s) PinsLast, but certainly not least (well, maybe, if we're talking about potential) is ground. There are three unlabeled pins on the connector which should all be tied to ground.
If you don't have anything else plugged into them, there should be three ground pins available on your Arduino. If you're struggling to find ground pins, though, you should be able to get away with only plugging one of the ground pins to your Arduino. Woo color coded wires!
PowerOnce you are finished connecting the LED panel to an Arduino, add your 5V power supply to the panel's power connector. Don't forget to add power to your Arduino!
Connecting to 32x64 RGB LED PanelsFor anyone connecting to the 32x64 RGB Panels, you will need to use an Arduino Mega 2560 with the library. Otherwise, the panels will not be able to display as expected due to the limitations of the library and the Arduino Uno.
To daisy chain two 32x32 RGB matrices together, connect another IDC cable from the output of the first panel to the input of the second panel. Then connect the second 4-pin polarized connector to the input power connector. After modifying the test_shapes_32x64.ino, the display will output as a 32x64 matrix as shown below.
Heads up! When daisy chaining the RGB LED matix panels, make sure that they have the same scan rate!
Here's an example with the 32x64 matrix with 4mm pitch.
When using an array higher than 32x64, another library would be a better option with a Teensy 3.0+, FPGA, or Raspberry Pi. You may need to level shift to convert 3.3V to 5V for the RGB LED panel to recognize the I/O signals. For more information, check out the links in the Resources and Going Further.
Custom Shield AdapterIf you have a prototyping shield, try making a custom shield adapter for a more secure connection. Here's an example of using an XBee shield's prototyping area with the connection specifically for the RGB LED panels. Follow the steps outlined above but solder the connection together.
Magnetic MountsDepending on the supplier, you may receive a set of magnetic mounts. Add it to the panel's mounting holes to stick on a fridge or metal wall! They also work great as a standoff. Just make sure to secure and insulate your wires to prevent any shorts if there is metal behind the panel.
Arduino Library InstallationNote: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.
Compatibility: The 16x32 works at a 1:8 scan rate. The 32x32 and 32x64 examples work with a 1:16 scan rate. Depending on the manufacturer, there may be different scan rates for the the LED Matrix Panels. Using different scan rates with the example code may cause unexpected behaviors.
Our example code is going to make use of Adafruit's most excellent RGBMatrixPanel library, which also requires their AdafruitGFXLibrary. You can obtain these libraries through the Arduino Library Manager by searching for those names. Or you can manually install them can by grabbing both of them [RGBMatrixPanel and AdafruitGFXLibrary] from their GitHub repositories.
For your convenience, we packaged those libraries with the serial paint example code used in the tutorial:
Library ExamplesThe RGBMatrixPanel library includes a number of fun examples to help show how the library can be used. They're awesome. Check them out under the File_ > Examples > _RGBMatrixPanel menu in Arduino. (Definitely check out the Plasma_16x32 or Plasma_32x32 examples!). Make sure to adjust the code based on your hardware hookup. In this tutorial, we physically connected the clock pin to 11. Therefore, you need to adjust the defined CLK pin from
language:c
// If your 32x32 matrix has the SINGLE HEADER input,
// use this pinout:
#define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega)
#define OE 9
#define LAT 10
#define A A0
#define B A1
#define C A2
#define D A3
to:
language:c
// If your 32x32 matrix has the SINGLE HEADER input,
// use this pinout:
#define CLK 11 // MUST be on PORTB! (Use pin 11 on Mega) <---CHANGE!
#define OE 9
#define LAT 10
#define A A0
#define B A1
#define C A2
#define D A3
32x32 Examples for 32x64:
You can also use the "
..._32x32.ino" examples in the
RGBmatrixPanellibrary by adjusting the code for the 32x64 RGB matrix panels (i.e.
colorwheel_32x32,
plasma_32x32, etc). Just add the number "
64
" as a parameter when creating an instance of the RGBmatrixPanel class:
RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 64);
This Arduino library and example used in this tutorial has been tested for 16x32 (w/ 1:8 scan rate), 32x32 (w/ 1:16 scan rate), and 32x64 (w/ 1:16 scan rate) panels. When using a larger matrix (such as the 64x64 RGB LED matrix panel), you will need a development board that has a higher processing speed and memory due to the limitations of the library used in this tutorial. Try looking at the
Resources and Going Furtherat the end of this tutorial for more information on alternatives to drive a larger matrix.
Serial PaintWe wanted to write another fun sketch that provided an interactive way to explore with the panels and the Arduino library. What we came up with is a serial-controlled paint program. With this sketch, you can use the serial monitor (or, better yet, another terminal program) to control a cursor and draw on the matrix.
Download and unzip the sketch included in the zipped libraries using the link below if you have not already.
• Selecting You LED Matrix SizeBefore uploading, make sure the sketch is set up to work with your panel where it says:
language:c
/* - One of these should be commented out!
- Also, make sure to adjust the saved image in the <bitmap.h> file.*/
/* ========== For 32x64 LED panels: ==========
You MUST use an Arduino Mega2560 with 32x64 size RGB Panel */
//RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 64); // 32x64
/* ========== For 32x32 LED panels: ========== */
RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false); // 32x32
/* ========== For 32x16 LED panels: ========== */
//RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false); // 32x16
By default, the Serial Paint example uses the 32x32. If you are using 32x64, make sure to uncomment the following line by removing the "//
"
language:c
//RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 64); // 32x64
Then comment out the following line by adding a "//
" at the beginning of the line.
language:c
RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false); // 32x32
• Selecting the Saved Bitmap Image
Make sure to also uncomment/comment out the bmp[]
array in the bitmap.h file by removing and adding "/*
" and "*/
" for your respective size.
Once you have adjusted the code to your screen, upload it to the Arduino! After upload, a single pixel should be blinking at the top left of the panel. It doesn't look like much, but that's a good sign.
Using the SketchTo control the program, open up your serial terminal to 9600 bps. Try hitting sending l
(lowercase 'L') through the serial monitor, which should load the demo bitmap. You can send E
(uppercase) to erase the screen.
The idea of this sketch is: move the cursor around to draw pixels, shapes, or text. Here are the commands made available by the sketch (they are case-sensitive):
w
, a
, s
, d
(up, down, left, right)Spacebar
e
E
f
R
(values between 0 [off] and 7 [most bright])r
G
/g
B
/b
z
(copies a color under the cursor)v
to place starting point. Then move cursor to endpoint and press v
again.x
or X
to place first corner. Then move your cursor to where you want the diagonal corner. Then press either x
for an empty box, or X
for a filled box.c
or C
to place the center of the circle. Then move your cursor to where you want the outside edge of your circle to be. Then press c
for an empty circle or C
for a filled circle.t
to go to text mode. Now any characters received will be displayed on the panel. It'll wrap around from one line to the next, but not from bottom to top. Press `
(above Tab / left of 1) to exit text mode.p
to print an array of your drawing to the serial terminal. You can copy this, and put it back in your sketch if you want to load it again.l
to load a pre-defined array from the sketch. The sketch includes a demo array, which was created from the print command. Follow this example to load your own drawings!Give the paint sketch a try! See if you can make the next great Lite-Brite LED Panel picture. If you make something neat, share it with us! Don't laugh. I drew that SFE flame one pixel at a time! Here are our creations:
Try modifying the code to change the color and move around the matrix using potentiometers and buttons. You can see it in action in our product showcase:
Resources and Going FurtherNow that you know how to make use of these beautiful RGB LED matrices, what nifty project are you going to create with them? Here are some more resources, if you need them:
Looking for a faster processor and more memory to drive RGB LED matrices? Try looking at the SmarLED Shield for Teensy.
Try making a hover pong game with the 32x32 RGB LED Matrix using a gesture sensor and the SmartLED Shield. The example code can be found in the GitHub repo HoverPong.
Need some inspiration for your next project? Check out some of these related tutorials:
RGB Panel JumbotronThis tutorial will show you how to combine a webcam, a 32x32 RGB LED panel, and a Teensy 3.1 to stream video from the webcam, pixelate it, and display it on the LED panel - LIVE.
If you're looking for even more inspiration or more stuff to learn, check out these tutorials:
LightLight is a useful tool for the electrical engineer. Understanding how light relates to electronics is a fundamental skill for many projects.
LED Light Bar HookupA quick overview of SparkFun's LED light bars, and some examples to show how to hook them up.
Marquee Party BagThis tutorial provides everything you need to know to make your own Marquee Party Bag!
Or check out this blog post for ideas. Remember, since the 1:8 scan rate 32x32 RGB LED Panel is a SparkX product, support is limited. There is a useful modified Arduino library specifically for a panel with 1:8 scan rate.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4