[moderator help appreciated, 2nd page bugged [blank]!!],16x16 RGB matrix pwmmed

Hi everyone,
Just short introduction bout me; ive just finished my last year vwo and im going to study electrical engeneering at the technical university of eindhoven starting from september. I have reasonable soldering skills worked with processing and have a reasonable ic knowhow. Nevertheless, i need your advise!

I have not yet bought anything because i want to be sure i buy the right stuff.

My idea is as follows:

I want to use four 8x8 rgb multiplexed matrices. link

And arrange them in a 2x2 formation to get a total of 16x16 rgb leds = 256 rgb leds = 768 "pure" pixels.

Ive been sniffing around the forum here and it seems that the TLC5940 ic is easier to use than a 74hc595 because of the pwm functionality of the tlc. (or am i mistaken and could one pwm 74hc595 on the /oe pin??)

I would need 4 tlcs then, 1 for the rows with pnp transistors (asthe rows are common positive) and three more tlcs for the collums, 1 for each color. However i probably will be needing to switch the colloms via a transistor too because the tlc can only source 120-150mA and 16x20mA=320mA. However i cannot get my head around what type of transistor to use there.

And if it is possible to pwm the 74hc595's i would be needing a sufficient mwatt rated resistor for each color per collum right?

Or are there smarter ways to do this? All tips suggestions etc are welcome!

You're going to need a little more planning than this. First, forget the TLC5940, you can't use it with this display. Your display is a matrix of 88 RGB LED, with 8 anode rows and 38 cathode columns (one for each colour). The TLC5940 and similar are designed to drive 16 individual single colour leds or 5+1/3 RGB led. It handles the PWM for you fro one LED, but it can't deal with a matrix.

If you want a ready made IC able to drive a LED matrix, you would need to look for something like the MAX6952, although this one can only drive 5 columns so you would need 4+1/5 per display to get all colours. It allows you 15 levels of brightness which it regulates via the current through the LED. I guess there will be some models for 8*8 matrices available, but I never bothered to look for them.

If you want to regulate the colour intensity via PWM, here are a few little back of the envelope calculations to evaluate the available time.

Lets say the desired LED refresh rate for your display is 25 times per second.
You have 8 rows and 24 columns for your 88 display. The maximum brightness will be 1/8 of the LED constantly running.
You need to load the shift register at minimum 8
25 =200 times per seconds and you need to output 20024 = 4800 bits towards
the shift register.
If you want to add 8 levels of brightness, you will need be able to split the timeslot of each LED into 8 parts. That means you have to refresh each LED 200 times per second thus you're going to need to output 4800
8 = 38400 bits per second. For 16 levels it'll be twice as much, 76800 bits per second.
In the first case, you have 26 µs or 416 clock ticks on a 16MHz Arduino between each bit. With 16 colours, it'll be half the time. This will be tough, but not impossible.
And finally, to make it all worse, the human perception reacts logarithmically to intensity, not linearly. So if you go from 1 timeslot to 2, the LED will be appear 100% brighter, from 2 timeslots to 3 only 50% brighter and 7 timeslots to 8 just 14% brighter.

Now if you move to 4 displays, you have two options: More rows or more columns. No matter what way you go, your available time will diminish and your bit rates explode. The only way to keep this under control is to have per matrix one controller to work on the matrices in parallel.

A completely different option is to use some kind of dual ported video ram to refresh the LED. A few kB are amply enough for this application. That's what it was basically invented for and the Arduino would only need to write into the right places the data with no real time constraints. An simple approach is to increment the address counter for each tick which pushes row shift register and each bit of the byte will drive one column. If you want PWM on the colours, write for each byte 8 or 16 versions with the right PWM phase. The circuit for the refresh can be completely independent of the Arduino then. That's what the first home computers in the 80'ies were doing.

I hope, I gave you some ideas how to proceed.


