16x8 RGB LED matrix: need some help with schematic - Page 1
Forum section: electronics / projects

author: mohf
author_rank: Contributor
timestamp: December 13, 2013, 11:51:17 pm
content: Hi EEVbloggers,A few days ago I designed an Eagle schematic and board layout for a 16x8 RGB LED matrix (SMD 5050 LED modules), making it a total of 16x24 = 384 LEDs.To control all 384 LEDs, I multiplexed the LEDs and use 5x 74HC595 shift registers. Because the maximum output current of the 74HC595 is not enough, I connected 2x UDN2981 between the 2x shift registers and the anodes of the LEDs, and 3x ULN2803 between the shift registers and the cathodes of the LEDs. To limit the current, 24x resistors are added between the 3x shift registers and the 3x ULN2803's. Edit: and 24x resistors at the output of the ULN2803.Because it's the first time using these IC's and some doubt about the wiring, I thought it might be better to make sure everything is OK before printing the PCB.Updated 16 december- Eagle Schematic 300ppi- Eagle Boardlayout 300ppiFurthermore, some questions:- As far as I have understood from the datasheet and google, the ULN2803 is basically an array of 8 NPN transistors, with the base connected to the inputs, emitter to the GND and the collector being the output. Is this correct?- Is the same true for the UDN2983, except that it is an array of PNP transistors instead of NPN?- Assuming VCC = 5 volts. How can I calculate the resistance of the 24x resistors to allow x current through the LEDs?

author: Rufus
author_rank: Super Contributor
timestamp: December 14, 2013, 01:41:16 am
content: Quote from: mohf on December 13, 2013, 11:51:17 pmThey both have NPN darlington transistors which means their on (saturation) voltage is quite high. 1.6v for the UDN2983 and 0.85v for the ULN2803 at moderate current. You will loose almost half of the 5v supply in the drivers and the forward voltage of the blue (and possibly green) LEDS will be higher than what is left - it isn't going to work.You need a higher supply voltage or better drivers.

author: kizzap
author_rank: Unknown
timestamp: December 14, 2013, 01:42:46 am
content: It looks like the traces aren't going all the way across on the bottom?

