Hi, may be anybody can help me. My trouble in shoing text at led matrix. It shows in inverse mode, WHITE TEXT IN RED BACKGROUND but normally must RED TEXT IN WHITE BACKGROUND, have you any ideas?

p.s. i'm using LED matrix 16x64 and arduino nano and Dancopy's shortened_Final_Code_A.ino sketch

image for example

Naudnaud: Hello

Thank's to Kaziewip for your program, it work perfectly !!

But i have a probleme with my LED Matrix.

My counter work well, but i have a lot of blinking artefact on the screen:

You know why ?

is it posible to get the code you used... please

Has anyone of you tried to port this to another microcontroller? For example an ESP8266?

In this case the direct PORT handling of PORTB would not work. I’m struggling to convert the core of the code to equivalent digitalWrite operations:

PORTB &=~(3<<(data_R1-8)); // data_R2 is LOW; data_R1 is LOW;
PORTB &=~(1<<(clockPin-8)); // digitalWrite(clockPin,LOW);
PORTB |= !((buffer[index]>>(7-i)) & 0x01) << (data_R1-8); // top set of rows
if (HEIGHT == 32) PORTB |= !((buffer[index+128]>>(7-i)) & 0x01) << (data_R2-8); // bottom set of rows
PORTB |= 1<<(clockPin-8); // digitalWrite(clockPin,HIGH);

I converted it to:

byte value = buffer[index];
digitalWrite(data_R2, LOW);
digitalWrite(data_R1, LOW);
digitalWrite(clockPin, LOW);
digitalWrite(data_R1, !((value>>(7-i)) & 0x01));
digitalWrite(clockPin, HIGH);

but it is not working. Does anyone know if a special timing is needed for this clock thing to work well and maybe an arduino direct port handling is faster or slower in the right way compared to a 32 bit microcontroller like the esp? When I added delayMicroseconds(10) in between it only got worse.

Regards, Marcus from Heidelberg

but it is not working…it only got worse.

Marcus, if it was not working, how could it get worse? Such descriptions are useless to us, we cannot see what you can see. You must describe what happens precicely, or we won’t be able to help.

The esp outputs are 3.3V. Does the display require 5V signals?

Perhaps you should try your digitalWrite() code on a 5V Arduino. This will slow down the refreshing of the display and make it flicker, but at least you can test your converted code before you try it on the esp.


Hi! this is exactly what I'm looking for. I'm trying to do a GPRS data GET, and then print on the matrix.. but since I need VOID LOOP for each one.. it does not work. Can you share your code please? thanks

wysi: Hi Thank you petabyte and kaziewip for your interesting libraries. I have my led 64x16 dot matrix from aliexpress.com http://www.aliexpress.com/item/Indoor-F3-75-P4-75-Single-Red-color-LED-dot-matrix-module-304-76mm-64-16/1721794648.html

Based on petabyte's code I've created an timer/interrupt based version, which runs the matrix in background. In main loop I download data from internet with an ethernetshield an update it on the matrix in fixed time intervals.

Beside the matrix display mechanisme, which could in my opinion be improved, I'm not shure, how the current-limiting could be donne right:

  1. I search more data(sheets) of the matrix it selfe. (led peak current, and for how long the peak max shoud last)
  2. The colum drivers (shift register 74HC595) seem not to be the right thing for their job: max 35mA current per output, total max 70mA current output for the hole IC, 0.5W max Power disipation In multiplexing mode, there are much higher peak currents. http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf

  3. The row drivers look much more stronger: p-chanel mosfet FDS4953: 5A contiuos current, 20A peak -> each row is only on for 1/16 time. https://www.fairchildsemi.com/ds/FD/FDS4953.pdf

  4. according to this website, i bought the matrix, it's driven 1/16 constant current. But how should the current be constant when in each row a different count of led's are shining?

  5. if one led consumts 10 to 20mA in constant current, it could be peak 100 to 200mA (16x multiplex) a normal led accepts max 10x times the constant current as peak. The whole matrix is on: 64x 100mA = 6.4A per row, always only one row on. -> 8 shift registers for the whole row: 6.4A/8 = 0.8A continous through ONE shift register. In my opinion something doesnt work right here.

Pleas correct me, if me suggestions are wrong.

conclusen: 1. the shift registers are too weak. 2. the current should be limited individually per row, according to the count of led's on in this row.


Does anybody have the functional program for Arduino MEGA created by Petabyte in post #11?

