Controlling a led, pull up resistor value
Controlling a led, pull up resistor value
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?
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?
Re: Controlling a led, pull up resistor value
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.
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.
Re: Controlling a led, pull up resistor value
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.
So I will re-phrase my question, what is the current capability of each GPIO pin, is it 6mA or higher.
Re: Controlling a led, pull up resistor value
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.
So I will re-phrase my question, what is the current capability of each GPIO pin, is it 6mA or higher.
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: Controlling a led, pull up resistor value
It is 6mA, remember to set the drive to Pin. HIGH_POWER
Re: Controlling a led, pull up resistor value
Cheers, will do, time to try my first blynk project
Re: Controlling a led, pull up resistor value
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?
So what are possible solutions? Low-current LEDs or an amplifying transistor?
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: Controlling a led, pull up resistor value
You can drive them directly via the GPIO pins. Most LEDs are rated @20mA, but usually 2-3mA gives pretty good brightness.
Cheers,
Daniel
Cheers,
Daniel
Re: Controlling a led, pull up resistor value
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
Here's a page which gives some background on how to do that:
https://learn.sparkfun.com/tutorials/tr ... i-switches
Re: Controlling a led, pull up resistor value
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)
HAM radio call: HA5DI (Béla)