Thanks Korman for your tips and explanation. I'll go look what i could get with the max6952 [or similar controller ic's].
great explanation also bout the refresh rate, i got a much better idea on what is reasonable/doable. ill see if i can find anything on those vid rams and if i understand them well enough to use them;)

Depending on how many i/o ports on your Arduino you have free, you can also work in parallel. With multiple days chains in parallel, specially if they're attached to the same Arduino I/O register, you cut the bitrate by the number of chains. And you won't be able to use digitalWrite(), but that was out of the question anyway at those speeds. For a few dollars, you get an Atmel168 you can dedicate to drive 2 of your blocks.

About the RAM, a random regular SRAM with 32x8 kbit costs $2 or so. You should be able to fit one write cycle into all the reads. You'll end up creating a simple bus manager. Small dual-ported video ram might be hard to come by these days.

In the end, you have many options and it mostly depends on what else your Arduino is going to do and what kind of hardware you intend to build.


This is my first project, so i will have a completely free arduino, if i get it to work etc i might just get a smaller formfactor arduino and dedicate that one to the led rgb matrix. It is mostly bout the learning process and coding etc and for easier connectivity i chose the uno to start with.

I am a bit unsure about what you mean with the multiple daisy chains in parallel, i know what it is [parallel daisychaining] but with what ic's then? the tlc5940 things or one of these maxim series?

With the ram you mean to use it kind of like a buffer just as with a tri-state shift register?

And about the atmel, I've got an atmel 32 16pu [or smething like that] sitting in its ESD box, could i use that one also?

Thanks again for your advice and explanations =].

edit: I made a start with a schematic in eagle. I attached a screenshot of two ways of how i could interface one of those Sram Ic's to the leds, dont mind the specs of the npn/pnp transistors its about the way there connected. I would like to know if the connecting way on the top would work, because in that way i can make the leds turn on when the pin is high [and i do not have to mess with inverted coding etc] or is the bottom way needed? which would mean inverting the pinout in the code.

what would be more handy, because actually, when i think about it now, the 2nd way would probably be because i then need less transistors.

ps. I will probably be using this later on if i can get it to work to visualize music in addition to my self-modded soundreactive fans. (based on a quite simple ne555 circuit in pwm mode and a few transistors to get the audiosignal as input and a fet to switch all the leds in parallel [bout 120 of the 5mm type ^^, and the fet is hugely overrated its 160A peak @ pulsed xD]

Back to numbers: You want a refresh frequency of 25 frames * 8 lines * 8 levels of intensity = 1600 timeslots per second.
Now you have 4 displays * 8 columns * 3 LED colours = 96 bits to send out every 1/1600th of a second.

If you use one long daisy chain with 12 74HC595 registers providing 8 output each, you will have 1/(1600 * 96)th of a second to send the bit, or 6.5 µs (104 clock cycles at 16MHz). If you can't make it, the refresh rate won't be sustainable.

Now if instead of using only one data bit for the output, imagine you use 6 pins on your Arduino on the same i/o register (eg pins 8 to 13 which are all controlled by the PB register) and attach a daisy chain of 2 74HC595 registers to each pin. You then can write the data for all 6 pins with one single assembly instruction and you need to toggle the clock pin only once to process 6 bits. You will have 625 clock cycles to write all 96 bits, which is a lot easier.

Another line to investigate is to use the hardware shiftout register using pins 11 and 13 as clock. This also reduces the work of the processor and might give you enough time to do other stuff meanwhile.

The more I see those number, the more the whole project seems feasible with the Arduino. You will just have to be careful with the programming, but that's part of the fun, isn't it?


Is this like how you meant it with the daisy chaining thing?


i came up with a diff. combination of chaining; 4 chains each consisting of 3 74hc595's

I've been working some more on the start of the pcb with all the 74hc595 chips. Should this work? (aka is it wired correctly?)

Any tips on where i can place the noise suppresion caps?

Ill add the switching pcb (with all the transistors and optoisolators) later on when i finish that.

just a quick idea about how i can control the positive side of the matrices.

74hc595 v2.brd (20.3 KB)

Why don't you try to use an HT1632C IC from holtek. It's memory based and can do PWM. It's the same as sureelectronics 3216 RG(red-green dual-color) led matrices uses and it works very well. We achieved 122fps. Also we already have some arduino code ready on GitHub - wildstray/ht1632c: HT1632C dotmatrix display library for Arduino (and AVR/ARM/PIC clones).

Thank you for telling me about this ic. It looks very interesting and easier to make only tricky thing will be to solder this to me uncommon Packaging type. (used to dip/dil ^^). Also the matrixformat is a bit unlucky and will be hard to combine with your library/code (i guess) so im not sure yet what im going to use. But still thanks for telling me about this ic.

I want to use four 8x8 rgb multiplexed matrices.
Or are there smarter ways to do this? All tips suggestions etc are welcome!

I would get 4 colorduinos and a single arduino and make the arduino control the four slaves. It means quite a lot of programming, but the hardware will be much much simpler.

I need to do something similar, and I need to work out how best to make all 5 boards collaborate. I imagine that I'll have a simple program running on the colorduinos which interprets commands from the arduino. More detail than that I have not yet worked out!

Hmm, also sounds like an idea worth consideration! Thanks for the tip and keep me posted on your progress! (pm me a link or smething like that if you have a sort of worklog, or just pm)

Thank you for telling me about this ic. It looks very interesting and easier to make only tricky thing will be to solder this to me uncommon Packaging type. (used to dip/dil ^^). Also the matrixformat is a bit unlucky and will be hard to combine with your library/code (i guess) so im not sure yet what im going to use. But still thanks for telling me about this ic.

It'll not be too difficult to make adjustments on exiting code. HT1632C has 2 memory mapping: 32x8 and 24x16. you can use 24x16 to 8x16 RGB control, you just have to adjust the bitwise operations and add the new color(we're working with two at the moment).

