Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsElectronicsBasicsRepairDesignCADComponentsEquipmentElectrical Engineering
ElectronicsKB.com
Contact UsLink To UsSearch & Site Map

Electronics Forum / Basics / January 2007



Tip: Looking for answers? Try searching our database.

LED driving; MOSFETs or Transistors?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason von Nieda - 26 Jan 2007 20:23 GMT
Hi all, I am new to this newsgroup but have been doing some back
reading and this looks like a great resource. I hope to learn a lot,
and maybe contribute some!

My question is to do with driving a matrix of common anode RGB LEDs. I
am building a RGB LED matrix (just 3x3 right now) which I am driving
with a ATmega8 AVR. I'm currently using plain old Radio Shack
transistors to drive the rows and columns but it seems like I am
wasting a lot of juice driving the transistors. Right now I am driving
the transistors directly from the AVR, which can source/sink 25mA per
pin. This causes the AVR to get really hot and I'd like to make my
drivers use way less current.

So, can you give me some ideas on what the "right" driver for my LEDs
would be? I'm looking at Darlington pairs as an option, but the idea of
a MOSFET that basically has no gate draw sounds very appealing. Problem
is I don't know what to look for in a MOSFET. I don't need the big 3
pin with metal tab beasts as I'm only drawing a hundred or so mA
through the transistor. Are there MOSFETs available in a small signal
transistor style package?

For reference, 1/3 of one "pixel" of my display currently looks like
this:
+5v---(E)Row PNP(C)---(A)LED(C)---(C)Column NPN(E)---GND

I realize I can put resistors at my gates to decrease the current used
by the transistors, but I need almost the full 25mA to switch the
amount of current I am using for the LEDs.

Any ideas? I'd love to know how the pros would do this and if there are
any small package MOSFETs I could use.

Thanks,
Jason
Eeyore - 26 Jan 2007 22:48 GMT
> I'm currently using plain old Radio Shack
> transistors to drive the rows and columns but it seems like I am
> wasting a lot of juice driving the transistors. Right now I am driving
> the transistors directly from the AVR, which can source/sink 25mA per
> pin. This causes the AVR to get really hot and I'd like to make my
> drivers use way less current.

Put a resistor in series with the base ! Mosfets are overkill for such an
application.

What's the transistor and what's the load current ?

Graham
Jonathan Kirwan - 26 Jan 2007 23:11 GMT
>My question is to do with driving a matrix of common anode RGB LEDs. I
>am building a RGB LED matrix (just 3x3 right now) which I am driving
>with a ATmega8 AVR.
><snip>

How big of a matrix are you heading towards?  How many columns and
rows?  It's important to know.

>Right now I am driving
>the transistors directly from the AVR, which can source/sink 25mA per
>pin. This causes the AVR to get really hot and I'd like to make my
>drivers use way less current.
><snip>

If I gather you correctly, you have an emitter straight to ground and
you are directly driving the base!  This means that the only current
limit of any consequence is the mosfet impedance inside the AVR
itself, so you are driving VERY hard into saturation -- a terrible
waste.

>I realize I can put resistors at my gates to decrease the current used
>by the transistors, but I need almost the full 25mA to switch the
>amount of current I am using for the LEDs.

By this, I take it that you are arguing that you need 25mA of base
drive.  If so, this means you are probably wanting 500mA of collector
current.  Really??  At least with a 3x3, I have a hard time accepting
this kind of argument.  (Although rule of thumb may be 10x for
saturation, I find 20x-30x covers quite well with many BJTs.)

Add the base resistors for a start.

But in any case, where are you headed?  I think that's what is
important to know.  Whatever that end point is, if it is satisfied,
then probably so will smaller test configurations also be satisfied.

Jon
Jason von Nieda - 29 Jan 2007 17:47 GMT
> How big of a matrix are you heading towards?  How many columns and
> rows?  It's important to know.

