Driving multiple LEDs from a single microcontroller output

379 views
Skip to first unread message

JP

unread,
Nov 14, 2010, 3:59:00 PM11/14/10
to Nottingham Hackspace - Nottinghack
Hi guys,

To the electrically inclined among you — I'm trying to control 10 LEDs
from a single microcontroller output (not individually, all on/all
off).

I think I'd need to use a transistor, but I have no idea which type
(BJT NPN?), or what spec or how to wire it up! I'm using a 5V source
and the LEDs I have are 2.0 - 2.4V, 20mA — anyone feel like helping me
out? I'd be happy to write the results up on the wiki afterwards for
others!

Cheers!
JP

Matt Lloyd

unread,
Nov 14, 2010, 4:17:16 PM11/14/10
to notti...@googlegroups.com
A quick search of the net turned up this hand guide
http://picprojects.org.uk/projects/inf/drivingLEDs.pdf

Matt

-----Original Message-----
From: notti...@googlegroups.com [mailto:notti...@googlegroups.com] On
Behalf Of JP
Sent: 14 November 2010 20:59
To: Nottingham Hackspace - Nottinghack
Subject: Driving multiple LEDs from a single microcontroller output

Hi guys,

To the electrically inclined among you - I'm trying to control 10 LEDs


from a single microcontroller output (not individually, all on/all
off).

I think I'd need to use a transistor, but I have no idea which type
(BJT NPN?), or what spec or how to wire it up! I'm using a 5V source

and the LEDs I have are 2.0 - 2.4V, 20mA - anyone feel like helping me

JP Hastings-Spital

unread,
Nov 14, 2010, 4:25:32 PM11/14/10
to notti...@googlegroups.com
You hero! I can never figure out what to search for. Thanks

Roger Light

unread,
Nov 14, 2010, 4:34:33 PM11/14/10
to notti...@googlegroups.com
Hi JP,

I'd probably use an N-type MOSFET. MOSFETs are controlled by voltages
rather than currents, so conceptually they're easier to understand. A
discrete n-type fet will generally have three pins - the source, drain
and gate. It's also possible to have a fourth pin, the body which is
tied to the source in three terminal devices. The source of a fet is
the "source of majority carriers", so for an n-type this is ground -
because electrons flow out of the negative terminal of the supply;
it's "conventional current" that flows from the positive terminal.
This is one side of the switch - the drain is the other. The gate is
used to control the flow of current through the device. If Vgs (the
voltage between the gate and the source) is greater than Vth (the
threshold voltage of the device), and Vds is greater than Vgs-Vth then
the switch is turned on.

So to choose a device, make sure that the maximum drain current (Id)
is greater than your maximum current. Also make sure that the maximum
Vgs and Vds is greater than the output from your microcontroller and
power supply respectively. Lastly, check that Vth is low enough that
your controller output will turn it on. Unless you go for some crazy
power fet, Vth should be typically <1V and certainly <3V.

Something like http://uk.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=5449551
would do - if you can cope with surface mount devices there are loads
more to choose from.

Connect 5V -> through diodes -> drain and source->0V and
micrcontroller->gate and all should be good. Put a 1 on the output to
turn on, 0 to turn off.

It's also worth noting that there are dedicated LED driver ICs out
there, depending on your exact needs.

Cheers,

Roger

Roger Light

unread,
Nov 14, 2010, 4:36:33 PM11/14/10
to notti...@googlegroups.com
On Sun, Nov 14, 2010 at 9:34 PM, Roger Light <ro...@atchoo.org> wrote:
>
> Connect 5V -> through diodes -> drain

Don't forget a resistor (or more likely one per diode) to limit the
current as well.

Cheers,

Roger

Reply all
Reply to author
Forward
0 new messages