Zonnestroompanelen in Nederland

duurzaamheid achter de meter

24×8 Arduino News Ticker

Arduino News Ticker with three MAX7219 8×8 dot led matrix devices

by Floris Wouterlood – Leiden, The Netherlands –  May 10, 2016
I remember as a kid walking up with my daddy to the town’s main square where high up on the facade of the local newspaper building a big news ticker would run stirring headlines such as “Japan Tsunami Flushes Tokyo”, or “Wall Street Crashes”. Such headlines triggered my imagination. Oh, if I could create a news ticker for my own pleasure.

With today’s microcontrollers and cheap led displays a child’s dream is coming true. Let’s make a dot led matrix news ticker to inform the world about stock exchange crashes and waves of tsunamis in Japan!

Necessary parts
An Arduino Uno or Nano microcontroller board and several MAX7219 controller 8×8 dot led matrix displays (shorthand: ‘8×8 dot matrix device’). Prices in various internet shops of these devices are in the range of US$ 2-7 a piece. Further needed are wires and two breadboards.

I made my news ticker by daisy-chaining three 8×8 dot matrix devices. Note that an Arduino supports a maximum of eight devices so one is tempted to experiment with more than three. The biggest news ticker you can make is a comfortable 8-device, 8×8 = 64×8 dot led matrix ticker.


Each 8×8 dot matrix device operates under a SPI controller protocol. This implies that, apart from the 5V and ground wires that each display needs there are three pins that matter: DATA, CS and CLK.

As you can see in Figure 1 (left) a dot matrix device has two sets of five pins, that is input pins at the bottom (bottom is where the chip is mounted) and output pins sticking from the top. To daisy-chain a row of 8×8 dot matrix devices, one should be aware that the most right one of the row is called nr. 1, and that counting continues to the left. The input pins of dot matrix display nr. 1 are connected with 5V, GND and output pins 10,11 and 12 on the Arduino board; the output pins of 8×8 dot matrix device nr. 1 are connected to the corresponding input pins of dot matrix display nr. 2, and so on (figure 2). It is as simple as that!

Pin connectivity

for the Arduino is as follows: pin 10 connects to CS, pin 11 connects to CLK and pin 12 connects to DIN. Don’t forget to power the 8×8 dot matrix devices by connecting their 5V and GND with pins 5V and GND of the Arduino. Double-check wires and pin connectivity. The bottom pins of the first 8×8 dot matrix device (nr. 1) are connected to the Arduino, the top pins of nr. 1 are daisy-chained to the bottom pins of device nr. 2, and so forth. As text scrolls from right to left, the nr. 1 device is mounted on the breadboards on the extreme right while the next device is positioned to the left of its predecessor, and so forth (exactly as in figure 2).



I obtained a script from the Brainy-Bits website (https://brainy-bits.com/tutorials/scroll-text-using-the-max7219-led-dot-matrix), and adapted it to my needs. A fully working sketch that runs a news ticker from right to left over three 8×8 dot matrix devices is attached.

Here follow some important issues of the sketch and some comments:

Libraries: the sketch leans on two libraries: ‘MaxMatrix.h’ and ‘pgmspace.h’. ‘MaxMatrix.h’ controls the continuously synchronized shifting of columns of flashing leds that give our brains the impression of magically moving letters. It also transfer these led columns from one dot matrix device to the next. ‘pgmspace.h’ is used to store code in flash memory instead of working memory of the Arduino. This feature dramatically increases the amount of dynamic memory available for lines of ticker text.

The programming of the Brainy-Bits sketch is very understandable for beginners because the programmer has declared pins and connectivity separately and before the  #include expression. That’s really nice! Look at the following section of the script:

int data  = 12;        // DIN pin of MAX7219 module
int load  = 10;         // CS  pin of MAX7219 module
int clock = 11;        // CLK pin of MAX7219 module
int maxInUse = 3;   // how many MAX7219 8×8 dot matrix devices are connected

MaxMatrix m(data, load, clock, maxInUse); // define Library

The programmer could have condensed this into a single instruction: (with some modifications further on in the sketch)

MaxMatrix m(12, 10,11,3);

which would instruct the Arduino to do exactly the same as via the more understandable expression. The ‘(12,10,11,3)’ denotes the SPI wire pin connectivity: DATA-CS-CLK, and the fourth digit instructs the Arduino how many dot led matrices have been daisy-chained (in this case: 3).

Check the following instructions for MaxMatrix:

int maxInUse = 3;  //how many MAX7219 are connected
MaxMatrix m(data, load, clock, maxInUse); // define Library

int data  = 12;        // DIN pin of MAX7219 module
int load  = 10;        //  CS  pin of MAX7219 module
int clock = 11;        // CLK pin of MAX7219 module

int maxInUse = 3;  //how many MAX7219 are connected

The intensity of the leds is controlled via the instruction:
m.setIntensity(2);  // LED Intensity 0-15

The message that the news ticker will present can be typed in the char string line. You can include several lines. Currently these are:

  •  Hello World . . . . . News Ticker . . . .
  • Japan Tsunami Flushes Tokyo . . . .
  • Wall Street Crashes . . . . .

but you can add a lot more.

The speed with which characters scroll over the news ticker is controlled by the parameter ‘shift_speed’ in void printCharWithShift(char c, int shift_speed).

I added in void loop() an instruction ‘shift_speed=100;’ for experimentation purposes with scrolling speed. Select you own speed

Number of ticker lines and length of lines
The number of lines of ticker text and the length of a text string in each ticker line seems to be determined by available dynamic memory. I tested on a  previous-generation ATmega168 Nano the script with 6 lines of text of which one string exceeded 512 characters and with all lines together totaling more than 800 characters. That worked. Impressive! With longer lines of text the 168 Nano will run at some point out of dynamic memory. A text as short as “tikki tikki tembo no sa rembo hari bari ruchi pip peripembo” is effortessly supported. There is a lot of opportunity to experiment and to enjoy.
Power consumption and power supply
As the number of 8×8 dot matrix devices daisy-chained into a news ticker grows, power need grows as well. With 8 devices daisy-chained and all leds on, power consumption will most probably overwhelm the Arduino’s power supply capacity. A busy ticking news ticker has at any time about one-third of the leds on each 8×8 dot matrix device in ‘on’ mode. Transposed to an 8-device daisy-chained, 64×8 dot matrix news ticker bar this would mean that the power need of this apparatus equals that of about two and a half continuously burning 8×8 dot matrix devices. This is a lot of burning leds and it may push the power supply by the Arduino to (or perhaps over) the limit. Also, daisy-chaining the VCC and GND pins of the devices might cause a gradual drop of voltage over the chain such that the last device in the row might start to underperform.

So, for the sake of running a ‘cool’ news ticker an to prevent your Arduino’s power supply from being overloaded I recommend for news tickers that contain four or more 8×8 dot matrix devices to apply an auxilliary power supply via the plus and minus rails on the breadboards. All dot matrix devices are then powered immediately via the power buses instead of through the daisy chain (see figure 3).

four text scrolling directions:

Thanks to the folks at Brainy Bits with their perfect description of how to work with the MAX7219 LED dot matrix module. The magic is theirs!
Brainy-Bits —  see https://brainy-bits.com/tutorials/scroll-text-using-the-max7219-led-dot-matrix/

The sketch can be downloaded here (zipped file)