Controlling a led, pull up resistor value

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
windy54
Posts: 11
Joined: Thu May 28, 2015 8:01 pm

Controlling a led, pull up resistor value

Post by windy54 » Sat Oct 24, 2015 11:48 am

Hi guys,
So received my WiPy and expansion board, both working fine.

Want to now control some LEDs. Having damaged boards in the past by not limiting the current I want to make sure I do not damage this one.
I have had a look at the data sheet for the processor , am I correct in understanding that each pin will source 6mA?
If I use PWM do I need a pull up resistor?

User avatar
dhylands
Posts: 3301
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Controlling a led, pull up resistor value

Post by dhylands » Sat Oct 24, 2015 5:14 pm

There is a difference in functionality between a pullup resistor and a current limiting resistor.

When using a LED, the purpose of the current limiting resistor is prevent too much current from blowing the LED. To calculate the value of the current limiting resistor, you need to know its forward voltage, the voltage that you're planning on driving the LED with, and the current that you wish to limit things to.

Here's an article that explains how to calculate it. The LED's forward voltage is also sometimes referred to a the voltage drop across the LED. If you don't have a datasheet for your LED, use a 1K ohm resistor with 5V or 3.3V supply and measure the voltage drop across the LED. For red/green LEDs it's typically around 1.4 - 1.7V. Blue/White LEDs are typically a bit higher.

It's quite common for current limiting resistors to be in to 220 to 1K ohm range.

Pullup/pulldown resistors are designed to influence non-driven signal to a particular state. They're often used with open-drain or open-collector components. In the old days, with TTL logic, 10K was a very common value. With CMOS (almost everything these days is CMOS), 100K or even 1M can be used.

windy54
Posts: 11
Joined: Thu May 28, 2015 8:01 pm

Re: Controlling a led, pull up resistor value

Post by windy54 » Sun Oct 25, 2015 8:49 am

Thanks for the response, you are correct I meant current limiting resistor.
So I will re-phrase my question, what is the current capability of each GPIO pin, is it 6mA or higher.

windy54
Posts: 11
Joined: Thu May 28, 2015 8:01 pm

Re: Controlling a led, pull up resistor value

Post by windy54 » Sun Oct 25, 2015 9:05 am

Thanks for the response, you are correct I meant current limiting resistor.
So I will re-phrase my question, what is the current capability of each GPIO pin, is it 6mA or higher.

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Controlling a led, pull up resistor value

Post by danicampora » Sun Oct 25, 2015 9:17 am

It is 6mA, remember to set the drive to Pin. HIGH_POWER

windy54
Posts: 11
Joined: Thu May 28, 2015 8:01 pm

Re: Controlling a led, pull up resistor value

Post by windy54 » Sun Oct 25, 2015 11:19 am

Cheers, will do, time to try my first blynk project

wupy
Posts: 1
Joined: Sat Nov 07, 2015 11:08 pm

Re: Controlling a led, pull up resistor value

Post by wupy » Sat Nov 07, 2015 11:11 pm

I want to control a few normal LEDs. I assume they all require 20mA. Did I understand it correctly that there is no way to control them directly using a GPIO port, because it can only deliver 6mA?

So what are possible solutions? Low-current LEDs or an amplifying transistor?

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Controlling a led, pull up resistor value

Post by danicampora » Sun Nov 08, 2015 9:26 am

You can drive them directly via the GPIO pins. Most LEDs are rated @20mA, but usually 2-3mA gives pretty good brightness.

Cheers,
Daniel

User avatar
dhylands
Posts: 3301
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Controlling a led, pull up resistor value

Post by dhylands » Sun Nov 08, 2015 5:56 pm

If you do want to drive the LED with more current, then you'll need to use a transistor.
Here's a page which gives some background on how to do that:
https://learn.sparkfun.com/tutorials/tr ... i-switches

User avatar
bmarkus
Posts: 111
Joined: Tue Oct 21, 2014 5:58 am

Re: Controlling a led, pull up resistor value

Post by bmarkus » Mon Nov 09, 2015 12:46 pm

While it may work, as a general rule NEVER drive a LED directly from a microcontroller port. In a 3.3V system a 120-220 Ohm resistor would be a safe choice in most cases.
Tiny Core Linux (piCore) developer
HAM radio call: HA5DI (Béla)

Post Reply