Forum

Values of Resistors for LED's in Sample programs

More
2 weeks 6 days ago - 2 weeks 4 days ago #641 by lornetw
lornetw created the topic: Values of Resistors for LED's in Sample programs
Hi. Trying to start off simple. I want to start with the LED Fade example but I don't see the value of the resistor for the LED mentioned.

Question 1) When I look at the specifications listed for the I/O Drive Current for the 2 boards I see the following (for example : pin P3.3) : Developer Board (8mA) and Project Board (6 mA). If I need, say, 20 or 25 mA for even just 1 LED, are the boards able to supply enough current @ 3.3 V?

Question 2) I thought I might be able tell what resistor to use by looking at the Fritzing photo for the LED Fade sample program (orange/orange/brown = 300 ohms). But when I try to calculate the resistor with the formula I usually use I get another answer (using a Red LED) : (Supply Voltage = 3.3 V, LED Forward Voltage = 1.8 V, LED Forward Current = .025 A)
(Supply Voltage - LED Forward Voltage) / LED Forward Current = (3.3 - 1.8) / .025 = 60 ohms.
What am I missing?

If I want to drive multiple LED strings, maybe I can drive the LEDs with a logic-level MOSFET. I have an IRL-540 on hand. If that doesn't work, maybe I can use a transistor to drive the gate.

Small suggestion - maybe add the values of the resistors to the Sample Program documentation? Or maybe I missed where this info is shown?

Regards,

Lorne Wilkins
Last Edit: 2 weeks 4 days ago by lornetw.

Please Log in or Create an account to join the conversation.

More
1 week 2 hours ago #643 by foxonix
foxonix replied the topic: Values of Resistors for LED's in Sample programs
Hi Lorne:

The value of the resistor in the LED Fade example is 330 ohm (orange-orange-brown).
www.foxonix.com/learn/sample-programs/98-led-fade

Assuming an LED forward voltage of 1.8V, the current through the LED works out as (3.3V - 1.8V) / 330 ohms = 4.5 mA.

The I/O pins aren't strong enough to drive 20 or 25 mA directly. Pins P3.2 and P3.3 can drive 8 mA and sink 16 mA. Anything more than that and we use a NPN BJT transistor. We connect a 1k-ohm resistor to the output pin and drive the base of the transistor as shown in this example:
www.instructables.com/id/Ultimate-Lightsaber-Lights-and-Sounds/

If you're driving multiple LEDs you'll definitely want to use a transistor. Using a MOSFET should work just fine.

- Will @ Foxonix

Foxonix - make your ideas heard.
@foxonixdev

Please Log in or Create an account to join the conversation.

More
1 week 2 hours ago #644 by lornetw
lornetw replied the topic: Values of Resistors for LED's in Sample programs
OK. Many thanks for your help.

I'll give this info a try.

Regards,
Lorne Wilkins

Please Log in or Create an account to join the conversation.

Time to create page: 0.467 seconds