How can I control dot matrix

I would like to connect a dot matrix of P2 320*128 to Arduino Mega.
At this time, the connector uses HUB75E.

Pin maps and usage example codes are included in the link below.

If you follow it, nothing comes up, so you can't check it.

Just in case, I've also tried the RGB matrix panel example, but it's not possible..

Is there something wrong?

Hi, @wykim
Welcome to the forum.

Have you actually built it and tried the code?
If so please post your code, using code tags and can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

How are you powering the panel?
Can you please tell us your electronics, programming, arduino, hardware experience?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

"P2 320x128" is not a clear definition of the panel, please indicate a pixel dimensions (like 64x64) and scans (like 1/32).
The photo of rear side of panel also may helps.

[EDIT] These links are now dead

Look for these lines in the link you provided...

Demo

It's 1/64 scan, and I attach a picture of the back of the panel.

// testshapes demo for RGBmatrixPanel library.
// Demonstrates the drawing abilities of the RGBmatrixPanel library.
// For 64x64 RGB LED matrix.

// WILL NOT FIT on ARDUINO UNO -- requires a Mega, M0 or M4 board

#include "RGBmatrixPanel.h"

#include <string.h>
#include <stdlib.h>

// Most of the signal pins are configurable, but the CLK pin has some
// special constraints.  On 8-bit AVR boards it must be on PORTB...
// Pin 11 works on the Arduino Mega.  On 32-bit SAMD boards it must be
// on the same PORT as the RGB data pins (D2-D7)...
// Pin 8 works on the Adafruit Metro M0 or Arduino Zero,
// Pin A4 works on the Adafruit Metro M4 (if using the Adafruit RGB
// Matrix Shield, cut trace between CLK pads and run a wire to A4).

//#define CLK  8   // USE THIS ON ADAFRUIT METRO M0, etc.
//#define CLK A4 // USE THIS ON METRO M4 (not M0)
#define CLK 11 // USE THIS ON ARDUINO MEGA
#define OE   9
#define LAT 10
#define A   A0
#define B   A1
#define C   A2
#define D   A3
#define E   A4

RGBmatrixPanel matrix(A, B, C, D, E, CLK, LAT, OE, false, 64);
//Configure the serial port to use the standard printf function

void setup()
{
  Serial.begin(115200);
  matrix.begin();
  delay(500);

  matrix.setTextSize(1);     // size 1 == 8 pixels high
  matrix.setCursor(1, 2);  //32= half
  matrix.setTextColor(matrix.Color333(7,0,0)); //Yellow = 7,7,0 // violet = 7,0,7 black = 0,0,0 white = 7,7,7
  matrix.println("Spin");
}



void loop()
{
  // Do nothing -- image doesn't change
}



The code I used.

The pin map used.

@wykim
Your panel has a size 128x64, and to work with it you need a controller with a 12K RAM at least. Arduino Mega has 8K RAM only, so it is no way to control this matrix with Mega.
You need something like ESP32, RP2040 or stm32 boards.

By the way, could you show a types of chips UG1, UR1 and UU1, UU2 ?

...or you can use a SD card to store images.
It appears to accept 16 bit bitmap in 5R6G5B format.

Edit: This size shouldn't be a problem with a SD card. I use one on a 320x480 TFT with a Mega.
That's a 64x64 16 bit bitmap. I can do those in Gimp.

Edit2: I took a look at the library used by the examples. It's Adafruit_GFX. Same library I use for the TFT. It has a drawPixel() function that works good with bitmaps.

But you don't use a SD card to show the image on the panel.
Such panels don't have an internal memory and needs a constant refresh at least 60-100 times in a second. So the only way to show the image from a SD card - read the full image to a memory and show it from the buffer

That would be a correct statement if you said "I can't do it".
I can. I'm running a 480x320 TFT using 16 bit bitmaps right now with that exact library.

There are a much differences between TFT and HUB75 panels:

  • TFT has an internal memory, but most HUB75 led panels doesn't
  • HUB panels uses a dynamic indication, and TFT not

