Jump to content
43oh

Powering LEDs With MSP430 Output


Recommended Posts

Sorry if this is the wrong forum for this question, but it seems the most appropriate. I'm looking to power these LEDs with the output pins of the MSP430:

 

http://www.topbright88.com/50-pcs-blue-led-3mm-13k-mcd_p321.html

 

Since the output is already 3V do I need to add any resistors? If I am using more than at an output do I need to connect them in parallel?

 

Thanks for the help.

Link to post
Share on other sites
Sorry if this is the wrong forum for this question, but it seems the most appropriate. I'm looking to power these LEDs with the output pins of the MSP430:

 

http://www.topbright88.com/50-pcs-blue-led-3mm-13k-mcd_p321.html

 

Since the output is already 3V do I need to add any resistors? If I am using more than at an output do I need to connect them in parallel?

 

Thanks for the help.

 

First of all, how many do you plan on using?

 

Second, resistors on leds are primarily for current control, as an led will pull as much current as it can, and burn out if it pulls too much. Voltage control is secondary.

 

Next, do you plan on driving each at full brightness/current? They are listed at 20ma. If you power them directly from the msp430 at 20ma, the voltage will drop between 2.7 (5ma) and 2.5 volts (25ma), which might not be enough to turn on the led.

From a TI forum post, not specifically about the launchpad/valueline msp430s, but similar (and the valuelines act the same)

http://e2e.ti.com/support/microcontroll ... 75002.aspx

 

The msp430g2231 Datasheet has the graphs on page 40. Since the launchpad runs at 3.5v and not 3v, there is a tiny bit more leeway, but essentially, more than ~48ma output current (sourcing) on a port will make the high level/1 voltage 0.

http://focus.ti.com/lit/ds/symlink/msp430g2231.pdf

 

Essentially, you could power an led at 20ma and it might light up, or you could power a handful at 5ma, but it won't be at full brightness. And you just won't be able to power any leds in series, or parallel from the same pin really.

 

Mostly, you'll need transistors.

 

Interestingly enough

http://processors.wiki.ti.com/index.php ... _Drive_LED

seems to say that the maximum current per pin is 1.5 ma to maintain the maximum output voltage

As depicted the high-level output voltage is not Vcc as many could assume. There is a minor difference of typically 0.3 V. There is also an important fact mentioned in Note 1.
Link to post
Share on other sites
cde,

 

Can't he pull-up the LED to 3V externally through a resistor and then to a pin.

When the pin is high, the LED is off.

When the pin is low, it sinks current and the LEd turns on.

 

Unfortunately, no. As far as the datasheets are concerned, the MSP430 chips sink current inversely to their current sourcing. Sink too much current, and the low voltage will rise from 0 to vcc, giving you the same 0 voltage difference. Its total current sinking/sourcing ability is +-48ma at max, either way. The typical current output is 6ma sourced or sink, which gives just vcc-0.3 or vss+0.3.

 

It's not like some chips (TI/Phillips PCF8574 for example) that can sink alot more than they can source.

Link to post
Share on other sites

Can you please elaborate on how I would use transistors to accomplish this? I am looking to turn on/off anywhere from 1-3 of those LEDs per pin on 9 pins.

 

Would bluehash's idea work if i put a diode in front of the pin that didn't let any current into the msp430?

 

I'm guessing the best solution would be to switch to these LEDs:

 

http://www.amazon.com/Joe-Knows-Electronics-Clear-Pack/dp/tech-data/B0040EFF20/ref=de_a_smtd?ie=UTF8&m=A2CKSJGKIJVSBF

 

Assuming the output at each pin is 3V, I would use a 40Ohm resistor for 1 led, 20Ohm resistor for 2 in parallel, and 15 Ohm for 3 in parallel? Is there any overall limitation to how much current the MSP430 can output? Would I be able to turn all 9 I/O pins on at the same time and have, say, 10-20 LEDs lit up?

Link to post
Share on other sites
Can you please elaborate on how I would use transistors to accomplish this? I am looking to turn on/off anywhere from 1-3 of those LEDs per pin on 9 pins.

 

Would bluehash's idea work if i put a diode in front of the pin that didn't let any current into the msp430?

 

No, not with a diode.

 

The TI wiki has a nice page on driving an led from a msp430 with a transistor

http://processors.wiki.ti.com/index.php ... _Drive_LED

 

Its the basic NPN transistor usage. Output of the msp430 gpio tied to the Base pin of the transistor, with the Emitter pin tied to ground, and the Collector pin connected to the negative side of the led.

 

