Tricolour 8x8 Dot Matrix Message Board

Hello all,

I'm working on a project that involves controlling a 15x character tricolour message board with the Arduino. I've come to the stage where I need a little help with the coding... If i'm honest I don't really understand the structure of how to set out the main loop and use binary/bit arrays correctly.

Hardware

  • 8x8 tricolour matrix (15x)
  • The Rows are controlled by a HEF4028BP 1-10 4-bit Decoder that in turn signals an 8 channel source driver to power the LED's
  • The Columns (cathode) are connected to an 8-bit serial Shift Register MIC5821BN
  • Shift Registers are 'daisy chained' (data out -> data in) to connect each matrix from right to left across the message display board.
  • One line of shift registers controls the columns for the Red LED's, the other line for Green LED's.

Switch on an LED/pixel

  1. The decoder must be set to the desired row using the correct combination - this is then set HIGH (anode)
  2. Then set the shift register to control the columns - the column is set LOW (cathode) for the LED's to be active.
    If an LED/pixel is not required, then it needs to be set HIGH so that it does not light.
  3. For colour - if green is desired then all of red shift register needs to be all HIGH. For red, all green shift registers HIGH. For orange, both shift registers need to receive the same information on their data pin.

You can see how to control the decoder for the each row on the 'Truth Table' of the datasheet:

Project Objectives

  • Eventually, the sketch should be able to read a serial string message and display on the LED board.
  • Sketch should allow users to enter parameters for the hardware setup such as the amount of columns/shift registers and other values that define the scrolling speed etc.

The serial string should contain key values that determine the displays function... for example:
Colours: [R] for Red / [G] for Green / [O] for Orange
Movement: [ST] for static entry of text, then scroll to view entire message. [SCR] scroll entry from the right of the display

Sample Message: "[G][SCR] Hello World" - this would display "Hello World" in green, scrolling entry from the right.

Stuff I really need to know...

  • As only one row can be active at one time, each row needs to be scanned rapidly in a loop to view 8x rows on the matrix. What's the best way of doing this without other functions interrupting the loop?
  • What's the best way of creating a bit array for defining the characters. (perhaps use an array for the pins of the row decoder too?)

I'm a bit new here and realise this is a rather lengthy post...
I've attached an image and a simple sketch that loops through the matrix rows.
Hope someone can help?

SimpleRowCascade.pde (2.52 KB)

Hmm.. Newbie, first post - long message, but well explained, documented and everything. Fine. I'll try :slight_smile: Well layed out program by the way - I've seen worse on this forum :wink: It can be written with less, but not to worry at this time.

First point: Your current code lights up a the first 8 columns in red and at 1/2 second intervals switches throught all 8 rows. It then becomes the first 16 columns and again cycles the rows .. is that what happens now? (I just want to make sure I've understood your description & code)

Hi, yep your description of the code is exactly right! It was just a simple sketch I put together to check the rows.

I suppose first step would be to ideally define the characters in the sketch using an array? I'm thinking something like...
arrayname[]={B10000000, B01000000, B00100000, B00010000, B00001000, B00000100, B00000010, B00000001}; This would create a diagonal line if rows were cycled. I don't really know how to use the array properly though, how to access it to associate each byte in the array to a row?

Thanks for replying :wink:

Yes.

In the meantime though, I wrote lots of other stuff about the memory allocation in general... I'll send that as a PM to avoid bothering everybody else.

The next program version then is to send that array through the display which will look like scrolling diagonal lines. You can easily extend the array to show somthing that is 10 bytes wide (some arrow shape?)

We have the choice if the array is organized like the hardware (each byte is a section of a row, ie your exmaple is the first part of the bottom row, a few spaced dots) which makes the display routine very simple, but will make putting characters into it harder, and possibly make scrolling a message longer than the display much harder. Well, I do not hink it really matters (unless we find the display must be very simple/fast to avoid flicker/jerky) ... a test will show.

int RowNum = 0 ;
 :
void loop() { assume the loop is a display line-refresh rate
 :
RowNum = (RowNum+1)%8 ; // make rownum go 0..7 cyclically

ehh.. her I was interrupted from Real Life to continue ...

Alright, I've made a few alterations since developing a greater understanding of the capabilities and limitations for this project. Thanks Msquare for your advice :slight_smile:

Overall Configuration

  • The Arduino will be used only to 'translate' a serial binary string that forms an 'image' to control the output to the shift registers and LED's.
  • Processing will be doing the heavy work like storing the message to be displayed and performing scrolling functions etc.

I've successfully managed to construct and access arrays. For the moment I'm using 7x 8x8 matrices to form a 7 character display. An 'image' that is sent from Processing therefore consists of 56 bytes.

Code attached
At the moment the Arduino sketch simply scans through the rows, shifting out each byte in the array respectively.
The Processing sketch reads a text field string, matches up typed characters with the appropriate character definition and then updates parts of the 'image' array.

Question...
Could someone perhaps advise me how I should convert bytes in a 2D array into a string with ',' separators and start/end characters?
Likewise, I think I need to get Arduino to read the serial string and put the bytes back into a 2D array?

Thanks

ImageReplace.pde (21.3 KB)

ArduinoImage.pde (4.75 KB)