it is a graphic level library only. It is not a library for hardware interface. That interfaces are quite different.

Here is an example from the library for the 64x64 led display. Tell me where in this example is there a refresh call necessary?

// testshapes demo for RGBmatrixPanel library.
// Demonstrates the drawing abilities of the RGBmatrixPanel library.
// For 64x64 RGB LED matrix.

// WILL NOT FIT on ARDUINO UNO -- requires a Mega, M0 or M4 board

#include "RGBmatrixPanel.h"

#include "bit_bmp.h"
#include "fonts.h"
#include <string.h>
#include <stdlib.h>

// Most of the signal pins are configurable, but the CLK pin has some
// special constraints.  On 8-bit AVR boards it must be on PORTB...
// Pin 11 works on the Arduino Mega.  On 32-bit SAMD boards it must be
// on the same PORT as the RGB data pins (D2-D7)...
// Pin 8 works on the Adafruit Metro M0 or Arduino Zero,
// Pin A4 works on the Adafruit Metro M4 (if using the Adafruit RGB
// Matrix Shield, cut trace between CLK pads and run a wire to A4).

//#define CLK  8   // USE THIS ON ADAFRUIT METRO M0, etc.
//#define CLK A4 // USE THIS ON METRO M4 (not M0)
#define CLK 11 // USE THIS ON ARDUINO MEGA

#define OE   9
#define LAT 10
#define A   A0
#define B   A1
#define C   A2
#define D   A3
#define E   A4

RGBmatrixPanel matrix(A, B, C, D, E, CLK, LAT, OE, false, 64);
//Configure the serial port to use the standard printf function

void setup()
{
  Serial.begin(115200);
  matrix.begin();
  delay(500);
}



void loop()
{
  // Do nothing -- image doesn't change
 Demo_0();
 Demo_1();
 Demo_2();
}

//Clear screen
void screen_clear()
{
  matrix.fillRect(0, 0, matrix.width(), matrix.height(), matrix.Color333(0, 0, 0));
}


