Go Down

Topic: Choosing a PNP transistor (LED matrix goodness) (Read 7516 times) previous topic - next topic

denhamcotoe

Hello

I'm trying to figure out which transistor would best suit my needs.  From what I've been able to figure out, I believe I need a PNP type.

Parts list:
4 x LE-MM103 (http://oomlout.com/DATASHEETS/LED-8X8M-03.pdf)
8 x ULN2803A (http://oomlout.com/8TRA/IC-ULN2803A-DATA.pdf)
9 x 74HC595 (http://oomlout.com/products/DATASHEETS/IC-74HC595.pdf)
8 x 560 ohm resistors (These are probably too high)

The current setup:
I have 4x common anode RG 8x8 LED matrices hooked up, with all the anode rows connected in series.
I have 8x sink arrays connected the the 4x2x8 red and green columns. These are switched by 8x 595s
1x 595 to switch the rows
I am _column_ scanning, because I believe the 9th 595, which I am using to drive the rows cannot source enough current to drive a row (64 leds), but can handle a column of 8 (1 per output).

I have opted for this horribly inefficient setup because a) I don't have common cathode matrices, b) I don't have a sourcing led driver, and also c) because I wanted to see if I could do it without setting fire to anything :)

What I'd like to try do next:
First, switch the software back to row scanning.
Instead of the 8 sink arrays, I believe I can just use the 8 x 595s to ground the columns (because a column will now only have 1 led lit at a given time)
Use some PNP transistors to source the current for the rows.
(Eventually to be replaced by a purpose-built IC/driver)

I'll probably purchase some PNPs from Maplins.  Looking at what they stock, these are my options:

Type   V CEO   IC   PTOT   HFE   FT                  
   V   mA   mW   min/max   MHz                  
BC558B   -30   -100   500   220/475   100                  
2N3906   -40   -200   500   100/300   250                  
2N5401   -150   -600   500   60/240   300                  
BC327   -45   -500   800   160/400   80                  
BC556B   -65   -100   500   220/475   100      

So, my question is this: What should I use if I wish to drive up to 64 leds across the 4 matrices?  This part is very new and strange and I'm still fumbling my way through the learning process.  I'm not sure how to work out what spec I need, nor what the specs of the PNPs are (The spec sheet is still confusing :))

Side note:  The array, as it currently stands, is flickering.  I'm pretty sure this is because a) it has 64 columns to scan through (which means 1/64th duty cycle, yes?) ,and b) my code is shoddy!  I'm not too concerned - this was more of a way for me to learn about row and column scanning, as well as helping my understanding of sinking/sourcing.  I believe that using a proper sourcing driver/PNPs and using _row_ scanning will take care of the flicker.

I've attached some images of the jungle!

Thanks in advance for any advice.

Denham



Grumpy_Mike

You have to work out what is the maximum number of LEDs that are going to be on and requiring current at any instant. Then add all the individual currents.
I would say at a guess none of those transistors will do because assume you need 20mA and a row of each matrix is on that gives you 20 * 4 * 8 = 640mA which is more than any of those transistors. Never run a transistor at the maximum current always under rate it by at least 80%.

denhamcotoe

Hi Grumpy_Mike! Thanks for the reply.  I've seen your name all over the 'net in the last month or two since getting my Uno.  I really appreciate the time you take to help newbs like myself.

I have a few more questions if you have some time..

You said 20mA * 4 * 8 to get 640, but is it in fact even more, since there are 2 colours per column? ie, 20*4*16 = 1.2A?

From the ones I originally listed, is the 2N5401 the most powerful? (correct term?) ie, if I made sure I was never powering more than, say, 20 leds at a time, would it suffice?

I've just taken another look at Maplins site, and they also offer these "bipolar power transistors":

Type   VCEO   IC   PTOT   Case                     
   V   A   W   Style                     
BD442   -80   -4   36   TO126                     
BD912   -100   -15   90   TO220                     
TIP2955   -60   -15   90   TO218   