That dropbox file is gone and all other programs are only for Arduino UNO which does nothing on MEGA. There is 2 fails I can see by quick look (#include <pgmspace.h> and const byte data_R2=11;) but I can’ find any good solution to make it work.

I’m able to run “rotation” in canton-electronics but it’s incredibly slow (0,3s for one scroll) and I can’t do any other code in main loop because the display turns off on that other tasks.

;tldr: Is there any solution how to make that UNO program work on MEGA?

EDIT: I did it. Key is correct pin names. For details just take both files and compare them (and remove <Arduino.h> from Eclipse
So, for search engines: 64x16 led matrix display for Arduino Mega 2560

LED_matrix.ino (27.8 KB)

Hi everyone, I have just acquired one of these displays and am using Kaziewicz/canton-electonics code as a starting point for a message board. I have it working but am struggling to understand how the code works. I am stuck on trying to get the full two rows to display the text. I understand that you fill the reserved memory and then the interrupt routine pushes the memory map out to the display. The difficulty I am having is when I add “font = 2” on line 256 only the top 8 pixels of the 16 pixel high text is displayed on the lower row and nothing is displayed on the top row.

You help appreciated, code attached.

_16_High.ino (26 KB)

on the line: drawChar(120,8,message[count%(sizeof(message)-1)],0,false); Play with the second number "8". use only 0,8,16,32... That is in what Y line you want the text to appear.

Fantastic, just the tip I needed, changing the line as you suggest caused some activity in the right most cell, but it did not scroll. Following this tip lead me to change :

moveLeft(1,0,15); // column spacing,starting row,?

I changed the 2nd parameter from 8 to 0 to correspond to the change on the drawchar as you suggested. It now works beautifully.

Thank You !!

Now on to the next challenge to control the display to display and hold individual lines of text according to an external stimulation ( a push button) and a line break character as the delimiter in the text. Perhaps a comma or other character delimited.

good morning master ... Can you help me? how to connect to a 32x32 LED PANEL P10 with 1 control arduino arduino?

Any solution to add emoticons? Regards

Hello everyone,

I have few questions:

1) How to extend the ASCII table to other languages? I don't understand how to translate between the ASCII tables I find on the internet, and the one that appears in the nice code sketch of Kaziewicz and others.

2) How can I simplify the code of Kaziewicz, or complicate the code of cannon to display a constant message, without "running text". I mean that I like the option of just entering the message in the code and it appears "right away".

  • Many thanks to all the members of the forum. I don't know would I do without the nice code pieces I find here.

I have partially answered my questions, and want to share with you my findings which I’ve summarized in the attached pdf, for good Karma:)

“How to control 16x64 led matrix by Arduino code (pixel by pixel) using provided canon code as a starting point”. See pdf

Canon code explanation Led matrix.pdf (37.6 KB)

With the help of all here I have managed to drive the 64x16 display by WIFI from a serial string in a terminal in a Linux box (Raspberry Pi) or Mac OSX. The Arduino receives serial data and displays 8 characters on the top half as a static display and then a string that scrolls along the bottom half. This can be fed from a serial program but I now use and ESP8266 to receive the data by WIFI from a box on my LAN.

This is very crude since I program by copy - paste - pray. (Thanks!)

EDIT - now multimode Two lines of fixed 8x8 characters Top line of fixed 8x8 characters - bottom line scrolling One line of scrolling 16x8 characters One line of fixed 16x8 characters

Download from here http://www.sunspot.co.uk/Projects/displays/LEDmatrix16x64/LEDmatrix16x64.html

I hope to add a graph using the draw rectangle code.

I wonder if there is any way to reduce the screen brightness for night use? I see nothing in the code about changing the pulse width.

If you improve my "lesson one" code (link above) please comment here.

Sunspot: I wonder if there is any way to reduce the screen brightness for night use?

Yes, that should be perfectly possible by controlling the % of time that the ENable pin is high.

Glad you think it possible - thanks - but interrupt timers are new to me…
I see lines like digitalWrite(en_74138, HIGH); but see no obvious delay statement before a digitalWrite(en_74138, LOW);
I am wondering if the prescaler is the variable to modify?

I aim to have the Arduino read a pot on the analog pin then change the brightness - or perhaps use an ambient light detector.

These display are very good value and almost do the job.

However I have recently noticed these -

which are RGB and about the same cost per pixel as the red one we are playing with-

And I think they can run the Adafruit sketches judging by the pictures the advert displays

(paste the URL please the edit keeps failing)



Pasting links seems to be working fine for me, and I'm using an android phone! So please try harder.

To dim your display, there will have to be some significant code changes. Currently, the interrupt occurs one per scan row. To dim, two interrupts per scan row will be needed. One to send out the new data and switch on the display, and the second to simply switch off the display. The gap between these two interrupts will determine the brightness. If the gap is short, the display will be dim. If it is almost the full length of the scan period, the display will be bright.

Your code is not easy to read. It's not indented and the lines wrap, so it looks a mess. But even so, something about it seems odd to me. I don't understand what pin R2 is for, and I wonder if it is in fact not needed for your display. Maybe your code was written for a bi-colour display?

The code by Phil Kaziewicz was posted earlier on this thread - I added the serial input. Perhaps he should try harder.

Oh yes, he gave the sketch in this post. It is formatted, perhaps you lost it when you copy+pasted it. You just need to use AutoFormat from the Tools menu.

His code has a comment at the top which says it drives a 64x32 display, twice the size of yours. That explains what the R2 pin is for: he other half of a larger display.

When I said "try harder", I was just referring to posting links.