Oh ok, ill have a look into the coding then when i have time left. Atm getting busier by the day. But ill post when i have made some progress.

Ive googled some more on the ht1632c and it looks quite handy. But would i get away with buying two and using them in the followijg way:

1st: 16 rows common + via transistors; 16 cols red via transistors
2nd: 16 cols green via transistors; 16 cols blue via transistors.

And any hints on where to buy them for a reasonable price cus i only found those sites where you have to buy them with like 1000 at a time. Otherwise i might be sticking to the 74hc595 combined with transistors and 1watt resistors or so per row and collumn

try to buy directly from holtek site. If it cannot sell you directly they will indicate a nearby supplier.

I'm in Brazil and bought 10 for R$2,50 each(it's like 1 euro each) from a local supplier indicated by them.

Hi all, thanks for all your ideas and suggestions. However, i probably will go with the 595 way because it is easier and cheaper to get from where i live.

I have been wondering and thinking a bit about the matrix config and the sinking current.

I am not sure about the following, i have per collumn 16 leds, let's say rated at 20mA. If they all turn on, does the low side ic still only have to sink 20mA or like 16x20mA, and how about the rows?

I'd be very pleased to have some explanation so i can be sure what it is and i dont burn anything.

thanks in advance guys!

I did my 8x32 RGB matrix with 6 TLC 5940 (or 5941) with 74hc595 just fine. So you should be able to do your 16x16 RGB just fine, essentially.

Each "dot" is addressable and can assign whatever color i want. That way, I can set brightness of each dots by assigning darker color to it. What i did is to create frame buffer just like your VGA card. My interrupt routine draws whatever is in the frame buffer. All program has to do is to fill that buffer (I actually have drawtext routine which fills the buffer).

Thanks for the info, could you maybe post or pm me a link to a schematic of your setup? That'd be really helpful! Ill also search for a bit myself.

And i orderd most of the parts, the rgb matrixes have 2 to 3 weeks deliverytime so first gonna test with the 595's and i got some fun ideas to use my arduino as a software lm3914 where the output switches on or off 8 sound reactive fans via optocoupler/transistor.