PixeltoMatrix.exe for a custom LED size matrix

PixeltoMatrix.exe works great for creating binary and hex values for an 8x8 LED Matrix.
Is there another program where you can put in your own LED Matrix size?
I need 4x13.

The difficulty here is that such sizes are not even (sub-)multiples of 8 bits and so there are many more potential arrangements then the eight implicit in the 8 by 8.

How do you want the matrix to be addressed? I have some software written in Processing for doing an arbitrary matrix but the output is in the form of WS2812b data.

The project I have is a very small curved surface.
Here is a mock-up with all the LEDs lit to show layout:

I was going by this video tutorial where he uses the MAX7219 chip to drive the LEDs.

At 3:12 you can see where he uses the PixelToMatrix.exe program to create the hex code for the byte array for a custom pixel graphic.

I'd like something like that for my layout (4x13), I'm not sure how to get the hex value otherwise.

Or am I way off base here? Would love to do this the most efficiently.

Hi, what patterns and animations do you want to make?

You need to design them on a 13x4 grid, not 8x8, so i don't know if that app will be helpful to you.

Also i do not see any advantage of using hex. Binary would be much more convenient for designing patterns.

Paul

Hi, what patterns and animations do you want to make?

Mainly text. Perhaps text that scrolls across.
This is primarily used to monitor 4 frequencies to see if they match a reference frequency. If they match, at row's light is green. If it is off that row's LED will move left or right for lower/higher frequency (one LED per Hz).
When I press a button, it will overtake the monitoring and show the reference frequency.

You need to design them on a 13x4 grid, not 8x8, so i don't know if that app will be helpful to you.

Exactly, that was the point of this thread, although I am open to any input. This is my first time to work with multiplexing LED arrays.

Also i do not see any advantage of using hex. Binary would be much more convenient for designing patterns.

How do you do that?

His hex version says:

byte smile(8) =  {0x3c, 0x42, 0xA5, 0x81x 0xA5, 0x99, 0x42, 0x3c};

would binary (for my 13x4) be (clearly not a smile, just random):

byte smile(4) = {0000011100000, 1110000000111, 1000000000001, 0000011100000};

?

That smile array is not in binary it is decimal and the (4) is not the way to declare an array.

Binary values should be prefixed with "0b", similar to hex values prefixed with "0x".

C arrays are indexed with "[n]" not "(n)" like they are in BASIC. Also don't forget the first element in a C array is zero not one.

Can't see how you can show text on a 13x4 array. How would you display an "e" for example?

You describle showing the "error" in frequency of 4 signals versus 4 reference frequencies. I think you would not really use bitmaps for this. The sketch would calculate the 4 errors, work out which leds need to be set and set them.

Binary values should be prefixed with "0b", similar to hex values prefixed with "0x".

C arrays are indexed with "[n]" not "(n)" like they are in BASIC. Also don't forget the first element in a C array is zero not one.

Ahh, ok.. would this code give me the picture reference?

byte zigzag[3] = {0b1000001000001, 0b0100010100010, 0b0010100010100, 0b0001000001000};

Can't see how you can show text on a 13x4 array. How would you display an "e" for example?

I am willing to give up some legibility for simplicity. This will mostly be used in testing/comparing/monitoring mode.

You describle showing the "error" in frequency of 4 signals versus 4 reference frequencies. I think you would not really use bitmaps for this. The sketch would calculate the 4 errors, work out which leds need to be set and set them.

There is only one reference frequency all 4 signals will test against. The goal is to get them all on green, or at least all match each other vertically (you could then adjust the target frequency to put them on green).

You are absolutely correct: during testing the sketch will calculate for the errors and adjust each row's leds as needed. The bitmaps will just be used to display the target reference frequency or simple 'POWER ON' texts. I have a very limited range I am testing for, maybe 50Hz, it would be easiest just to have each target frequency as a byte graphic.

Your "zigzag" pattern/code looks correct, except i forgot to say you can't use "byte" for this. Only 8 bits, you need 13, so use "unsigned int". Also you still need to declare the array as size 4 not 3, its just that the indexes will be 0 to 3 not 1 to 4.

A piece of code will need to be written to translate these patterns into the 8x8 bits that the max7219 chip needs. You will need to decide how your 4x13 leds will be connected to the 8 digit and 8 segment pins of the chip before that piece of code can be written.

I am finally getting around to building this.
I have breadboarded the LED matrix (ignore colors, had to use what was available):