Might any of these be suitable?  These specs seem different to the other group (which were "Low-Power, Low-Frequency PNP Transistors") and I'm sorry, but I don't yet understand the subtleties. 

I am aware (from reading your posts) that the 595 on its own won't cut it, and that I also need to take into account the overall current being drawn.  At what point do I need to switch to external power?  If a single pin on the Arduino can handle a limited amount (is it 60mA?), then am I correct in thinking that the transistors act as a middleman, of sorts? ie, they operate well within the 60mA, but push out more, like up to 600mA, and are directly powered from the 5v line?  Following on from this, does this mean I need to be concerned with the total mA the Arduino can supply, or is the 600mA supplied by the transistor and the transistor is drawing a much smaller amount?

Sorry if some of these questions seem silly and/or self explanatory - I learn best when I'm talking my way through an issue.

Thanks again,

Denham

Grumpy_Mike

Quote
At what point do I need to switch to external power?

When the total current exceeds 500mA, that is the limit from the USB bus.

Quote
If a single pin on the Arduino can handle a limited amount (is it 60mA?), then am I correct in thinking that the transistors act as a middleman, of sorts? ie,

Yes that sort of thing, a transistor allows a small currrent to control a large current. It is 40mA by the way.

Quote
does this mean I need to be concerned with the total mA the Arduino can supply

Yes the transistor is only a switch the current has to come from somewhere.

Quote
Sorry if some of these questions seem silly and/or self explanatory

No problem, that's what this forum is all about.

Quote
if I made sure I was never powering more than, say, 20 leds at a time, would it suffice?

While it would be fine, relaying on you not to do something that is easy to do is not a good way to design electronics, you are bound to forget of have a code accident.
If you are into these sorts of currents then I would look at using some logic level p-channel FETs in place of the transistors.

denhamcotoe

Mike, thanks for the reply.  You realise you're sending me down some rabbit hole and my wife is wondering what's happened to me :)

I'm confused about some things.

I've taken a look at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267391793/7 - Arduino Scrolling 56x8 LED matrix.  He says he's using 7 8x8 LED matrix display (rows=Anodes, cols=cathodes).  In that thread, Hari has used a single 74HC595 to drive the rows (anodes) of his 56x8 matrix.  If I understand correctly, that's up to 1.1A, if he's row scanning.

He's using 7x TPIC6C595 to sink current, the same way I'm using the ULN2803A I think, but if he's row scanning, doesn't that mean he's only ever sinking the current of a single led in each column?

If so, then how is that single 595 driving the rows surviving?

From what I've learnt, I can sink current on the cathodes, or source current on the anodes.

With regards to sinking/sourcing, am I correct in saying that my circuit (which is presently column scanning) is doing both - The 595 is sourcing current in parallel on all 8 of its outputs (say, 20mA x 8 = 160mA) to light a single column, and the ULN2803A is sinking the current of those 8 leds on one of its pins? 

Furthermore, does this mean that if I were to accidentally light 8 columns X 8 rows at the same time, it would need to sink up to 1.2A? (And I'd pop the sink and the 595, and set fire to my Arduino, right?)

Regarding the FETs - I googled and had a look at Farnell... Wow. I think I'm still a little out of my depth at the moment.  There are FETs with specs of -300V to 1kV and -74A to 400A!  I didn't know where to start looking.  More learning is required :)

Once again, thanks for the help - Appreciate it! :)

Denham


Grumpy_Mike

Quote
With regards to sinking/sourcing, am I correct in saying that my circuit (which is presently column scanning) is doing both

Yes a matrix circuit needs both sourcing and sinking of current.
Did you see this:-
http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html

Quote
Furthermore, does this mean that if I were to accidentally light 8 columns X 8 rows at the same time, it would need to sink up to 1.2A?