void Demo_0()
{
  // draw a pixel in solid white
  screen_clear();
  matrix.setFont(NULL);
  matrix.drawPixel(0, 0, matrix.Color333(7, 7, 7));
  delay(500);

    matrix.fillRect(0, 0, matrix.width(), matrix.height(), matrix.Color333(0, 7, 0));
    delay(500);

    matrix.drawRect(0, 0, matrix.width(), matrix.height(), matrix.Color333(7, 7, 0));
    delay(500);

    // draw an 'X' in red
    matrix.drawLine(0, 0, matrix.width()-1, matrix.height()-1, matrix.Color333(7, 0, 0));
    matrix.drawLine(matrix.width()-1, 0, 0, matrix.height()-1, matrix.Color333(7, 0, 0));
    delay(500);

    // draw a blue circle
    matrix.drawCircle(10, 10, 10, matrix.Color333(0, 0, 7));
    delay(500);

    // fill a violet circle
    matrix.fillCircle(40, 21, 10, matrix.Color333(7, 0, 7));
    delay(500);

    // fill the screen with 'black'
    screen_clear();

    // draw some text!
    matrix.setTextSize(1);     // size 1 == 8 pixels high
    matrix.setTextWrap(false); // Don't wrap at end of line - will do ourselves

    matrix.setCursor(5, 0);    // start at top left, with 8 pixel of spacing
    uint8_t w = 0;
    char *str = "WaveshareElectronics";
    for (w=0; w<9; w++) {
      matrix.setTextColor(Wheel(w));
      matrix.print(str[w]);
    }
    matrix.setCursor(0, 8);    // next line
    for (w=9; w<20; w++) {
      matrix.setTextColor(Wheel(w));
      matrix.print(str[w]);
    }
    matrix.println();
    //matrix.setTextColor(matrix.Color333(4,4,4));
    //matrix.println("Industries");
    matrix.setTextColor(matrix.Color333(7,7,7));
    matrix.println("RGB MATRIX!");

    // print each letter with a rainbow color
    matrix.setTextColor(matrix.Color333(7,0,0));
    matrix.print('6');
    matrix.setTextColor(matrix.Color333(7,4,0));
    matrix.print('4');
    matrix.setTextColor(matrix.Color333(7,7,0));
    matrix.print('x');
    matrix.setTextColor(matrix.Color333(4,7,0));
    matrix.print('6');
    matrix.setTextColor(matrix.Color333(0,7,0));
    matrix.print('4');
    matrix.setCursor(40, 24);

    matrix.setTextColor(matrix.Color333(0,4,7));
    matrix.print('R');
    matrix.setTextColor(matrix.Color333(0,0,7));
    matrix.print('G');
    matrix.setTextColor(matrix.Color333(4,0,7));
    matrix.print('B');


    matrix.setCursor(5, 32);    // start at middle left, with 8 pixel of spacing
    for (w=0; w<9; w++) {
      matrix.setTextColor(Wheel(w));
      matrix.print(str[w]);
    }
    matrix.setCursor(0, 40);    // next line
    for (w=9; w<20; w++) {
      matrix.setTextColor(Wheel(w));
      matrix.print(str[w]);
    }
    matrix.println();
    //matrix.setTextColor(matrix.Color333(4,4,4));
    //matrix.println("Industries");
    matrix.setTextColor(matrix.Color333(7,7,7));
    matrix.println("LED MATRIX!");

    // print each letter with a rainbow color
    matrix.setTextColor(matrix.Color333(7,0,0));
    matrix.print('6');
    matrix.setTextColor(matrix.Color333(7,4,0));
    matrix.print('4');
    matrix.setTextColor(matrix.Color333(7,7,0));
    matrix.print('x');
    matrix.setTextColor(matrix.Color333(4,7,0));
    matrix.print('6');
    matrix.setTextColor(matrix.Color333(0,7,0));
    matrix.print('4');
    matrix.setCursor(40, 56);
    matrix.setTextColor(matrix.Color333(0,4,7));
    matrix.print('R');
    matrix.setTextColor(matrix.Color333(0,0,7));
    matrix.print('G');
    matrix.setTextColor(matrix.Color333(4,0,7));
    matrix.print('B');
    delay(2000);
}

// Input a value 0 to 7 to get a color value.
// The colours are a transition r - g - b - back to r.
uint16_t Wheel(byte WheelPos) {
  if(WheelPos < 8) {
   return matrix.Color333(7 - WheelPos, WheelPos, 0);
  } else if(WheelPos < 16) {
   WheelPos -= 8;
   return matrix.Color333(0, 7-WheelPos, WheelPos);
  } else {
   WheelPos -= 16;
   return matrix.Color333(WheelPos, 0, 7 - WheelPos);
  }
}

/*  @name :  display_Image
 *  @brief:  display an image
 *           The image data is in the "bit_bmp.h"
 *           You can use some tools to get the image data
 *           You can set the data bits which is 8 or 16 and set the MSB first which is true or false on line 1001 of Adafruit_GFX.c
 *  @param:    x   Top left corner x coordinate
 *             y   Top left corner y coordinate
 *         bitmap  byte array with 16-bit color bitmap,the image data is in the "bit_bmp.h"
 *             w   Width of bitmap in pixels
 *             h   Height of bitmap in pixels
 *  @retval: None
 */
void display_Image(int16_t x, int16_t y, const uint16_t bitmap[],int16_t w, int16_t h)
{
  matrix.display_image(x, y, bitmap, w, h);
}

#include "Fonts/FreeSerif9pt7b.h"
#include "Fonts/FreeSerifBoldItalic9pt7b.h"
#include "Fonts/RobotoMono_Thin7pt7b.h"
#include "Fonts/FreeSans9pt7b.h"