I am using two MAX7219s to control them as two 8x8 displays, but only the top 4 rows of each (I couldn't figure any other way to do it, is there a better way?).

I am using these tutorials as reference:

On the first link, it says:

The circuit is quite straight forward, except we have a resistor between 5V and MAX7219 pin 18. The MAX7219 is a constant-current LED driver, and the value of the resistor is used to set the current flow to the LEDs. Have a look at table eleven on page eleven of the data sheet:

You’ll need to know the voltage and forward current for your LED matrix or numeric display, then match the value on the table. E.g. if you have a 2V 20 mA LED, your resistor value will be 28kΩ (the values are in kΩ).

Question: I am not sure how to find the voltage and forward current for my LED matrix..?

3DPiper:
I am using two MAX7219s to control them as two 8x8 displays, but only the top 4 rows of each (I couldn't figure any other way to do it, is there a better way?).

Yeah. Use a single MAX7219.

Presently, you (presumably) have seven columns and four rows on the left hand side connected to one MAX, and six columns and four rows on the right hand side connected to the other MAX. Just connect the second batch of columns to the first, and the second four rows to the other four rows of the one MAX. You will just have to do a nybble shift and AND to combine the values for the two sets of rows.

3DPiper:
I am not sure how to find the voltage and forward current for my LED matrix..?

Ignore it. Use a 10k and if it is too bright, use the Intensity register to wind it down. If you only ever want half that intensity, use a 22k instead (which will beneficially reduce your transient current requirement).

Yeah. Use a single MAX7219.

Yay! I would love to only use one chip!

Presently, you (presumably) have seven columns and four rows on the left hand side connected to one MAX, and six columns and four rows on the right hand side connected to the other MAX.

It is hard to see, but I have 4x8 on the left and 4x5 on the right (total 4x13).

The rows 1-4 are hooked up to MAX pins 22 (SEG DG), 14 (SEG A), 16 (SEG B), and 20 (SEG C).

The columns 1-8 are hooked up to MAX pins 2 (DIG 0), 11 (DIG 1), 6 (DIG 2), 7 (DIG 3), 3 (DIG 4), 10 (DIG 5), 5 (DIG 6), and 8 (DIG 7). The right MAX only uses the first 5.

Just connect the second batch of columns to the first, and the second four rows to the other four rows of the one MAX. You will just have to do a nybble shift and AND to combine the values for the two sets of rows.

Connecting the rows is easy, I can just solder the rows of the 4x5 unit in line with the rows of the 4x8 for one lone 4x13 matrix.

I will end up with this:

What MAX pins will drive columns 9-13?

I have no idea what a nibble shift is, help!

Ignore it. Use a 10k and if it is too bright, use the Intensity register to wind it down. If you only ever want half that intensity, use a 22k instead (which will beneficially reduce your transient current requirement).

Ahh, perfect thank you thank you

The 4x5 will be driven by the same DIG pins as the 4x8 but SEG pins D to G. For example if, in your diagram, you cut your 4x13 matrix between colums 7 and 8, the left side would be driven by DIG 0 to 6 and SEG DP to C, and the right side by DIG 0 to 5 and SEG D to G.

Its marginally better to make this cut closer to the middle and so not need to use the DIG 7 pin. This DIG pin can then be switched off which will make the matrix 14% brighter. This can be achieved by setting the "scan limit" to 6. In practice the 14% will make only a small difference to the eye.

A nybble is an old word for half a byte, 4 bits. You can shift by a nybble with >>4 or <<4.

What he said! :grinning:

Pauls,

Thank you! I couldn't wrap my head around not having enough direct pins to drive all columns, I didn't even think of re-using them since I would have enough pins for all rows.

You mean this:

That totally makes sense and lets me use only one chip. Magic!

Thank you thank you

Now all you have to do is code it. :grinning:

I hooked it up exactly as shown above and ran this simple code:

#include "LedControl.h" //  need the library
LedControl lc=LedControl(12,11,10,1); // 

// pin 12 is connected to the MAX7219 pin 1
// pin 11 is connected to the CLK pin 13
// pin 10 is connected to LOAD pin 12
// 1 as we are only using 1 MAX7219

void setup()
{
  // the zero refers to the MAX7219 number, it is zero for 1 chip
  lc.shutdown(0,false);// turn off power saving, enables display
  lc.setIntensity(0,1);// sets brightness (0~15 possible values)
  lc.clearDisplay(0);// clear screen
}
void loop()
{

  for (int row=0; row<8; row++)
  {
    for (int col=0; col<8; col++)
    {
      lc.setLed(0,col,row,true); // turns on LED at col, row
      delay(25);
    }
  }

  for (int row=0; row<8; row++)
  {
    for (int col=0; col<8; col++)
    {
      lc.setLed(0,col,row,false); // turns off LED at col, row
      delay(25);
    }
  }
}

I realize my LED Matrix will not be in order, but I just wanted to see some lights blinky blinky.

However, upon compiling an uploading all the LEDs turned on at the same time and nothing happens.

I'll check my wiring again, but I'm sure I have it breadboarded correctly.

Any other reason this should not be working?

Didn't you have this working before with 2 x max chips?

Have you got anodes and cathodes mixed up? Probe the matrix with 5V + series resistor to check.

Have you got all necessary components connected to the max chip: the Iset resistor and two caps (0.1uF & 10uF)?