Go Down

Topic: Choosing transistor and its setup for 8x8 matrix (Read 4232 times)previous topic - next topic

mohitgarg

Jan 24, 2014, 12:45 pmLast Edit: Jan 24, 2014, 12:48 pm by mohitgarg Reason: 1
I wish to use the PCA9635 LED driver connected to and ARM based microporocessor via I2C and its PWM controlled lines to control a 8x8 matrix. This will be powered by USB, so 5V.

PCA9635 data sheet: http://www.nxp.com/documents/data_sheet/PCA9635.pdf

Now the PCA9635 has 16 pins lines available, which can operate as 25mA sink or 10mA source, thus naturally I decided to control them in common anode.

The LEDs I plan to use are rated at 3, 20mA.

Thanks to this wonderful guide: http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html
I know I need to use a PNP transistor on the anode lines, and it has to be rated for max Ic = 160mA, however to be in the safe, we should use upwards of 200.

I know that I need to also add resistance along these same lines to control the voltage to the LEDs.

However, I am still unclear on how to choose the correct transistor, as my Ib is limited to 10mA, and 5V supply. I also need assistance on how to calculate the two resistance (2K7 and 4K7) show in this diagram: http://www.thebox.myzen.co.uk/Workshop/LED_Matrix_files/shapeimage_9.png.

This is shot in the dark, but is this transistor usable in my case: http://www.fairchildsemi.com/ds/2N/2N4403.pdf ?
If yes, why and if not, then why not?

I am not looking for a solution to my particular scenario only, I'd like to know how to choose the correct transistor, knowing:
- Max Ib
- Max V
- Total load current from LEDs in a row/column
- LED voltage

Thanks

fungus

#1
Jan 24, 2014, 01:30 pm

I wish to use the PCA9635 LED driver connected to and ARM based microporocessor

Not an Arduino?
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Paul__B

#2
Jan 24, 2014, 01:41 pm
I'll have to be careful here - don't want to upset Grumpy Mike!

Quote
the PCA9635 has 16 pins lines available, which can operate as 25mA sink or 10mA source, thus naturally I decided to control them in common anode.

Good pick.  The mode that is - not so sure about how easy it will be to multiplex through the PCA9635.

2N4403 is rated 600 mA - it will be fine.  25mA sinking over 8 lines is of course 200 mA (and yes, you drive them with more than 20 mA when multiplexing).

Let's assume a beta of 30 at 200 mA, (minimum specified 100 at 150 mA, 20 at 500 mA) so you need about 7 mA to drive it.  4V divided by 7 mA - 560 ohms, keep the 4k7 to the 5V line.

The LED resistors?  Well, you are going to lose half a volt in the PNP transistors (according to the datasheet) and no doubt at least another half in the "sink" driver, so that leaves about 4 volts, if the LEDs do drop 3V, that's just a volt in the resistor so 25 mA - 39 ohm.  But it is going to be difficult to measure to verify all the calculations - perhaps set it up with 100 ohm resistors and check the voltage across the resistors with an oscilloscope whilst in multiplex.

Personally, I'd use a MAX7219 - does all the multiplexing for you, bright enough, 15 brightness levels for the whole lot, and 3-wire interface (part of which can be shared).

mohitgarg

#3
Jan 24, 2014, 01:49 pm

I wish to use the PCA9635 LED driver connected to and ARM based microporocessor

Not an Arduino?

Nope, this research is for a custom keyboard (The kind one types on) which will use an onboard ARM Cortex M0 controller and will be using the PCA9635 as the backlighting driver.

I hope it isn't an issue posting here, since this subforum is such a  great abundance of information on this topic.

mohitgarg

#4
Jan 24, 2014, 02:41 pm

Let's assume a beta of 30 at 200 mA, (minimum specified 100 at 150 mA, 20 at 500 mA) so you need about 7 mA to drive it.  4V divided by 7 mA - 560 ohms, keep the 4k7 to the 5V line.

How do you make such an assumption for the beta, since I don't see it in the datasheet?
The 560 Ohms, what is the '4V' that you have divided by Ib?
What is the 4K7ohms resistor for and how did we come this value?

The LED resistors?  Well, you are going to lose half a volt in the PNP transistors (according to the datasheet) and no doubt at least another half in the "sink" driver, so that leaves about 4 volts, if the LEDs do drop 3V, that's just a volt in the resistor so 25 mA - 39 ohm.

Where in the datasheet did you find that the transistor will eat up half a volt? I can't find it since I am very new to this.
What do you mean by the "sink" driver?

Good pick.  The mode that is - not so sure about how easy it will be to multiplex through the PCA9635.

Why do you believe it will be hard to multiplex through the PCA9635?

Personally, I'd use a MAX7219 - does all the multiplexing for you, bright enough, 15 brightness levels for the whole lot, and 3-wire interface (part of which can be shared).

I need to keep everything on the I2C bus and that too in FM+. Also, cost is a big big factor and I wan't to keep it as low as possible, whilst balancing with PCB size and complexity constraints.

Thanks a lot for the help, please bare with me, I'm not an electronics guy.

Paul__B

#5
Jan 25, 2014, 12:39 pm

Let's assume a beta of 30 at 200 mA, (minimum specified 100 at 150 mA, 20 at 500 mA) so you need about 7 mA to drive it.  4V divided by 7 mA - 560 ohms, keep the 4k7 to the 5V line.

How do you make such an assumption for the beta, since I don't see it in the datasheet?

Page 2, "ON CHARACTERISTICS" - DC Current Gain/ hFE.  And note I am being conservative here - that is specified as VCE = 2.0 V, not saturation.