Hi Jon, thanks very much for your response. Right now the largest I am
considering is 8x8. The LEDs are RGB though, so it's more like 24x24.

> By this, I take it that you are arguing that you need 25mA of base
> drive.  If so, this means you are probably wanting 500mA of collector
> current.  Really??  At least with a 3x3, I have a hard time accepting
> this kind of argument.  (Although rule of thumb may be 10x for
> saturation, I find 20x-30x covers quite well with many BJTs.)

I was mistaken in my original tests. I thought that I was needing 25mA
to get the transistors to switch my full load but after a little
experimenting this weekend I found it worked just fine with a 1k base
resistor. I was looking for around 500mA (or more!) of collector
current. The reason being that these are common anode RGB LEDs, so at
any given time a single anode transistor might be powering 9 distinct
LED elements. I am using PWM to control the LEDs so I'm actually
sending pulses of more than 20mA to each LED. The datasheet says they
are fine with 100mA each at a 10% duty cycle so I wanted to use
somewhere between  20mA and 100mA pulses to get the brightness I was
looking for.

> Add the base resistors for a start.
>
> But in any case, where are you headed?  I think that's what is
> important to know.  Whatever that end point is, if it is satisfied,
> then probably so will smaller test configurations also be satisfied.

This weekend I made the following changes and now it's all working
great:
Added 1k base resistors to my PNP anode drivers to reduce the base
current from 25mA to ~5mA.
Switched my cathode drivers to a Darlington array, with built in 2.7k
base resistors, instead of discrete BJTs.

It all seems to be working nicely now, and I'm wasting way less
current driving all the transistors!

Now if I could just get my surface mount USB controller soldered on to
the darn board :)

Thanks again for your response and help. I think I've got it figured
out now.

Jason
Jonathan Kirwan - 30 Jan 2007 01:14 GMT
>> How big of a matrix are you heading towards?  How many columns and
>> rows?  It's important to know.
>
>Hi Jon, thanks very much for your response. Right now the largest I am
>considering is 8x8. The LEDs are RGB though, so it's more like 24x24.

Um, I think you mean more like 3x8x8, which is 24x8 not 24x24.
Luckily.

I posted some pictures I made earlier of some assemblies of RGB LEDs I
have worked on here.  A single RBG LED from it is exposed here, under
a small magnifier:
http://users.easystreet.com/jkirwan/tricolor%20led%20zoom%2001.jpg

The entire panel, a 16x16 matrix, is like this:
http://users.easystreet.com/jkirwan/tricolor%20led%20array%2002.jpg

Here's a more exposed view of several panels, backs and front, with a
proto board nearby for a rough size idea:
http://users.easystreet.com/jkirwan/tricolor%20led%20array%2001.jpg

Those are about 80 watts per, running full out as bright white, I seem
to recall.  And that is with separate supplies for R, G, and B and not
counting the waste in the power regulation before it reached the
panel.  Lots of heat dissipation required.  I don't know what you are
doing, but I'd expect something on the order of 5-20 watts dissipation
just in the panel itself without knowing more details.  Worse,
perhaps, if you use a single supply for the red, green, and blue and
need to thereby drop more voltage uselessly in transistors or
resistors driving the red ones.  You may need to keep that in mind.

>> By this, I take it that you are arguing that you need 25mA of base
>> drive.  If so, this means you are probably wanting 500mA of collector
[quoted text clipped - 6 lines]
>experimenting this weekend I found it worked just fine with a 1k base
>resistor.

That makes so much sense to me.  Glad to hear it.

>I was looking for around 500mA (or more!) of collector
>current. The reason being that these are common anode RGB LEDs, so at
>any given time a single anode transistor might be powering 9 distinct
>LED elements.

So all elements may start at the same moment.  Are you able to
individually PWM the three colors?  And do so across all eight of the
RGB LEDs you will one day include?  (24 PWMs at the same time?)

