Introduction: 64x32 RGB LED Matrix With Arduino Mega

I enjoyed learning how to use LED matrix and addressable LEDs. They are a lot of fun when you figure out how it comes together. I have put together this tutorial explaining each steps in a simple and coherent manner for others to learn. So enjoy. Let me know if you have any questions.

Supplies

RGB LED Matrix Module 64x32 pixel

Arduino Mega

Jumper Cables

USB Cable

USB power adapter with 2 input plugs

Step 1: The 64x32 RGB LED Matrix Module

Product Name
RGB LED Matrix Module P4 SMD2121 256x128mm 64x32 pixel

Specification
Pixel pitch: 4mm Individual

LED Size: SMD2121 2.1 x 2.1 mm

Indoor full colour Surface Mount Device

Max power consumption: 20W

Avg power consumption: 6.7W

Input voltage: DC5V

Step 2: Connecting the 64x32 LED Matrix Panel With Arduino Mega

Follow the diagram to connect pins to jumper cable connector.

You must attach a 5V power into the power input for the model to display properly. With power only from the board is not enough because some of the LED and colours do not turn on with full brightness.

Reference website: https://learn.adafruit.com/32x16-32x32-rgb-led-ma...

Another instruction with a hookup table - Lots of details. https://learn.adafruit.com/32x16-32x32-rgb-led-ma...

Step 3: Why Use Arduino Mega?

Arduino Mega has 256 KB of flash memory which is suitable for displaying many bitmaps on the LED matrix. The Arduino Uno has only 32KB of flash memory and is limited for use.

  • Arduino Uno - 32 KB Flash Memory
  • Arduino Mega - 256 KB Flash
  • ESP8266 D1 mini - 80 KiB
  • ESP-32S WROOM-32 - 4MiB Flash

Step 4: Programming for the LED Matrix Panel

Download and install Arduino software from the official website.

Install the RGB Matrix Panel library from Arduino library manager or GitHub website.

Install the Adafruit GFX Library from Arduino library manager or GitHub website.

Install Adafruit BusIO from Arduino library manager or GitHub website.

Open up example codes by going to File > Examples > RGB Matrix Panel > Pick from list.

Connect Arduino Mega to computer. Select the correct device and port. Upload and run the code.

Step 5: Setup RGB Matrix Panel Library Examples for the 64x32 Module

The examples in the library were made for smaller LED matrix modules. To run it on the 64x32 module we need to modify the code.

For all the examples in the library:

  • colorwheel_32x32
  • colorwheel_progmem_32x32
  • PanelGFXDemo_16x32
  • plasma_16x32
  • plasma_32x32
  • scrolltext_16x32
  • testcolors_16x32
  • testshapes_16x32
  • testshapes_32x32
  • testshapes_32x64

For each of the examples, the following changes needed to be made.
Add the line:

#define D A3

Modify the line:

RGBmatrixPanel *matrix = new RGBmatrixPanel(A, B, C, CLK, LAT, OE, true);

Adding D after C and 64 after true. The line should be like this.

RGBmatrixPanel *matrix = new RGBmatrixPanel(A, B, C, D, CLK, LAT, OE, true, 64);

Step 6: Convert Bitmap Images for the 64x32 LED Matrix Panel

Convert bitmap image to c file by going here: http://www.rinkydinkelectronics.com/t_imageconver...

Add the bitmap code to the top section.

Add the follow to “void loop() {}” function:

matrix->drawRGBBitmap(0, 0, (const uint16_t *)surface, 64, 32);

matrix->show();

delay(4000);

matrix->clear(); //Set image to black

This function is used to draw the bitmap.
matrix->drawRGBBitmap(x, y, bitmap, w, h);

  • x and y is the position on the board.
  • w and h is the width and height.
  • bitmap is the reference to the bitmap code at the top.

Get my final Arduino code here on GitHub:

Arduino Code on GitHub https://github.com/3DSurfacing/64x32-RGB-LED-Matr...