/*  @name : display_text
 *  @brief: display a text string
 *  @param:    x            X coordinate in pixels
 *             y            Y coordinate in pixels
 *           *str           Text string
 *            *f            Text font,if you use the default font,the value will be NULL,
 *                                    if you use other font ,you should add header file of font to folder named “Fonts” like this Demo
 *           color          16-bit 5-6-5 Color to draw text with
 *         pixels_size      Desired text size. 1 is default 6x8, 2 is 12x16, 3 is 18x24, etc
 *  
 *  @retval: None
 */
void display_text(int x, int y, char *str, const GFXfont *f, int color, int pixels_size)
{
  matrix.setTextSize(pixels_size);// size 1 == 8 pixels high
  matrix.setTextWrap(false); // Don't wrap at end of line - will do ourselves
  matrix.setFont(f);      //set font
  matrix.setCursor(x, y);
  matrix.setTextColor(color);
  matrix.println(str);
}
void Demo_1()
{
  screen_clear();
  display_text(-1, 14, "R", &FreeSerif9pt7b, matrix.Color333(7, 0, 0), 1);
  display_text(8 , 14, "G", &FreeSerif9pt7b, matrix.Color333(0, 7, 0), 1);
  display_text(19, 14, "B", &FreeSerif9pt7b, matrix.Color333(0, 0, 7), 1);
  display_text(31,  5, "m", NULL, 0x7800, 1);
  display_text(37,  5, "a", NULL, 0xFFE0, 1);
  display_text(42,  5, "t", NULL, 0x07E0, 1);
  display_text(48,  5, "r", NULL, 0X001F, 1);
  display_text(53,  5, "i", NULL, 0x07FF, 1);
  display_text(58,  5, "x", NULL, 0x780F, 1);
  display_text(-1, 30, "P2",&RobotoMono_Thin7pt7b, 0xFFE0, 1);
  display_text(12, 25, ".",NULL, 0xFFE0, 1);
  display_text(21, 30, "6",&FreeSerifBoldItalic9pt7b , 0x780F, 1);
  display_text(29, 30, "4",&FreeSerifBoldItalic9pt7b , 0x780F, 1);
  display_text(38, 30, "x",&FreeSans9pt7b , 0x780F, 1);
  display_text(46, 30, "6",&FreeSerifBoldItalic9pt7b , 0x780F, 1);
  display_text(54, 30, "4",&FreeSerifBoldItalic9pt7b , 0x780F, 1);

  display_text(-1, 14+32, "R", &FreeSerif9pt7b, matrix.Color333(7, 0, 0), 1);
  display_text(8 , 14+32, "G", &FreeSerif9pt7b, matrix.Color333(0, 7, 0), 1);
  display_text(19, 14+32, "B", &FreeSerif9pt7b, matrix.Color333(0, 0, 7), 1);
  display_text(31,  5+32, "M", NULL, 0x7800, 1);
  display_text(37,  5+32, "a", NULL, 0xFFE0, 1);
  display_text(42,  5+32, "t", NULL, 0x07E0, 1);
  display_text(48,  5+32, "r", NULL, 0X001F, 1);
  display_text(53,  5+32, "i", NULL, 0x07FF, 1);
  display_text(58,  5+32, "x", NULL, 0x780F, 1);
  display_text(-1, 30+32, "P2",&RobotoMono_Thin7pt7b, 0xFFE0, 1);
  display_text(12, 25+32, ".",NULL, 0xFFE0, 1);
  display_text(21, 30+32, "6",&FreeSerifBoldItalic9pt7b , 0x780F, 1);
  display_text(29, 30+32, "4",&FreeSerifBoldItalic9pt7b , 0x780F, 1);
  display_text(38, 30+32, "x",&FreeSans9pt7b , 0x780F, 1);
  display_text(46, 30+32, "6",&FreeSerifBoldItalic9pt7b , 0x780F, 1);
  display_text(54, 30+32, "4",&FreeSerifBoldItalic9pt7b , 0x780F, 1);
  delay(2000);
    
  display_Image(0, 0, gImage_image, 64, 64);
  delay(2000);
}

