Connecting an LED to a single board computer

Just a few notes on powering LEDs from single board computers. I’ve just started playing with an Adafruit Feather Huzzah which has just turned up with with a starting kit containing LEDs, switches, resistors and interestingly no wires – but I suppose I’ve got plenty of those around.

The Huzzah powered by an ESP8266 which is actually a wi-fi chip with a full TCP/IP stack and integrate mirco-controller that can be programmed via PlatformIO or the Arduino IDE. It’s only 80MHz but has 4Mb of flash, 9 GPIO pins and a single 1V max ADC. The chip is 3.3V and max current per GPIO is only 12mA.

Many of the GPIO are dual purposed. #0, #2, #15 and #16 are used for boot-mode detection and boot loading. I would avoid these unless really needed.

That leaves #4,#5,#12,#13.

In the starter kit there is a red LED (1.85-2.5V forward voltage, at 20mV current). The longer of the wires is the anode (+ve).

LEDs are current controlled devices so if you just wire them to voltage source (as in a GPIO pin) they will draw as much current as they can and either your LED or your source will go bang. We need to put a current limiting resistor in place and its value is given by

\( R=\frac{V_s-V_f}{I_{max}} \)

So worse case forward voltage is 1.85V and the max current is 12mA. This requires a resistor of 121 Ohms. So anything larger than this should be ok, the larger it is the dimmer the LED will be.