For multiple leds, you can tie them in series, which means you need a higher voltage (3 blue leds at 3.6 typical voltage would require 10.8 volts atleast, with 12v being the standard voltage) and one resistor, or you can tie them in parallel, with just means more current at a lower voltage, and ideally 3 resistors (one per led).

http://led.linear1.org/led.wiz

Is an online led calc that can do both series and parallel wiring schematics, based on the information you put in. You just add the transistor to the end of it. And at this current rating (20ma in series, or 60ma in parallel) any general purpose npn transistor will work fine.

 

Edit:

As far as switching from the blue to the red leds, you would face the same issue. The voltage drop from the msp430's current output capacity might not affect them as bad (red leds tend to be 2.2v instead of blue's ~3.5v) but the more you power at a time, and depending on the brightness, the less the msp430 will be able to power.

 

Think of the msp430 as a pool. Its big enough for 3 or 4 people to enjoy with plenty of room. The more people you add though, the less you can move around and enjoy. Eventually, it won't work for what you need.

Link to post
Share on other sites
Thanks Guys! So if I understand the schematic correctly, Vcc can be whatever I choose, and the resistor lowers it to the proper level for the LEDs, and the output pin connects to the transistor to open/close the circuit?

 

The transistor does not act like a switch (as I thought at first as well), but more of a "valve". It will only allow roughly the same voltage to pass from collector to emitter as is applied to the base, but it will allow much higher current (which is the limitation of the MSP430 we are overcoming here).

 

In the diagram I posted, bringing the MSP430's output pin high (~3v) will allow about 3v to pass for the LED circuit. You'll need to calculate the resistor value to restrict the current within the limits of the LED (average is about 20 milliamps) and for the brightness you desire. The source voltage should be the same as for the MSP430. To use a higher voltage, you need a more complicated circuit.

 

(Smarter folks, please check my logic! :D -Doc)

Link to post
Share on other sites
The transistor does not act like a switch (as I thought at first as well), but more of a "valve". It will only allow roughly the same voltage to pass from collector to emitter as is applied to the base, but it will allow much higher current (which is the limitation of the MSP430 we are overcoming here).

 

In the diagram I posted, bringing the MSP430's output pin high (~3v) will allow about 3v to pass for the LED circuit. You'll need to calculate the resistor value to restrict the current within the limits of the LED (average is about 20 milliamps) and for the brightness you desire. The source voltage should be the same as for the MSP430. To use a higher voltage, you need a more complicated circuit.

 

(Smarter folks, please check my logic! :D -Doc)

 

Ok, now I'm super confused. You're saying that Vcc must be the same as the output of the pin that the transistor is connected to? Why then in this schematic do they have a 2.15 KOhm resistor connected between the output pin and the transistor?

http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_Drive_LED

And isn't the voltage at the top of the transistor different than the voltage where P1.0 is connected?

Link to post
Share on other sites
Thanks Guys! So if I understand the schematic correctly, Vcc can be whatever I choose, and the resistor lowers it to the proper level for the LEDs, and the output pin connects to the transistor to open/close the circuit?

 

The transistor does not act like a switch (as I thought at first as well), but more of a "valve". It will only allow roughly the same voltage to pass from collector to emitter as is applied to the base, but it will allow much higher current (which is the limitation of the MSP430 we are overcoming here).

 

In the diagram I posted, bringing the MSP430's output pin high (~3v) will allow about 3v to pass for the LED circuit. You'll need to calculate the resistor value to restrict the current within the limits of the LED (average is about 20 milliamps) and for the brightness you desire. The source voltage should be the same as for the MSP430. To use a higher voltage, you need a more complicated circuit.

 

(Smarter folks, please check my logic! :D -Doc)

 

Yes, a transistor is like a valve, but at 0ma its off, and at its saturation current, it is fully open. Without pwm, or a dac, or choosing the wrong resistor, it's essentially a digital switch. (Mosfets use voltage instead of current to turn on)

 

But for the second part, I'm not 100% sure of this, but I'm quite confident that you can drive a higher voltage collector from a lower voltage base. If you couldn't, the transistor wouldn't be as useful as it is. There might be special rules that exist, but from the general point of view, the transistor exists for this purpose.

http://www.sullivan-county.com/ele/tran ... rivers.htm

 

Look at Arduino tutorials or projects, if it has a transistor, most of the time they are switching different voltages, not just current.

http://www.arduino.cc/playground/upload ... relays.pdf

 

bringing the MSP430's output pin high (~3v) will allow about 3v to pass for the LED circuit.

Don

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...