Go Down

Topic: LED matrix display - MD_Parola, MD_MAX72xx and MD_MAXPanel (Read 515289 times) previous topic - next topic

#1485
Mar 18, 2019, 10:17 pm Last Edit: Mar 18, 2019, 11:08 pm by ocsav Reason: add zone test
Oopsss! there's something quite wrong with my code must investigate further.

I wrote a simple test program that sets the matrix to each intensity and it works ok.

Code: [Select]

#include <MD_MAX72xx.h>
#include <MD_Parola.h>
#include <SPI.h>

#define MAX_DEVICES 4
#define CLK_PIN   D5 // or SCK
#define DATA_PIN  D7 // or MOSI
#define CS_PIN    D8 // or SS
#define HW MD_MAX72XX::ICSTATION_HW

MD_Parola P = MD_Parola(HW, CS_PIN, MAX_DEVICES);

void setup()
{
    pinMode(CS_PIN, OUTPUT);
    Serial.begin(115200);
    P.begin();
    P.displayReset();
    P.setInvert(1);
    P.displayAnimate();
  }

void loop()
{
    int f;
    long now;

    for(f=0;f<16;f++)
    {
        P.setIntensity(f);
        P.print(f);
        P.displayAnimate();
        now=millis();
        while(millis()<(now+2000L)) yield();    // On a 8266 you'll get a watchdog reboot if you have a closed loop without the yeld()
    }
}

And not a zone problem either, the same test with 4 zones works ok too.
Code: [Select]

#include <MD_MAX72xx.h>
#include <MD_Parola.h>
#include <SPI.h>

#define MAX_DEVICES 4
#define CLK_PIN   D5 // or SCK
#define DATA_PIN  D7 // or MOSI
#define CS_PIN    D8 // or SS
#define HW MD_MAX72XX::ICSTATION_HW

MD_Parola P = MD_Parola(HW, CS_PIN, MAX_DEVICES);
char buffer[16];

void setup()
{
    pinMode(CS_PIN, OUTPUT);
    Serial.begin(115200);
    P.begin(4);
    P.setZone(0,3,3);
    P.setZone(1,2,2);
    P.setZone(2,1,1);
    P.setZone(3,0,0);
   
    P.displayReset(0);    P.displayReset(1);    P.displayReset(2);    P.displayReset(3);
    P.setInvert(0,1);    P.setInvert(1,1);    P.setInvert(2,1);    P.setInvert(3,1);
    P.displayAnimate();
   

}

void loop()
{
    int f;
    long now;

    for(f=0;f<16;f++)
    {
        sprintf(buffer, "%2d", f);
        P.setIntensity(0,f); P.setIntensity(1,f); P.setIntensity(2,f); P.setIntensity(3,f);

        P.displayZoneText(0,buffer, PA_LEFT, 0, 0,  PA_PRINT,  PA_NO_EFFECT);
        P.displayZoneText(1,buffer, PA_LEFT, 0, 0,  PA_PRINT,  PA_NO_EFFECT);
        P.displayZoneText(2,buffer, PA_LEFT, 0, 0,  PA_PRINT,  PA_NO_EFFECT);
        P.displayZoneText(3,buffer, PA_LEFT, 0, 0,  PA_PRINT,  PA_NO_EFFECT);

        P.displayAnimate();
       
        now=millis();
        while(millis()<(now+2000L)) yield();
    }
}
--
You never learn anything by doing it right.

Found the problem.
In the middle of the zone code I had Ieft a P.setIntensity(1) without a zone number, so the intensity was only being applied to zone 0, all the others stayed at the default value.
--
You never learn anything by doing it right.

noelvd

I've build the 5x4 panel, as in the example, and it runs fine on an Arduino.

However, when I connect it to a Wemos D1 R1, I have problems. The sketch is exactly the same, except for the pins. The correct leds are going on and off, but the last 8x8 matrix (#20, top-left) is not working. Also the matrix next to it (#19), is brighter than the others.

While keeping the panel as 5x4, I reduces Y-devices to 4. Now again the last one (#16, top-left) was not working, and the one next to in (#15) was extra bright.

Any ideas on what could be the problem ?

Thanks !

marco_c

Assuming that you have checked that the power supply is ok and that the connections between modules are still good, then you may have some signal propagation or distortion problems.

If you are running the hardware SPI, try chaining to the software 'bit bang' version as this runs slower and the distortion issues may be less severe. You may also want to look up the pull up/down resistor (can't remember which) on the SPI lines to improve the signal condition. Lots on Google for that.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

noelvd

Thanks for the suggestions, Marco.

I was (am using):
Code: [Select]

#define CLK_PIN   D5 // or 13 or SCK  (Green)
#define CS_PIN    D6 // or 12 or MISO  (Yellow)
#define DATA_PIN  D7 // or 11 or MOSI (Orange)


I changed CS_PIN from D6 to D8 (SS), but it didn't help.\
Then I changed the code to use the arbitrary pins, but it gave s strange result (lots of pixels not working).
I went back to SPI hardware, and then it WORKED (!).
Well... at least for a minute. After that, the last matrix stopped displaying again :(
Knowing that the WEMOS is 3.3V, where the Arduino is 5V, it may be that the signals are -as you suggested- getting disturbed somewhere.
Next thing, is to connect the module in parallel (except for the dateline).

darwis_yudibrata

Dear All,
i made sketch as attached (sorry, i cannot write in here).

my question is: how to reduce file size to upload? since when i activate prayer time calculation, always file too big to upload.

thanks for reply.

marco_c

@noelvd: Thye MAX7219 is a 5V device so you will need to supply the matrix chain with 5V. You cannot use a 3V supply for this. The inputs should work (just!) with 3V but a level converter would make sure of that. Make sure all the ground connections are connected together.

@darwis_yudibrata: Please read https://arduinoplusplus.wordpress.com/2018/09/23/parola-a-to-z-optimizing-flash-memory/
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

@noelvd: Thye MAX7219 is a 5V device so you will need to supply the matrix chain with 5V. You cannot use a 3V supply for this. The inputs should work (just!) with 3V but a level converter would make sure of that. Make sure all the ground connections are connected together.
I had a 2x2 matrix working well with 3V and a ESP-8266 until the day it stoped working, and nothing that I did made it work again. Until I changed the power supply to 5V, then it started working again, and have been since then.
I'm not sure what makes it work sometimes, but this devices are made to be powered by 5V.
--
You never learn anything by doing it right.

noelvd

I have a 4-by-1 working fine with a WEMOS, and 5V.

The 5-by-4 panel is working fine (on 5V) with an Arduino.
With a WEMOS, the last matrix (usually, but not always) stays dark.

mistano

Hello,

I'm trying to print a sprite on a zone of my led matrix, can you help me ? I only managed to make one zone working with text and not sprites. This zone is printing the hour, and then some other text messages, but I've read the documentation and I didn't found something looking good for my project.

Can you help me please ?

I'm using parola and MD_MAX72xx librairies.

I just want to print an animated sprite on a single matrix (zone 1 of my defined zones)

marco_c

Please look at the examples for sprites to work out what to do.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

Go Up