Go Down

Topic: PixeltoMatrix.exe for a custom LED size matrix (Read 4556 times) previous topic - next topic

3DPiper

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.

Paul__B

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.

Grumpy_Mike

#2
Jan 29, 2016, 11:26 am Last Edit: Jan 29, 2016, 11:27 am by Grumpy_Mike
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.

3DPiper

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.

PaulRB

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

3DPiper

Quote
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.

Quote
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.


Quote
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:

Code: [Select]
byte smile(8) =  {0x3c, 0x42, 0xA5, 0x81x 0xA5, 0x99, 0x42, 0x3c};

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

Code: [Select]
byte smile(4) = {0000011100000, 1110000000111, 1000000000001, 0000011100000};

?

Grumpy_Mike

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

PaulRB

#7
Jan 29, 2016, 11:32 pm Last Edit: Jan 29, 2016, 11:33 pm by PaulRB
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.

3DPiper

Quote
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?

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




Quote
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.

Quote
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.

PaulRB

#9
Jan 30, 2016, 07:19 am Last Edit: Jan 30, 2016, 07:36 am by PaulRB
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.

3DPiper

#10
Feb 29, 2016, 02:03 am Last Edit: Feb 29, 2016, 04:19 am by 3DPiper
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:

http://tronixstuff.com/2013/10/11/tutorial-arduino-max7219-led-display-driver-ic/

https://brainy-bits.com/tutorials/how-to-control-max7219-led-matrix/


On the first link, it says:

Quote
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..?


Paul__B

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.

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).

3DPiper

Quote
Yeah.  Use a single MAX7219.
Yay! I would love to only use one chip!

Quote
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.

Quote
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!

Quote
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

PaulRB

#13
Feb 29, 2016, 08:13 am Last Edit: Feb 29, 2016, 08:50 am by PaulRB
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.

Paul__B


Go Up