Page 1 of 1

best way to switch multiple leds

Posted: 22 Feb 2021, 21:28
by GravityRZ
i want to switch multiple leds on/off seperately

this is mostly done by hooking up a led with a 220ohm resistor in series between a GPIO port and the ground.
When GPIO is 1 current will flow from GPIO to GND (Max current=12mA)
When you hook up multiple leds te total current need to be supplied by the ESP8266 chip which possibly gets warm.

would it not be a better way to hook up the led and resistor between +3.3V and GPIO.
This is way the current will flow from +3.3V through the GPIO when it is switched to 0
Also this would not limit the current to 12mA per led but would limit the total current to that of the voltage regulator

i would say the total current in the second situation is coming from the 3.3v voltage regulator instead of the ESP8266 chip

any thought on this?

Re: best way to switch multiple leds

Posted: 22 Feb 2021, 22:42
by TD-er
That's exactly what's described in datasheets as the amount of current that can be sourced (ESP delivers power for the LED) or what a chip may "sink" (just redirect current to GND)

Sink current of an ESP8266 is about 20 mA, source current is about 12 mA (per pin)
See: https://bbs.espressif.com/viewtopic.php?t=139

Re: best way to switch multiple leds

Posted: 23 Feb 2021, 20:19
by GravityRZ
thanks.