The 560 Ohms, what is the '4V' that you have divided by Ib?

5 volts minus VBE(sat) of at least 0.75V and the drop in the driver IC (not researched).

What is the 4K7ohms resistor for and how did we come this value?

It keeps the transistor switched off when not driven.  Value is arbitrary, same as in Mike's tutorial.

Where in the datasheet did you find that the transistor will eat up half a volt? I can't find it since I am very new to this.

VCE(sat) at 150 mA

What do you mean by the "sink" driver?

Your driver IC which pulls the resistor down to switch on the transistor.

Why do you believe it will be hard to multiplex through the PCA9635?

TL;DR - because I haven't studied the datasheet to understand just what it does.  Is is supposed to do the multiplexing for you, or do you have to keep feeding it stuff from the MCU?  I see it does PWM at a high frequency, but didn't see reference to multiplexing.

I need to keep everything on the I2C bus and that too in FM+.

Umm - why?

"FM+" - didn't catch that.

Also, cost is a big big factor and I want to keep it as low as possible, whilst balancing with PCB size and complexity constraints.

Not having to multiplex the display - or provide driver transistors and resistors - is a big "plus" and I'll bet the MAX7219 is cheaper than the PCA9635.

mohitgarg

#6
Jan 25, 2014, 08:56 pm
Page 2, "ON CHARACTERISTICS" - DC Current Gain/ hFE.  And note I am being conservative here - that is specified as VCE = 2.0 V, not saturation.
However it isn't operating at VCE is it? Because at VCE, current gain = 10 according to the graph on page 4, however we aren't as we don't meet the condition of IB=15.

5 volts minus VBE(sat) of at least 0.75V and the drop in the driver IC (not researched).
Okay got it, so even if I use a higher resistance, it should work out if I am not wrong, correct? Could you please have a look at the PCA9635 data sheet, I think it has some methods to not require the base resistor. Is it possible to use only one resistor from the 5V to the transistor to remove LED resistors? If not, why?

VCE(sat) at 150 mA
But we aren't operating the transistor at VCE(sat)

Umm - why? "FM+" - didn't catch that.
Well it is a modular system and has many other devices running on I2C, and I want to keep it that way to stay on one singular bus. FM+ is Fast Mode Plus which operates at 1KHz as opposed to 400Hz on Fast Mode.

Not having to multiplex the display - or provide driver transistors and resistors - is a big "plus" and I'll bet the MAX7219 is cheaper than the PCA9635.
Cheaper only through ebay, not through online suppliers.

mohitgarg

#7
Jan 27, 2014, 10:48 pm
Another question, if I have open drain pins for the sink, and my source (From PCA9635) is PWM controlled constant current, can I skip the LED resistors?

Paul__B

#8
Jan 28, 2014, 08:46 am
The resistors are indeed, only for current control.  You can omit them if the device providing current control is feeding the elements that are powered simultaneously, but because the number of those elements will vary, you cannot current control the common line that is selected at each multiplex step.

If you were driving 7-segment displays, where each digit is selected one at a time and a varying number of segments are lit for that digit, you need to control the individual segment currents, and allow that the digit driver will have to handle that total current.

mohitgarg

#9
Jan 28, 2014, 02:10 pmLast Edit: Jan 29, 2014, 12:25 pm by mohitgarg Reason: 1
Okay, so I can't omit resistors or use PWM for individual LEDs since I am running the LEDs common anode, correct?

What if I where to run them common cathode? That should allow me to not omit them them correct? The reason I wish to omit the resistors is, because I require PWM control of individual LEDs because I may be required to dim the LEDs and even use differently rated LEDs (Obviously given some maximum limit). So could I use a Darlington at the cathode and these lower IC rated PNP transistors in my scenario?

mohitgarg

#10
Jan 28, 2014, 02:49 pm
Also why are 7 NPN Darligton pair ICs so much cheaper than 8PNP Darlington pair ICs?

Paul__B

#11
Jan 29, 2014, 08:44 am

Okay, so I can't omit resistors or use PWM for individual LEDs since I am running the LEDs common anode, correct?

I don't know, not having studied the datasheet.

It is not a matter of resistors or PWM.  They are entirely different things.

Resistors are there to limit the current, the alternative being that the driver IC will perform that function for you.  If it provides current limiting separately to each of the LEDs that you are driving at any one part of the multiplex cycle, while a particular "common" is active (where there is no point in the common being current limited as it has to provide for any or all of those LEDs depending on the particular pattern, but it may have a maximum rated current drive capability) then that means you do not need the resistors in each of those LED drive lines.

PWM does not control the current at all because when it is on, it is on - it merely permits a division of the effect of the current otherwise controlled, as a proportion of the maximum.

Also why are 7 NPN Darlington pair ICs so much cheaper than 8PNP Darlington pair ICs?

How should I know?

Actually, I can guess.  Both cited are in fact NPN ("sink") drivers, by the way.  Well, in my recall, the seven way driver in the sixteen pin [package has been in much more common use and precedes the ubiquity of microprocessors, so have been used in many applications (such as early dot-matrix printers I suspect) where they did not use the whole "byte" and were satisfied with seven.  And the 16-pin package has in the past been more of a "standard" in design and tooling.  As a result, the economy of scale in production presumably favours the seven way driver even when the quantities used may now favour the eight way version.

mohitgarg

#12
Jan 29, 2014, 11:50 am
It's all coming to me now, thanks!

I get the clarification on the resistor and PWM, now, if I were to implement PWM control for each LED in the multiplex, am I correct in saying that I need to have them in common cathode? If yes, can the previously linked components work with this setup?

Go Up