void Demo_2()
{
    screen_clear();
    matrix.DrawString_CN( 1   , 12, "微", &Font16CN, matrix.Color333(7, 0, 0));
    matrix.DrawString_CN( 1+16, 12, "雪", &Font16CN, matrix.Color333(6, 1, 0));
    matrix.DrawString_CN( 1+32, 12, "电", &Font16CN, matrix.Color333(5, 2, 7));
    matrix.DrawString_CN( 1+48, 12, "子", &Font16CN, matrix.Color333(0, 7, 0));   
    matrix.DrawString_CN( 1    ,35, "欢", &Font16CN, matrix.Color333(0, 6, 1));
    matrix.DrawString_CN( 1+16, 35, "迎", &Font16CN, matrix.Color333(0, 5, 2));
    matrix.DrawString_CN( 1+32, 35, "您", &Font16CN, matrix.Color333(0, 0, 7));
    matrix.DrawString_CN( 1+48, 35, "!", &Font16CN, matrix.Color333(1, 0, 6));
    delay(2000);
    screen_clear();
    matrix.DrawString_CN( 1   ,  0, "微", &Font32CN, matrix.Color333(0, 7, 7));
    matrix.DrawString_CN( 1+32,  0, "雪", &Font32CN, matrix.Color333(0, 7, 7));
    matrix.DrawString_CN( 1   ,  32,"电", &Font32CN, matrix.Color333(0, 7, 7));
    matrix.DrawString_CN( 1+32,  32,"子", &Font32CN, matrix.Color333(0, 7, 7));
    delay(2000);
    screen_clear();
    matrix.DrawString_CN( 1   ,   0, "欢", &Font32CN, matrix.Color333(0, 7, 7));
    matrix.DrawString_CN( 1+32,   0, "迎", &Font32CN, matrix.Color333(0, 7, 7));
    matrix.DrawString_CN( 1   ,   32,"您", &Font32CN, matrix.Color333(0, 7, 7));
    matrix.DrawString_CN( 1+37,   32,"!", &Font32CN, matrix.Color333(0, 7, 7));
    delay(2000);
    screen_clear();
    matrix.DrawString_CN( 0, 0, "微", &Font64CN, matrix.Color333(7, 0, 0));
    delay(1000);
    screen_clear();
    matrix.DrawString_CN( 0, 0, "雪", &Font64CN, matrix.Color333(0, 7, 0));
    delay(1000);
    screen_clear();
    matrix.DrawString_CN( 0, 0, "电", &Font64CN, matrix.Color333(0, 0, 7));
    delay(1000);
    screen_clear();
    matrix.DrawString_CN( 0, 0, "子", &Font64CN, matrix.Color333(7, 7, 7));
    delay(1000);
    screen_clear();
    matrix.DrawString_CN( 0, 0, "欢", &Font64CN, matrix.Color333(7, 5, 0));
    delay(1000);
    screen_clear();
    matrix.DrawString_CN( 0, 0, "迎", &Font64CN, matrix.Color333(0, 7, 5));
    delay(1000);
    screen_clear();
    matrix.DrawString_CN( 0, 0, "您", &Font64CN, matrix.Color333(5, 0, 7));
    delay(1000);
    screen_clear();
    matrix.DrawString_CN( 13, 0, "!", &Font64CN, matrix.Color333(7, 7, 7));
    delay(2000);
    screen_clear();
}

It is an timer interrupt setup inside the

RGBmatrixPanel.cpp

For example, for AVR controllers it done in lines 365-370 of .cpp file

Correct. The library deals with it. Good on ya!

  • FlashMemory: 256KB of which 8KB used by bootloader

  • SRAM: 8KB

  • EEPROM: 4KB

I saw what it said

Why did you wrote this?
You didn't answer to my question.

Nothing comes up.

what is UG1, UR1 and UU1, UU2 ?

You need something like ESP32, RP2040 or stm32 boards.

  • so I bought ESP32 but can't run display