myMatrix – Arduino library for LED matrix panels

myMATRIX_1.2This is an Arduino library for 32×16 RGY LED matrix panels. I wrote this library for this type of LED matrix panel that I found at online shop (link below):

You can find this panel here:

Note: This is RGY(Red Green Yellow) panel not RGB.

An article was posted here:×16-LED-Matrix-Panel-and-Arduino/ using this library.


  • Easy to set-up.
  • All pins are software configurable.
  • Works with different Arduino compatible configurations (tested with Arduino Mega, Atmega32, Atmega1284, Atmega8).
  • Built in scroll function for string.
  • Built in font 5×7


  • Support only one panel (for now).
  • Suport only RGY panel (for now).
  • Only one built-in font (for now).
  • Char and string display functions are locked on 5×7 font (for now).

All limitations will be overcome in time. We plan to develop this library as we have more feedback (It is possible to start a GitHub project if we feel like we need it).

User manual

in progress…

Developer manual

in progress…
even if it is in progress, I’ve already started working on it. So here is the first part:

Arduino Library for 16×32 RGY LED Panel(s)

/* development documentation */

RGY (Red Green Yellow) LED panels are multiplexed display, which means the entire display is not driven at one time.

  • “A multiplexed display has several advantages compared to a non-multiplexed display:
  • fewer wires (often, far fewer wires) are needed
  • simpler driving electronics can be used
  • both lead to reduced cost
  • reduced power consumption” – (

Scanning will reduce brightness of the led screen, as the scan rate is higher, the brightness of LEDs is lower. Generally we meet panels that have a 1/2, 1/4, 1/8, 1/16 and 1/32 scan rate.
A 1/1 scan rate means static driving in is used when we need maximum brightness – outdoor displays.
Our panel have 1/16 scan rate, so only one row of 16 is on at a time. So this is the first requirement: we need to refresh entire display (row by row) as fast as possible, with no interfere from another piece of code. Any disruption in refreshing display will be will be noticed and will be annoying. This leads to the use of a timer interrupt, in our case timer2. We’ll return to this topic later.

Another characteristic of this panel is that receives serial data through three pins:

  • R – Red
  • G – Green
  • Clk – Clock

If it were only one color, it would have meant that we can use SPI port of the microcontroller to write data to the panel. But is not the case. So we need to use direct pin manipulation to emulate a SPI port with two data pins.

Here we meet another problem, usual Arduino instructions are too slow to drive the display at a rate without causing flicker phenomenon. So I rewrote shiftOut() function to obtain a sufficient speed.

Here are original shiftOut() function from … /hardware /arduino /avr /cores /arduino / wiring_shift.c :

And here are modified t_shiftOut(). We observe that the function writes two bits in parallel although it is a serial protocol. In fact it is like a dual serial bus with common clock. Output pins are outGreen and outRed already defined in main class myMATRIX from myMATRIXclass.h.

Download here:

A more recent (unfinished) version of the library with non-blocking scroll function:


Until the user manual will be ready I post here some examples:

A schematic of a similar P10 module (monochrome). RGY module is in fact 2x monochrome module… obvious. 🙂
Some day I will reverse engineer this module and publish schematic here…
Until that day is interesting to have this similar schematic:


Updated: June 5, 2019 — 3:42 pm


Add a Comment
  1. Nice! … good to see that it is useful.

  2. Trying combine myMatrix.h with DHT11 sensor. Run myMatix demo – all fine. Run DHT11 demo – all work. Try replace text “DEMO” from myMatix demo on temperature from DHT11 – nothing.
    I simplify the scetch to this:
    #include “DHT.h”
    DHT dht;

    #include “myMATRIX.h”

    void setup()
    dht.setup(11); // data pin 11

    void loop()
    float temperature = dht.getTemperature();
    Serial.print(temperature, 1);
    Serial.println(dht.toFahrenheit(temperature), 1);

    If this string not commented – ” myMatrix.Init(7,8,9,2,3,4,5,6,10); “, any dht11 methods not return any value. Commenting myMatrix.Init(7,8,9,2,3,4,5,6,10) – all work perfect.
    Help me, please!

    1. myMatrix use timer2 internaly for refreshig led rows with a very tight timing, and DHT11 library also require some timing ..

      i suspect that is not enough “power” to use both… I suggest to try to optimise
      dht11 library or higher values for loopCnt in dht11.cpp

      I noticed that there are more libraries for DHT11, are you using interrupt driven library?

    2. Hi Dmitry!
      Have you finished your project?
      With the help of Silvius (mostly) and another friend, I did a Clock + Scrolling Text and would like to add Temperature with DHT11 / DHT22 in the sketch; Could you share your sketch here? (it’s always good for others to learn)
      If you want my sketch, I share.

  3. Thank for right direction. I change the library. With library from Adafruit no problem. Link to work library
    Thank for you work!

  4. Hi Silvius!
    I would like to contribute to the expansion of the library but do not have enough technical knowledge to do so;
    Would I like a suggestion of how your can learn about these libraries;
    I would suggest you make a library for this module:

    Thank you and God bless you.

    1. I would love to continue to develop this library.
      Unfortunately I can not work without module in my hand…
      So until I order another module I can not do much…
      If I order that module on AliExpress, it will take about a month to arrive.

      (I’ll send a message by email also…)

      1. Hi Silvius! How are you?
        Do you already have anything to do with this module I said?

        Or maybe your library with some changes (which I do not know) can work with this module? Well, it seems to me that it uses the same components, but it’s 64×32 Red Green.


  5. Hello,
    Thanks for writing this library. It has saved me so much headache. I’m struggling with a problem still. How can I create an integer variable and have it print with your function.

    int teamscore;

    obviously that won’t work. Casting teamscore to a string doesn’t work either. I can’t even pass a variable to that function. Thank you for your time.

    1. Here is a sample code (based on your request):

      #include "myMATRIX.h"

      // change pins values according with your connections:
      #define RowA_Pin 2
      #define RowB_Pin 3
      #define RowC_Pin 4
      #define RowD_Pin 5
      #define OE_Pin 6
      #define Red_Pin 7
      #define Green_Pin 8
      #define CLK_Pin 9
      #define STB_Pin 10

      uint16_t homeScore = 5;
      uint16_t awayScore = 0;
      String homeString;

      #define maxDigits 3
      char homeChars[maxDigits];

      void setup ()

      void loop()
      //writing converted values to homeChars Buffer

      The code has been tested in real conditions.

  6. Hi.
    It is possible to control the leds brightness and how?
    Thank you in advance.

    1. Sorry… not for this type of panels… and not with Arduino or other similar projects…

      Panel are “massively” multiplexed and display one row at a time…
      I do not see any possibility to do this…

      There are other types of LED displays that can do that (with Arduino or otherwise)…

      1. Thank you for your reply.
        Which, for example? Did you mean the RGB panels?

        1. Some smart(and more expensive) RGB panels, with PWM included… like those based on HT1632C or similar… or based on WS2811…

          (I assumed that you talk about controlling one individual led/pixel)

          In this library serial communication is bit-banged emulating a SPI with dual data stream (and one clock) and 1/8 scan… I do not think that can be done with software and with 16-20MHz 8bit microcontroller…

          1. > “I assumed that you talk about controlling one individual led/pixel”
            No, I mean about the complete board — all leds: to decrease brightness for night time.

            1. Hmm… 🙂 In this case… I think it can be done, even in software… with some delay in scan function:

              void myMATRIX::Show()

              I know that is not good at all to put delays in interrupts but you can try…

              for a purely electronic solution… for this module… I don’t see where to interfere in circuit to modify leds current…
              (without cut some traces…)

              1. Yeah, I’ll try when I’ll get this board. I’ll let you know about results. 😉

      2. But I think it is possible. If I limit current on T1-T16 transistors bases this will decrease voltage on LEDs cathode… That you think about this idea?

  7. Hi Silviu. I am trying to use your code with two 32×16 matrixes. I have copied and paste the cod from all the files you posted for 96×16 matrix into the files from the MyMatrix in arduino library.
    First I want to tell you that running the example for one 32×16 matrix , I have got an error at: myMatrix.printString(5,8,yellow,black,”Demo”);=> ” no matching function for call to’myMatrix::printString(int,int,int,int,const char [5])’
    I disable it and the demo program works. I can fill and draw rectangle on both matrixes, but when scrolling text it starts from the middle, scrolling to the left on just left 32×16 matrix. Also I have tried to printChar and I get the same error like with the printString. Please help me to scroll a text starting with the matrix on the right and show me an example for printChar line. Thank you (I speak english and romanian in case you respond on the email)

  8. Hi Silviu. I just figured out what to change to make the scrolling work right.
    in the scrolling function :{
    for (byte xx=0; xx<32; xx++)
    I have changed xx<64. now works. I am still waiting for you to give me an example of printString and printChar. Thanks

  9. also I have changed this line to eliminate some pixels at the enf of the text:
    for (offset=0; offset <((lenString(mystring)-5)*6-33); offset++)

    1. Sorry… I can’t help you until 4-5 January … New Year’s holiday 🙂
      …then I get to my desk…

      Anyway.. it is no need yo modify both printString and printChar… since printString uses printChar…

      In the meantime I will try to download library code to my phone… and I will try to figure were/what to modify …

      1. Thank you Silviu. I am waiting until after the New Year. Please Don’t forget me, HAPPY NEW YEAR and all the best!

        1. Happy New Year! to you … too

          I did not forget you. I fact, I hope to develop together a version for two modules(64×16) …

          96×16 version is not developed by me… is an adaptation made by Tomas Kovacik
          and posted on github. Unfortunately I have not studied it …yet.

          So I’ll probably start with my version… in fact it should be easy…
          only have to increase the buffer size and adapt coordinates values…
          but I not have two modules(or more …yet) to test in real conditions…

          Ok for now … so keep in touch
          Best Regards!

          PS. I will send you a private message also.

          1. Hello Silviu. Thanks for your reply.
            Yesterday I figured out why the error appears when try to printString. The library that use define like the last variable of this function, the type of font, which is defined to be a number between 0 and 4. So Adding at the end this font number, just works with no errors. the example from the library doesn’t show any font variable and this is why didn’t work.
            ex: myMatrix.printString(2,1,red,black,rtc.getDOWStr(FORMAT_SHORT),0);
            the same thing is with printChar function:
            ex: myMatrix.printChar(1,1,red,black,’H’,1);
            Now, because I’ve brought to your attention this matter with showing on the matrix the current date, time and day of the week which works great with the following code:
            myMatrix.printString(2,1,red,black,” “,0);
            and after 5 seconds the next cycle:
            myMatrix.printString(2,1,red,black,” “,0)
            which makes the “time” to be showed continuously and the “day of the week” is switched every 5 seconds with the “date”.
            I forgot to mention that I use time module DS1302 and the object is called: DS1302 rtc(11, 12, 13);
            Now my next purpose is to scroll the “time”
            I have tried to use this function:
            the scroll works but first it never stops and second, it shows at the beginning the “date” and then it continue scrolling all the days in a week and after that continues scrolling all kind of characters and pixels forever.
            then I’ve tried to define: char scrolltext_5[]= rtc.getDateStr();
            and when compiling I get the error: initializer fails to determine size of ‘scrolltext_5’
            then I ve tried to define a string: String scrolltext_5 =rtc.getDateStr(); and when call the function: myMatrix.hScroll(1,red,black,scrolltext_5); , I get the error: no matching function for call to ‘myMatrix::hSchroll(int,int,int,String&)’
            I’ve even try:
            int str_len = rtc.getDateStr().length()
            char scrolltext_5[str_len]=rtc.getDateStr(); or
            scrolltext_5..toCharArray(char_array, str_len);
            and nothing works . I get error: initializer fails to determine size of ‘scrolltext_5’
            I would appreciate if you can help me with that. Thanks

            1. P.S Today I’ve ordered another 2 matrix modules from China and at the end of January I will get ’em. So I will have 4 matrix-es to play with.

              1. The problem I see with these matrix-es modules is that the LED matrix-es are not matched like the brightness and specially on green. Seeing different brightness on LEDs doesn’t look so good, plus with the schematic they use the current through each led can not be controlled and this is bad. But nothing we can do about it!

            2. Yes… you are using 3panels variant of library, which introduced alternative fonts, it’s a variant that it is based on my library … but have some changes that have not been documented… those changes are not mine …and I don’t know much about them

              for scrolling a dinamic value… let me few days(after new year 🙂 ) to check what kind of values are returned from DS1302 library.

              it is doable… I do this for some guys who also used the library…
              I think more examples will be more clarifying…

              there are some similar (not the same) issues in comments above…

              1. Just for the info: 64×16 matrix + arduino UNO @ 5.25V takes
                – 80 mA with no LED ON
                – 100 mA with one line of 64 LEDs ON
                – 240 mA with all LEDs ON (16 lines x 64 led/line) no maters the colour

            3. hmm… this will not work: 🙂

              int str_len = rtc.getDateStr().length()
              char scrolltext_5[str_len]=rtc.getDateStr();

              instead … try to allocate enough space for scroll text:
              scrolltext_5[50]; //50 is an arbitrary value

              and you can use sprintf funtion to do the job
              try my example and you will figure how it work.
              for more info about sprinf you can read here:

              so this is my working example:

              void loop()
              int variable_1 = 15;
              int variable_2 = 22;
              for (int i = 0; i < 60; i++) { sprintf(scrolltext_5, " %02d:%02d:%02d ", variable_1,variable_2,i); myMatrix.hScroll(0,red,black,text_2); } }

              ... ok ... the code is not easy readable here (in comments)...
              I'll put as example in the article.

              1. Thank you Silvius.
                Based on your example the following code works great, scrolling the day of the week and and the date delivered by the DS1302 time module:
                char scrolltext_5[10];
                sprintf (scrolltext_5, ” * %s * %s * “, rtc.getDOWStr(),rtc.getDateStr() );

            4. Hi Adrian!
              He was reading about his watch sketch and found it interesting; Could you share the complete sketch here? Thanks

  10. hi, i have just bought this display and am currently soldering it together. does your library support a stop watch/timer feature because that is what i want to use it for if not is will it be hard to make(not very confident with led displays)

    1. no… this library not have stop watch/timer, this library only aim to control this kind of led modules (and to display any sort of data you want)

      … but you can look here:
      and you can use both libraries to accomplish your goal

  11. Thank you. I have tried your example and assuming the “text_2″ in the last line of the code is actually scrolltext_5. After the first 3 groups of numbers: 15:22:01 it follows without end (continuously) all kind of characters, dots, numbers etc and never stops. The for loop does not advance like it is supposed to. As you know I am working with the modified files for 96×16 matrix.
    the following example:
    char scrolltext_5[]=” * Hello Everybody ! * “;
    works OK. No strange characters after the scroll and the scroll restarts in the void() loop

  12. Hello Silvius, I am using your library and example code with a rgy matrix panel that I pulled from a old casino jackpot sign. Its working but I have a problem. Everything is mirrored. Text reversed and scrolling from left to right. I am just beginning with coding so I am not sure how to fix this. I think I need to change lsb to msb or vise versa. Any help would be greatly appreciated. Thanks!!!

    1. I would be happy to give a helping hand… but I think I can’t without see (and work with) that device… Sorry…

  13. Another thing is I also have a bunch of 16X40 rgb panels. If anyone is willing to reverse engineer them as to get the pin connections. I would give them a few for doing it.

    1. I would like to reverse engineer some of these panels… 🙂
      but I do not think that is feasible… I do not know your location, but I guess it is about another continent than mine… 🙂 (by the way I am from Romania)

  14. Silvius I live in Las Vegas Nevada USA. I would be willing to send you some of these panels for you to reverse engineer. I realy would like some help and so far no one else has been as willing. I you are ok with this I can give you my email.

    1. Hmm… I consider this “research” a very interesting challenge. 🙂 I will send you a private message by email…so we can keep in touch…
      And also I will think how to experiment with your first issue…last bits to be the first out.
      maybe in 2-3 days I will able to give some results…

  15. Silvius on my first post can you show me how to reverse the bit order. It need to be opposite from the way it is now ie the last bit needs to be the first out. I dont know if I am explaining this right. Thanks

  16. Hey Silvius,

    first: thanks for that great library. Saved me a lot of work. I’m using the triple display version, but a more general question with which you might be able to help.
    I use a slightly changed version than your display. It also uses the 74hc595 for driving the LEDs and 74HC138 for multiplexing the rows, but the 4953s are changed to standard transistors (type S8550).
    I tried to increase the brightness of the LEDs to make it better readable. I measured the current for static complete red display and was supprised it was only about 2mA. When connecting a led to the output the 595 and directly to 5V, it works perfectly and has a current of about 12mA running. This is quite good compared to the datasheet (which states a current of 7mA with low voltage drift). But 2mA is way below that value a single output can supply.
    I think it has to do something with the multiplexing, but couldn’t find a problem in the code. Have you ever measured the current in your setup for each single LED/output?

    1. No. I have not measured consumption for one LED only. But I measured consumption for entire module, with all red/green and red+green on. Here are the results:

      All GREEN on = 1.18A at 5V = 512 LEDs
      All RED on = 1.20A at 5V = 512 LEDs
      All RED+GREEN on = 1.62A at 5V = 1024 LEDs

      I hope you find this information useful. It is interesting that total consumption not doubles as I would have expected… But it is better this way … because one yellow pixel is not much brighter than green (or red) pixel /LED.

      I think that multiplexing have the effect of a kind of PWM with these LEDs. Only one row(of 16) is on at a time…

      Also I heard that modules with S8550 transistors have some issues with bright…
      I suggest also to try original version of library with one panel… to see if behaves the same.

      1. Thank you very much for that info. Yeah mulitplexing is kind of PWN, with 1/16 duty cycle.
        With your results of about 1.2A at full red means all 64 LEDs in a row have about 18mA each, which is realy nice. Maybe little less because some current is needed for ICs and co, but not that much.
        I will have a deeper look at the transistors and try to spot the problem. In case I find something I will post here.

      2. I think I will also change to IC 4953 as transistors for my future projects. Only thing I’m unsure is the connection. They have two drain pins for each of the two MOSFETs, are they both connected in your display? On the photos on instructables it looks like both drain pins are connected on the PCB together to the lines. Is that correct?

        1. My intention was to put some image at the end of post about similar module (with 4953) but right now I have some issues with hosting…and I can’t upload new images… 🙂
          … so I will send to you a private email.

  17. I have bought this same panel in ICstation and there is no way to work;
    lights just a few LEDs and nothing more. You need to connect the VCC input of IN?
    And the (+) and (-) plate? Thank you for an answer

    1. My module has no VCC pin input at IN connector… at least it does not have marked.
      So I powered the module from dedicated connector. GND and +5V.
      And I connected signal pins and GND(data IN connector) with MCU board.

  18. Hi Silvius,
    I was referrinh your myMatrix library for multicolor p10 panel. I am actually working on single color p10 module. So is there any facility available in your library to configure for single color?
    Or any other library for single color p10 available so that I can refer?


    1. for single color p10 you can try this library

      There are several libraries for monochrome modules, I saw them when looking for a solution for this RGY module, but i did not remember one in particular…

  19. Hi

    After purchasing and building the board from Icstation I tried to compile the demo code but this is the error returned (verbose enabled):
    Arduino: 1.6.12 (Windows 7), Board: “Arduino/Genuino Uno”
    C:\Users\asus\Documents\Arduino\libraries\myMATRIX\examples\myMATRIX_Demo\myMATRIX_Demo.pde:86:46: note: candidate is:
    In file included from C:\Users\asus\Documents\Arduino\libraries\myMATRIX/myMATRIX.h:32:0,
    from C:\Users\asus\Documents\Arduino\libraries\myMATRIX\examples\myMATRIX_Demo\myMATRIX_Demo.pde:47:
    C:\Users\asus\Documents\Arduino\libraries\myMATRIX/myMATRIXClass.h:81:10: note: void myMATRIX::printString(uint8_t, uint8_t, uint8_t, uint8_t, char*, uint8_t)
    void printString(uint8_t x, uint8_t y, uint8_t For_color, uint8_t Bk_color,char *p, uint8_t font);
    C:\Users\asus\Documents\Arduino\libraries\myMATRIX/myMATRIXClass.h:81:10: note: candidate expects 6 arguments, 5 provided
    Using library myMATRIX in folder: C:\Users\asus\Documents\Arduino\libraries\myMATRIX (legacy)
    exit status 1
    no matching function for call to ‘myMATRIX::printString(int, int, int, int, const char [5])’

    Any suggestion to solve this trouble?

    1. Yes… I think you are not using exactly this library, but a modified version (modified by Tomas Kovacik). You probably found it on github…

      You have two options:

      1. Uninstall that library and install from here: In this original library, demo code is working for certain.

      2. Use modified version and study myMATRIXClass.h and myMATRIX.h … I never tested this modified library because I have only one module… and modified version is for 3 modules.
      I looked at it a little and I saw that in prinString() is added another parameter , the last, for the font… but is better to study yourself…it can be more changes…

  20. Hello again and thanks for yourreply.
    Tried option 1 and obtained this result:

    Arduino: 1.6.12 (Windows 7), Board: “Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)”

    Build options changed, rebuilding all
    C:\Users\asus\AppData\Local\Temp\ccMcpaoS.ltrans0.ltrans.o: In function myMATRIX::t_shiftOut(unsigned char, unsigned char) [clone .constprop.15]':

    ccMcpaoS.ltrans0.o:(.text+0x8c): relocation truncated to fit: R_AVR_7_PCREL against no symbol’

    collect2.exe: error: ld returned 1 exit status

    exit status 1
    Error compiling for board Arduino Pro or Pro Mini.

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    Same result with Arduino UNO or Mega

    1. Hm. It should work… Right now I compiled with Arduino IDE 1.6.7 Linux64:

      File -> Examples -> myMatrix -> myMatrixDemo

      1.Compiling for Arduino Pro or Pro Mini:
      Build options changed, rebuilding all

      Sketch uses 4,894 bytes (15%) of program storage space. Maximum is 30,720 bytes.
      Global variables use 351 bytes (17%) of dynamic memory, leaving 1,697 bytes for local variables. Maximum is 2,048 bytes.

      2.Compiling for Arduino Uno:
      Build options changed, rebuilding all

      Sketch uses 4,894 bytes (15%) of program storage space. Maximum is 32,256 bytes.
      Global variables use 351 bytes (17%) of dynamic memory, leaving 1,697 bytes for local variables. Maximum is 2,048 bytes.

      3.Compiling for Arduino Mega:
      Build options changed, rebuilding all

      Sketch uses 5,116 bytes (2%) of program storage space. Maximum is 253,952 bytes.
      Global variables use 351 bytes (4%) of dynamic memory, leaving 7,841 bytes for local variables. Maximum is 8,192 bytes.

      So…I think that is something wrong in your Arduino IDE install… on the core side… or maybe in libraries…
      perhaps you have done tests/experiments before with this project or other projects… and in this experiments you have altered some files…

      I noticed that you use 1.6.12 and I have only 1.6.7… but I don’t think this make any difference…

      However, to be sure I will install 1.6.12 version next 1-2 days. I had anyway to update, and this is a good opportunity.
      But it will take some time to reinstall all libraries and boards.
      Just between us: 🙂 I did not know it already reached this version.

      In the meantime you can try with a fresh install (possibly in another location/folder/directory)

      Good luck!

      1. I installed Arduino IDE 1.6.12. and myMatrixDemo compiles for all 3 boards which we were talking about…

        So, with a fresh install everything is ok.

  21. Hello
    Uninstalled Arduino IDE with all libraries and reinstalled IDE 1.6.7 and it started to work the right way. Many thanks for the help and many thanks for the library too!
    Just discovered I forgot to solder an entire side of pins of a ‘595 and that yellow is not so yellow 🙁 but now I’m satisfied.

  22. on my Arduino IDE 1.6.8, 1.6.12 and 1.6.13 the problem with

    myMATRIX::t_shiftOut(unsigned char, unsigned char) [clone .constprop.15]’:

    ccMcpaoS.ltrans0.o:(.text+0x8c): relocation truncated to fit: R_AVR_7_PCREL against no symbol’

    (see amaze 1 above) pertains for every board. I have installed a lot of libraries for STM32 boards and cannot find a solution.
    Success anyone?

    1. library is not made for stm32 (unfortunately) because I was forced to use direct port manipulation so it works only with atmega MCU… I have plans to experiment/test/update library with stm32, but not yet… sadly

      about compiling error: me and amaze1 concluded the solution was reinstalling Arduino IDE because is something wrong in that Arduino IDE install; possible on the core side… or maybe in libraries

      for amaze1 solution was a fresh install so you can try in another location/folder/directory … even if you don’t want to “touch” existing setup… if it turns out broken, you will be compelled anyway

      Good luck!

      1. Hope this library solves my issues… so far same results here. I have the IDE 1.6.12 running and the same error message appears:

        myMATRIX::t_shiftOut(unsigned char, unsigned char) [clone .constprop.13]':

        ccIgLsPD.ltrans0.o:(.text+0x8c): relocation truncated to fit: R_AVR_7_PCREL against no symbol’

        If you could help would be great.

        Thanks, thomas

        1. When I comment out the *outGreen there seems to be no problem..

          void myMATRIX::t_shiftOut(uint8_t dataRed,uint8_t dataGreen)
          uint8_t i;
          uint8_t val;
          for (i = 0; i<8; i++)
          val = !!(dataRed & (1 << (7 – i)));
          if (val) *outRed |= bitRed;
          else *outRed &= ~bitRed;

          val = !!(dataGreen & (1 << (7 – i)));
          if (val) *outGreen |= bitGreen;
          // else *outGreen &= ~bitGreen;

          //Clock Pulse
          *outClock |= bitClock; //CLK, HIGH
          *outClock &= ~bitClock; //CLK, LOW

          1. Update:

            I identified an option in platform.txt that cause the problem…

            in this line:
            compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto

            we must delete -flto option so the line will be like this
            compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD

            You can read about flto here:

          2. Finally! This is best solution and do not involve any modification of Arduino files:

            disable optimisation for t_shiftOut in myMATRIXclass.h and myMATRIXclass.cpp:

            void __attribute__((optimize(“O0”))) t_shiftOut(uint8_t dataRed,uint8_t dataGreen);

            Have fun!

        2. I am working on it… It is about linker options of newer versions of AVR boards.

          Until now I managed to compile without problem with downgraded version of AVR boards.
          So I install 1.6.7 version in Boards Manager -> Arduino AVR boards by Arduino.
          Does not matter IDE version, but Boards version.
          I tried with 1.6.7 and it worked. After I upgraded to 1.6.15 it stop working.
          I downgraded again to 1.6.7 and start working again…

          So, even if I have not yet managed to see exactly where the problem is, you can compile with 1.6.7 in Boards Manager -> Arduino AVR boards by Arduino.

          I will continue to search a better solution…

        3. Hello thomas …I had the same isseu and i delete myMatrix from library and download a new from another computer copy and paste on same place was and that fix my problem

  23. Silvius,

    thanks for the great software. Works like a charm on the older version of arduino. Modified it already to fit a larger 16*64 screen. Documention is good and clearly written. Thanks for the quick support. Hopefully you’ll find time to implement these features.


  24. Hi Silvius! Thanks for your project. One thing that I missing here is detail explaining how this all matrix board with all the components works.

    As you mentioned ABCD are for lines scanning because 2^4 = 16. So if I want to display in the first row should it all ABCD = 0 or to display fourth row – AB=11?


    I want to write my own code for PIC microcontroller for this matrix and trying to figure it out how your code works. Can you make a detailed documentation on your codes? And can you explain why you use Timers and that’s their purpose here
    Also how do you implement refreshing screen? Are you doing it with ClearScreen function every time new led is turned on and then you scroll text is it turning off and on very fast new leds or just keeping them all turned on at once? Thanks.

    1. I will try to write some details to help better understanding of the code…
      In the coming days I will try to do this. I will add this info at the end of main article.

      I would be glad that you may rewrite library for PIC world.
      Check at intervals of a few days for updates…Or if you put the correct email address you will be notified 🙂


    2. I started working on documentation, I hope to finish writing in 7-10 days … I’ve already posted the first part.

      And at the end will be also in downloadable PDF file.

  25. Hi I am looking for this suuport for multiple modules in row’s and column’s. Do you have any support for this multiple module handling

  26. Also could you enlighten me how myMatrix.clearScreen() works? I managed to turn on LEDs but can’t turn them off. I tried by RI and GI pins setting low, when high clock and high latch.

    1. myMatrix.clearScreen() just put all bits from the buffer to 0. nothing more.

      writing to display is made only in timer interrupt… one row (of 16) at a time.
      every time when interrupt is run only one row is send to display. but is run many times per second… ( I can’t recall now how many).

      so… all other display function just write to buffer… not to display…
      the display is written only in timer fuction…I hope what I wrote help you somehow..

      1. Could you be more specific, what do you mean by saying buffer? When you shifting zero you only set high on clk pin and low on GI and RI?

  27. Tested again. It turn out it’s impossible to turn of LEDs, they only get dimmer if shift all the zeros to shift registers. Bummer.. Also is it true that when shifting zeros, they go to shift registers responsible for red and shift registers responsible for green colors simultaneously? This would mean that when shifting 32 zeros, really 64 goes in…

    1. myMatrix.Show() is the only place in library where we actually write to matrix…
      is defined in myMATRIXclass.h and is implemented in myMATRIXclass.cpp and instantiated in myMATRIX.h.

      the buffer is is composed of two arrays, one for each color…

      volatile byte matrixBufferRed[64];
      volatile byte matrixBufferGreen[64];

      myMatrix.Show() just read these two arrays and send them row by row (one row for red and same time on rof for green)
      one row of two color line consist of two rows send each on different pin…
      this is simplified version on myMatrix.Show()… I removed some comments and some traces of previous versions…

      void myMATRIX::Show()
      byte row4=row*4;
      *outOE |= bitOE; //OE HIGH => screen OFF

      *outSTB &= ~bitSTB; //STB LOW
      *outSTB |= bitSTB; //STB HIGH … high to copy shift register’s data to output
      //delayMicroseconds(7); //???;
      *outOE &= ~bitOE; //OE LOW => screen ON
      if (row==16) row=0;

  28. Hello,
    your code can be edited for 1/4 scanning
    if so how?
    by changing the code in myMATRIX :: Show ()?
    thank you for answer

  29. can i use this library for 16*128 matrix display??

    i tried using but it takes my 16*128 matrix display as 16*32 matrix and prints the string 4 times.

    has anyone used it eith 16*128 matrix?

  30. Hello,
    If i send you (for free) one similar module, can you help me?

    Best regards.

    1. what kind of problem have you ?

  31. HELLO Silvius HOW ARE YOU

  32. an i use this library for 16*64 matrix display??

    i tried using but it takes my 16*64 matrix display as 16*32 matrix and prints the string 2 times.

    has anyone used it eith 16*64 matrix?

  33. “partial support for 3 displayes” Is it just replacing the library? Thanks

    1. Yes, but example not working… the one who adapted the library changed some functions. You will need to study the library to see what has changed.

      1. OK Silvius, thanks for the reply;
        Have you done a few more examples of your library, for example, for a clock or scrolling text in multiple colors or perhaps for multiple modules? Thank you++

  34. Greetings Silvius!
    Have you updated your library to support left-to-right scrolling or other updates? Thank you

    1. Hello!
      Unfortunately, lately I did not have time to work on this library.
      And I have not even seen modules of this type on the market …

  35. Hi Silvius –
    Hope you’re well in this current crisis! You might remember me – I hit you with lots of questions over on Instructables when I was working with these matrix boards and your magic libraries in 2016! Did you manage to understand the circuit diagram of this unit by any chance?

    Stay safe!

Leave a Reply to Josh Cancel reply

Your email address will not be published. Required fields are marked *

OpenHardware.Ro © 2017 Frontier Theme