Go Down

Topic: Matrix problem (Read 2881 times) previous topic - next topic

bogdan666

Hello everyone, i am new to this forum, but I've been using arduino for a while now, however i have been using it only for small and simple stuff, but recently i found a very simple (or so it seemed) video about an led matrix with shift registers, i don't quite fully understand how they work, tho i watched a few videos. now, i have 2 problems, the project is for 8x24, but i only had leds for a 8x16 matrix,  thought that the code would still work an i would be able to use it just like this, the second problem is that in the schematic they don't show the led polarity...so i just put them with anodes on rows, plugged it in, changed my output pins, because it was easier to connect them differently on the pcb, and gave it a go...and my matrix is fully on, and only flickers a bit when i turn the speed potentiometer. here is the schematic and the code, any idea is welcome, except the idea of rebuilding the matrix :)
If i have to modify the whole code, just help me out with one character and i will do the rest
...the code is too long and i can't post it as a code

Grumpy_Mike

Do you know what to do to change the polarity of the multiplexing? Have a read of this:-http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html

Most mobile devices will not cope with .ino files. Post it as a .txt file instead and then we can all read it.

bogdan666

ok, i will give it a read, meanwhile here is the code in .txt

PerryBebbington

#3
Mar 24, 2019, 03:24 pm Last Edit: Mar 24, 2019, 03:25 pm by PerryBebbington

PerryBebbington

Please post your code with code tags as per the instructions in 'how to use this forum - please read' item #7.

PaulRB

#5
Mar 24, 2019, 04:32 pm Last Edit: Mar 24, 2019, 04:34 pm by PaulRB
That 74hc595 driving the rows is going to fry. The ones driving the columns are somewhat overloaded also. The current limit for any pin on a '595 is 35mA and 70mA for all 8 pins combined.

With your red LEDs and 100R series resistors, each led will draw around 30mA. That's probably over their maximum, but as you are multiplexing, you will probably get away with it.

Each '595 sinking current from the columns will need to sink 30x8=240mA, more than three times their limit, if LEDs in all 8 columns are lit.

Each pin of the '595 driving the rows will need to source 30x16=480mA for a 16x8 matrix or 30x24=720mA for a 24x8 matrix. That's 20 times over the limit for the pin and 10 times over the limit for the chip. And 3 times what the Arduino can provide. I'm not surprised it is flickering. Can you smell burning yet?

If you care, ask for advice how to fix these things.

bogdan666

i cannot post the code because it is too long, i have stated this in my first post
the leds in my matrix are under driven, just enough to light up, my main problem is that the code is not working.

PaulRB

#7
Mar 24, 2019, 08:00 pm Last Edit: Mar 24, 2019, 08:08 pm by PaulRB
the leds in my matrix are under driven, just enough to light up, my main problem is that the code is not working.
"Under driven"??? Then the schematic you posted must be wrong. You may think the code is your problem, but...

bogdan666


Paul__B

#9
Mar 24, 2019, 10:58 pm Last Edit: Mar 24, 2019, 11:01 pm by Paul__B
Thorough and absolute waste of time.  Use the MAX7219 modules, do it properly.  :smiley-roll:


i used 1k resistors
For 24 lines, you need to use 4k7 resistors.

Grumpy_Mike

Quote
i cannot post the code because it is too long,
You can if you post it as an attachment.

PaulRB

#11
Mar 25, 2019, 07:36 am Last Edit: Mar 25, 2019, 07:51 am by PaulRB
i used 1k resistors
Please carefully review the schematic you posted. Are there any other differences to your own circuit? No-one likes to have their time wasted.

In that case, only the pins of the 74hc595 driving the rows are overloaded. 16x3=48mA compared to their limit of 35mA. So there is still a possibility that this could cause flickering, as the chip begins to fail. And 3mA per led with 1-in-8 multiplex explains she l why your display is dim.

bogdan666

i reviewed the schematic a few times, the only diference betwen that and mine are the resistors and the fact that i have only 8x16 not 8x24, wich i said this in my first post, the code i use i posted in .ino as well as .txt
I don't mind the leds being dim, when i power up my circuit the whole matrix lights up and the whole circuit, includind the atmega 328p and the 595 draws 25mA.

PerryBebbington

I cannot post the code because it is too long, I have stated this in my first post
So you did! Sorry!

PaulRB

I've been reviewing the code....

I think the multiplexing is done by column-by-column. That means the multiplex ratio is 1-in16 or 1-in-24 rather than 1-in-8 which I assumed. My assumptions were based on the circuit designer understanding, well, how to design circuits, such as whether to place the series resistors on the columns or rows for example.

On top of the high multiplex ratio, the code appears very inefficient, using shiftOut() rather than SPI.transfer() and implementing a "walking one" by shifting 24 bits each time rather than simply toggling the clock line.

The code is an absolutely superb example. It demonstrates so many bad practices, over-complications, uneccessary repititions, obfuscations... I don't know where to start in terms of correcting it. My gut tells me to delete it and start over.

I'm really sorry if this all sounds so negative. I now have a deeper insight into why the matrix is so dim and flickers so badly. I take my hat off to the coder. Knowing so little, to have battled doggedly on to get anything working at all shows impressive determination. Bravo!

Go Up