2dom / PxMatrix

Adafruit GFX compatible graphics driver for LED matrix panels
BSD 3-Clause "New" or "Revised" License
838 stars 171 forks source link

The colors aren't right ! E pin behaves very strange ! Video provided. #84

Closed GeorgeFlorian closed 5 years ago

GeorgeFlorian commented 5 years ago

Hello !

I am trying to use a LED Display and an ESP32.

Display: 2727 SMD P5 64x32 Board: ESP32 Wrover-B DevKitV4

I've done the wiring as it was written in the ReadMe. I thought I did a mistake so I redid the wiring and still nothing.

I've also redefined the GPIO as follows:

define P_LAT 22

define P_A 19

define P_B 23

define P_C 18

define P_D 4

define P_OE 25

P_E should be marked as the GND between G2 and B on the HUB75 Matrix, right ?

I've used E as GPIO 15 together with the proper constructor: PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D,P_E);. If it's only a wire from the GPIO 15 on the ESP to the E pin on the HUB75 Matrix, the pattern_test moves slower. If grounded it moves faster. About half a row faster.

If I use E as a ground and use the PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D); constructor it behaves just like I described above when E was grounded, so it moves "faster", just like in the video at the end of the video.

I've tried display.setScanPattern(x) with all its values: LINE, ZIGZAG, ZAGGIZ, WZAGZIG, VZAG and it changes nothing. I've also used: display.setMuxPattern(x) with BINARY and STRAIGHT. STRAIGHT would shift the rows lower and from 8bit x 4 row I would end up with 3 row instead of 4. Between commenting the function and using BINARY there isn't any difference, so I've ended up not using display.setMuxPattern(x).

This is the Pattern_Test example code that I am using:

#include <PxMatrix.h>

#define P_LAT 22
#define P_A 19
#define P_B 23
#define P_C 18
#define P_D 4
//#define P_E 15
#define P_OE 25

hw_timer_t * timer = NULL;
portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED;

// Pins for LED MATRIX

//PxMATRIX display(32,16,P_LAT, P_OE,P_A,P_B,P_C);
PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D);
//PxMATRIX display(64,64,P_LAT, P_OE,P_A,P_B,P_C,P_D,P_E);

void IRAM_ATTR display_updater(){
  // Increment the counter and set the time of ISR
  portENTER_CRITICAL_ISR(&timerMux);
  //isplay.display(70);
  display.displayTestPattern(70);
  portEXIT_CRITICAL_ISR(&timerMux);
}

uint16_t myCYAN = display.color565(0, 255, 255);
void setup() {
Serial.begin(115200);
  display.begin(8);
//  display.setScanPattern(LINE);
//  /display.setMuxPattern(BINARY);
  display.flushDisplay();
  display.setTextColor(myCYAN);
  display.setCursor(2,0);
  display.print("Pixel");
  Serial.println("hello");

   timer = timerBegin(0, 80, true);
   timerAttachInterrupt(timer, &display_updater, true);
   timerAlarmWrite(timer, 2000, true);
   timerAlarmEnable(timer);

  delay(1000);
}

void loop() {

 delay(100);

}

Here is a video demonstrating the pattern_test : https://youtu.be/Upmmn8KFX7s

It doesn't look right... The colors are wrong and it skips some lines. Sometimes the colors flash, I don't know why they didn't flash in the video.

What do you think the problem is ?

2dom commented 5 years ago

This Looks very wrong, re-check proper power supply (>3A), thick power cables (5V at Panel!), proper grounding between ESP and Panel. If this does not do the trick try reducing the SPI Speed in the PxMatrix.h file.

GeorgeFlorian commented 5 years ago

This Looks very wrong, re-check proper power supply (>3A), thick power cables (5V at Panel!), proper grounding between ESP and Panel. If this does not do the trick try reducing the SPI Speed in the PxMatrix.h file.

This is the cable that supplies the LED Display and the breadboard :

These are the specs of the Power Supply:

The grounding comes from the Power Supply and the GND pins from the IN - HUB75 matrix (there are 3) and the ESP (I used 1 GND pin) are grounded to that.

I've noticed a strange behaviour:

You can see in the next video that I have a WHITE jumper cable. That white cable is connected to the GND in-between G2 and B from HUB75 matrix (that should be E) and the GPIO 15 on the ESP32. GPIO 15 is not currently defined in the code, as you can see in the code mentioned in the first post:

//#define P_E 15
PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D);

Also, the same behavior appears when actually defining GPIO 15 as P_E, using the following code:

#define P_E 15
PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D,P_E);

One end of the WHITE cable is always connected to the GND in-between G2 and B on the HUB75 Matrix.

The other end will be connected to the GPIO15, which is not defined in the code, and then to ground.

You will notice that when it's connected to GPIO15 it works way better, and it has problems only with RED color, and only on the first 2 rows. When the RED starts from the third LED row it works perfectly. When it's connected to the ground the gibberish happens. I've changed the SPI.setFrequency() from 10 000 000 to 1 000 000 and it behaves even worse. Now it's bad even after the second row.

https://youtu.be/kn8B-_ej34U

Also I've noticed in PxMatrix.h that it uses GPIO 4 #define SPI_BUS_SS 4. In my code I've used GPIO 4 for P_D #define P_D 4. Is this a problem ?

GeorgeFlorian commented 5 years ago
#define P_LAT 22
#define P_A 19
#define P_B 23
#define P_C 18
#define P_D 4
#define P_E 15
#define P_OE 25

#define matrix_width 64
#define matrix_height 32

PxMATRIX display(matrix_width,matrix_height,P_LAT, P_OE,P_A,P_B,P_C,P_D,P_E);

/**
*
*
*
*/

display.begin(8);

I've uploaded PixelTime example and this is how it works: https://youtu.be/5KoXFSEt0MQ

It looks way better through a camera. In reality it isn't that smooth. Reality = 15 fps, camera = 30+ fps. Also, on camera, the scrolling text changes colors. In reality it's only one color. Also the RGB flag is pretty static in reality. And, after the first iteration, from the second time the text starts scrolling and onward it has ghosting and the brightness dims a little.

The only thing that affects this behavior is adding /2, /4, /8 to display.setTextColor(display.color565(colorR,colorG,colorB)). The color should be (96,96,250) meaning some kind of blue. If I set the above function to display.setTextColor(display.color565(colorR/8,colorG/8,colorB/8)); then it's blue. If I set it to /2 or /4 then it's white.

Is that how it should be ?

GeorgeFlorian commented 5 years ago

The problems were the wires ! The multi colored wires:

If you squeeze them tight all the pixel noise disappears and it works perfectly.

I've ended up using E pin aswell.

#define P_E 15
PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D,P_E);
display.begin(8);