>I am using PWM to control the LEDs so I'm actually
>sending pulses of more than 20mA to each LED. The datasheet says they
>are fine with 100mA each at a 10% duty cycle so I wanted to use
>somewhere between  20mA and 100mA pulses to get the brightness I was
>looking for.

Okay.  Call it 50mA?

>> Add the base resistors for a start.
>>
[quoted text clipped - 17 lines]
>Thanks again for your response and help. I think I've got it figured
>out now.

Okay.  Well, if you care for some more thinking about it or some ideas
about experiments just say so.  If you are considering the idea of
doing several 8x8 RGB panels that may be used together, my
recommendation is to consider the idea of using three potentiometers
to allow you to set the 100% current level for each of the 3 sections,
red, green, and blue, and to then use the PWM as a method to adjust
the relative brightnesses of each LED.  You can get gross coordination
between the panels (in terms of white balance) that way.  But all that
will still be modestly problematic for a 3x8x8 panel.  It's a lot to
control well.

Jon
Jason von Nieda - 30 Jan 2007 18:23 GMT
>> Hi Jon, thanks very much for your response. Right now the largest I am
>> considering is 8x8. The LEDs are RGB though, so it's more like 24x24.
>
> Um, I think you mean more like 3x8x8, which is 24x8 not 24x24.
> Luckily.

Yea, I couldn't decide how I wanted to word that :) We're on the same
page though.

> I posted some pictures I made earlier of some assemblies of RGB LEDs I
> have worked on here.  A single RBG LED from it is exposed here, under
> a small magnifier:

Nice arrays! That looks like an exercise in patience! :)
Luckily for me, my goal with this project is low resolution. It's more
of an abstract art thing than a honest-to-goodness display.

> just in the panel itself without knowing more details.  Worse,
> perhaps, if you use a single supply for the red, green, and blue and
> need to thereby drop more voltage uselessly in transistors or
> resistors driving the red ones.  You may need to keep that in mind.

My DMM tells me I am driving the individual colors at ~20mA after PWM. I
don't have the knowledge, or the math, to determine how that relates to
the actual current I am putting through the LEDs. I am using 47 Ohm
resistors on the cathode of each color and feeding 5v, which tells me I
should be doing pulses of ~100mA. If I pull back and measure current
drawn from my power supply it's right around 250mA for the entire array
so I am thinking that worst case I am burning around 1 watt in the array.

>> I was looking for around 500mA (or more!) of collector
>> current. The reason being that these are common anode RGB LEDs, so at
[quoted text clipped - 4 lines]
> individually PWM the three colors?  And do so across all eight of the
> RGB LEDs you will one day include?  (24 PWMs at the same time?)

That's right. My PWM scans each row for 255 time slices before going on
to the next row. I turn on the power to the row and then loop through my
 frame buffer. If the color value for that "pixel" is supposed to be on
I turn on the cathode transistor for that column. Right now I am able to
scan the entire array pretty easily using direct IO from my AVR.
Eventually I was planning to switch to shift registers to cut down on
the IO pins needed. I haven't sat down and calculated if there will be
enough clock cycles to actually do that with an 8x8 :)

> Okay.  Well, if you care for some more thinking about it or some ideas
> about experiments just say so.  If you are considering the idea of
[quoted text clipped - 6 lines]
> will still be modestly problematic for a 3x8x8 panel.  It's a lot to
> control well.

I have been thinking about using pots to get the color mix set up
correctly. It just happens to turn out that I get the purest white when
I drive the red a little harder than the blue and green, so I am just
using the same resistances for all three colors.

If you are curious to look, I put up some videos of the array operating
the other day. You'll notice a little bit of flashing and shearing in
the colors. I need to adjust my software to only modify the framebuffer
when the PWM isn't actively scanning. Feels strange to add a "vertical
retrace sync" to a digital display!

The videos are at: http://www.vonnieda.org/blogdetail.jsp?id=1301

Thanks again for all the help! Once I am happy with things I'll post my
schematics here to ya'll to tear apart for me :)

Jason
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.