Yes there would need to sink a lot of current.
Quote
(And I'd pop the sink and the 595, and set fire to my Arduino, right?)

Well not quite, it takes a bit to make things go on fire but it would not do them any good. Chances are that something down the line limits the current although doing damage as it does. Normally only one thing in the chain goes and protects the rest of the chain.

There are a lot of bad designs out there on the net, just because they appear to operate doesn't mean they are good designs.

denhamcotoe

Mike to the rescue again! :P


Quote

Yes a matrix circuit needs both sourcing and sinking of current.
Did you see this:-
http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html

Yes, thanks Mike.  Your tutorial really helped when I was putting things together.  It's because of that that I'm questioning the 56x8 project.  It doesn't seem to fit with my understanding so far.  Since you had commented on that post, I assumed (perhaps wrongly) that it was correctly wired.

The way I see it, because he's row scanning, he's sourcing too much from the 74HC595, and there's no point in having the 7x TPIC6C595s to sink current. It looks to me like the circuit is designed for column scanning. (Like the column scanning circuit on your site, which uses the 2803 sink)

Am I wrong?

Or.. Perhaps another question is this: Even if we are row scanning, and 8 columns are lit, that means that the 74HC595 on the cathodes would need to sink 8x20mA = 160mA. Is it capable of that?  I recall seeing another of your posts saying the 74HC595 can only sink 25mA. If that's the case then I understand the need for the 2803 (or TPIC6C595).

I think the theory is slowly starting to come together..

Thanks again for your help with this.


Denham

Grumpy_Mike

Quote
Since you had commented on that post, I assumed (perhaps wrongly) that it was correctly wired.

Well without seeing both the schematic and the code it is hard to know what exactly what is going on so there is no point jumping in and criticising something that you don't know 100% to be wrong. (does that surprise anybody? maybe that is not the image I give off).

Quote
I recall seeing another of your posts saying the 74HC595 can only sink 25mA.

The 'can' should be interpreted as 'should not be made to', you have to go with what the data sheet says in these matters. For the Q7 output it says the limiting value is +/- 25mA that +/- means sourcing or sinking. Where as the other Q outputs this is +/- 35mA. Odd but that is what the data sheet says.

That's not to say they can't provide more but you are over driving it, risking a short like for the component and increasing the general failure rate. Often in practice things like this become a greater problem at higher temperatures. I have heard many tales of engineers designing things only to find in the summer in the labs with no air conditioning they stop working or fail. The first thing a professional engineer does after getting a working design is to put it in a heat chamber for a few weeks.


denhamcotoe

Quote

Well without seeing both the schematic and the code it is hard to know what exactly what is going on so there is no point jumping in and criticising something that you don't know 100% to be wrong. (does that surprise anybody? maybe that is not the image I give off).


No criticism this side - I know I've still got a lot to learn before I get to do that.  Rather take that as a compliment - I meant that you come across as highly knowledgeable and that if you didn't have advice for the guy then perhaps it was correct.  Anyway, I do like taking things apart and analysing them, though. Trying to learn from others, whether they are right or wrong :)

I must admit - this exercise (and the many more to come) has been to learn about the basics so that I can make a more informed decision when I eventually get around to the real project.  When I got my first 8x8 matrix, I looked over at the coffee table and thought "if I had 299 more of these I could cover the surface of the table, then do cool and awesome things"

Then reality kicked in. 300 (20x15) matrices would cost ±£900.
Hooking up just 4 of these needs a jungle of wire, ICs, and power.
If I'm getting flicker scanning 32 columns, how on earth do I deal with 160 of them?
Obviously there are still many factors I haven't even begun to think of, but I have a goal which I'll eventually get to. Just need to learn a lot first :)


Grumpy_Mike

Quote
Then reality kicked in


It's a sod reality isn't it.  :~

denhamcotoe

Quote

It's a sod reality isn't it. 


Or a challenge :)

If you have any suggestions for how you'd go about hooking up the equivalent 60cm x 45cm worth of matrices, possibly rgb, I'm all ears :)

Go Up