Go Down

Topic: LED matrix display - MD_Parola, MD_MAX72xx and MD_MAXPanel (Read 531410 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

Dancopy

Greetings Marco! Can I use the space here to ratify my problem?

I'm using your 'Parola_Zone_TimeMsg' sketch;
I loaded a sketch 'DS3231_Serial_Easy' on the DSC3231 RTC to set the time, and when I record the sketch, shows the correct time and date on the display, but Day of the Week is wrong, for example, today (I recorded the sketch) "Sunday, April 21, 2019" is showing "Saturday, April 21, 2019".
Would you have any tips for me?

NOTE: On Serial Monitor shows correct: Sunday, April 21, 2019

Thank you very much

marco_c

Please as your questions in one place only - I have to answer in the same way everywhere, which is a waste of time.

Quote
I loaded a sketch 'DS3231_Serial_Easy' on the DS3231 RTC
I have no idea what this sketch is or what it does.

The DoW on the DS3231 is an arbitrary number cycling between 1 and 7. The meaning of the DoW is in your code (Monday could be 3, it does not matter to the DS3231).
The Parola sketch assigns the label for the day according to the table
Code: [Select]
static const char str[][10] PROGMEM =
  {
    "Sunday", "Monday", "Tuesday", "Wednesday",
    "Thursday", "Friday", "Saturday"
  };

In this table Sunday is DoW 1. If you want a different mapping change the table.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

kinburn77

I have 2 rows of 5 quad FC16 matrices (ie two rows with  20 cells in each row)
and the    Parola_Double_Height_v2    example only works correctly if I change the
display to scroll right by changing #define SCROLL_LEFT 1   to   #define Scroll_LEFT 0

Max zones set to 2 and Zone size set to 20
I use buffered CLK and DIN lines from arduino and the lower row DOUT goes back to
upper row 2 DIN via twisted pair with one twisted wire to GND.

Using Parola ver 3.0.3  MD_MAX72xx ver 3.0.2  IDE ver 1.8.5  and hardware SPI

I do not suspect any wiring errors since all works fine when scrolling right.
Power supply is robust and well distributed on the cells.

Scrolling left leaves the last 8 displays ( numbers 33 to 40) on the upper left end stuck on and not
scrolling off to the left like the lower row.

The next message over-writes the stuck bits correctly.

I seems like the upper scroll function only does 16 cells whereas the lower row scrolls
all 20 cells off to the left.

Any ideas?

PS: your libraries are wonderful ... Thanks

Dancopy

Thank you marco! - problem solved!

Go Up