author: mohf
author_rank: Contributor
timestamp: December 14, 2013, 10:40:34 pm
content: Thanks for the respones.Quote from: kizzap on December 14, 2013, 01:42:46 amSeems like they somehow disappeared when making the screenshots. Fixed in Eagle now.Quote from: Rufus on December 14, 2013, 01:41:16 amHow do you see that they both are NPN? The UDN2983 datasheet shows a current of -500mA, and as far as I know only PNP transistors have negative current... or am I missing something?If they are both same transistors, why is the Vce so much higher for the UDN2983, wouldn't it be better to just use the ULN2803?Also: I want to supply 50mA (or as high as possible) through every LED when turned on. Is this even possible, considering that both IC's can supply max 500mA per pin, with a maximum of 24 LEDs that can be turned on at a time? And how do I limit the current to 50mA, should I put the resistors at the output of the transistor IC, or at the input (base) of the transistors like I have now? (assuming I'm increasing the VCC supply voltage)This is quite confusing...

author: Rufus
author_rank: Super Contributor
timestamp: December 15, 2013, 02:18:16 am
content: Quote from: mohf on December 14, 2013, 10:40:34 pmYou look at the circuit diagram in the data sheet. The UDN2983 is higher because it also needs a PNP transistor to drive the NPN darlington.Quote from: mohf on December 14, 2013, 10:40:34 pmNo it isn't possible. The UDN2983 output is 500mA abs max and you are asking for 1200mA. You need higher current column drivers. You also need resistors in series with each row the resistors you have are in series with resistors the ULN2803 already has built in. There must be other matrix drive schematics on the web you can look at.

author: Kjelt
author_rank: Super Contributor
timestamp: December 15, 2013, 12:15:54 pm
content: Have you considered using ws2801 ws2812 rgb led current ic's, they are (as you might know) serial shift registers directly driving a smd rgb led each and used frequently and cheaply available on ebay? If so why did you still use the multiplexing layout, power saving?

author: mohf
author_rank: Contributor
timestamp: December 15, 2013, 05:56:49 pm
content: Update: reuploaded schematic and board pictures: added resistors and a 7805 for the shift registers so input VCC can be higherQuote from: Rufus on December 15, 2013, 02:18:16 amThe datasheet only mentions Absolute Maximum Continuous Current of 500mA. With all LEDs turned on, the duty cycle will be 1/16th. Wouldn't the low duty cycle increase the max current?Otherwise, I have to use 20mA per LED, which means 20/16 = about 1mA per LED... (I hope I am wrong...)Most other matrix schematics are crap. Many use discrete transistors, which is not what I want to use, or they use the TLC5940 which are very expensive (and not better than my current set-up). Others seem to use a mix with some transistor array IC, direct connection with shift register.Anything you can recommand?Quote from: Kjelt on December 15, 2013, 12:15:54 pmNo, I didn't know. I searched everywhere for LED drivers, CC drivers and even thought about the TLC5940. Never thought of a LED module with an IC integrated.They do look very neat with their IC controller and the ease of use. However their max speed of 800kHz is quite low, which limits the max number of LEDs. With the 74HC595 I can just send all the data through SPI at ~16MHz with an xmega and keep some processing time.They are cheap, but not cheaper than my current BOM:- 2x [$23 per 100 LEDs]Total: $46vs:- 2x [$4.09 for 100x LEDs]- 1x $3.32 for 20x shift registers- 1x $2.12 for 10x ULN2803- 1x $5.51 for 5x UDA2981Total: $19.13And yeah, would be a waste if I had to throw away all components, schematic and board layout.

author: Rufus
author_rank: Super Contributor
timestamp: December 15, 2013, 08:07:49 pm
content: Quote from: mohf on December 15, 2013, 05:56:49 pmBut still a whole lot better than something that doesn't work at all....

author: mohf
author_rank: Contributor
timestamp: December 15, 2013, 08:51:17 pm
content: Quote from: Rufus on December 15, 2013, 08:07:49 pmWhy does it not work? As you said, the VCC has to be higher for the transistor voltage drops, so I have added a 7805 for the shift registers (which need 5 volts) so that I can increase the DC input voltage to 7-12 volts.As far as I can see, the only problem with my current schematic is that the current through each LED is much lower than what they are capable of.Perhaps you can recommand me something better?

author: codeboy2k
author_rank: Super Contributor
timestamp: December 16, 2013, 09:26:48 am
content: Quote from: mohf on December 15, 2013, 05:56:49 pmare you scanning rows and columns one LED at a time??or are you setting all row bits on at one time and scanning the columns? (this means each led gets 1 resistor, but then the column driver needs 1200mA or 2400mA for all the LEDS in a column)or are you setting all the column bits on at one time and scanning rows (not good, since you get varying LED currents, and thus brightnesses)or some combination of half/half scanning??I think we need to understand your multiplexing plan.

author: mohf
author_rank: Contributor
timestamp: December 16, 2013, 07:48:51 pm
content: Quote from: codeboy2k on December 16, 2013, 09:26:48 amWhich ever way is the most efficient is how I want to programm the multiplexing. If I look at the schematic, I see 2 methods:Method 1- scan from row 1 to row 24: make only row 1 low, send 16bits data, make only row 2 low, send 16bits data, etc. The duty cycle will be 1/24thMethod 2- scan from column 1 to column 16: make only column 1 high, send 24bits data, make only column 2 high, send 24bits data, etc. The duty cycle will be 1/16thAs I see it, the second method will be the best, because the average current will be the highest, and because I will have to itterate less with a microcontroller.Quote from: codeboy2k on December 16, 2013, 09:26:48 amThat would be a big waste of resourcesQuote from: codeboy2k on December 16, 2013, 09:26:48 amSorry, do you mean method 2 as described above? Why does that lead to varying LED currents?

author: codeboy2k
author_rank: Super Contributor
timestamp: December 17, 2013, 01:15:27 am
content: Lets say you choose 5mA for each LED.Method 1, setting 16-bits of column data, scanning the 24 rows:Duty cycle is 1/24. You need 5mA per LED to be the average current across the duty cycle, so 5mA x 24 = 120mA from each source column driver. So now, the worst case, with 16 LEDS in a single row all on at one time, each LED will see 120mA/24 = 5mA average, and the row driver will need to sink (16x120mA)/24 = 80mA average. The Row drivers see the 1/24 duty cycle, but the column drivers see 100% duty cycle if all 24 LEDS in a column are on at the same time (so scanning the 24 rows does give the source driver any break in sourcing current ==> 100% duty cycle). With 8 outputs on, and assuming 70C temperature, the '2981 column driver can only support 75mA max at 100% duty cycle.so method 1 can work OK, but my 5mA choice for an average LED current is not possible, you need to keep the '2981 column drivers around 75mA or so (see chart on page 5 of the datasheet), which means only a maximum 3.1mA average LED current with this method.Method 2, setting 24-bits of row data, scanning the 16 columnsduty cycle is 1/16. Lets assume 5mA average current per LED again, 5mA x 16 = 80mA sinking from each row driver.fits within the maximum current allowed when 100% duty cycle needed from each row driver when all 16 leds in a row are lit (i.e. scanning 16 LEDs does not give the row driver any break and must sink current for every column... => 100% duty cycle). The worst case for the column driver, with 24 LEDS in a single column all on at one time is (24 x 5mA)/16 = 7.5mA average so that's ok too.method 2 seems like the best method, as you determined, then I agree. And now that I've thought about it more, I don't think there should be any brightness issue, as this method scans 1 column at a time, and the resistor is only used for 1 LED at a time. Method 1 would actually have the brightness issues. I got it backwards in my first post.