-->
Page 2 of 3

Re: ESP8266 control system

PostPosted: Mon Aug 10, 2020 2:01 pm
by SentinelAeon
1) Hmm ... i thought if you sink the pins, they go directly to ground and can handle more than 12mA .... Well, it doesn't matter in this case since i will only drive about 5mA through each of the 3 IO pins. But that will make some future projects a little bit harder.

2) Ahh ... i completely forgot about the current spliting ... i kind of thought that the LEDs will simply draw as much as they want. Would it change anything if i used a step-down instead of a resistor ? The step-down can supply up to 1.5A and if i set it to 2V, it shouldn't matter if i have 1 or 3 LEDs turned on right ?

Re: ESP8266 control system

PostPosted: Tue Aug 11, 2020 12:26 am
by schufti
one doesn't operate a led "by voltage", leds are "current" driven.
(hence datasheets specify typical or max "operating current")
it may work if voltage is choosen carefully but brightness may be random depending on colour and manufacturing lot.
again: the cost of a resistor is negligible

Re: ESP8266 control system

PostPosted: Tue Aug 11, 2020 12:47 pm
by SentinelAeon
Alright, thank you for the replies. My knowledge is indeed limited and i am learning as i go. As i said, the sole reason i was asking about leds in parallel was the fact that i need it in 2 weeks and aliexpress means 2 months, which is not an option. But in the meanwhile i found a local shop with resistors and will buy them there tomorrow, so i do plan to give each led its own resistor.

But as i really like experiments, i made a simple experiment with step-down. I plan to use 3 green LEDs but in this case i only used 2 to make things simpler. I used 4 multimeters: 1 for voltage and 3 for current: the far right measures current going into the step-down and the other 2 amps measure how much current goes into each LED. Sadly my multimeters are cheap so they only show as low as 10mA, so because usage of each LED is jumping between 0 and 10mA, i can assume its usage is somewhere under 10mA, which is good enough for me. Now as you see, there is no visual difference when i connect 1 or 2 LEDs. Another interesting thing, if you noticed .. when i connect the second LED, the voltage at the step-down output seems to rise very slightly and when only 1 LED is connected, it drops slightly.

One thing that i didn't remember when planning to use step-down is that in order to power the step-down i need to connect both ground and 3.3V to it. And that is a problem since i want the LEDs ground to be IO pins in sink mode. So that wouldn't work anyway.

What i am really interested in is how will the result differ when i use 1 resistor between 3.3V pin and + pins of all 3 LEDs and grounds from them going into a separate IO pins.

I know LEDs of same color can have different resistance and you have to match them as close as possible. Though since i am using such low current of 5mA, the difference between 2 LEDs of same color would have to be gigantic, to somehow draw deadly current of more than 20mA into 1 of them. But since its parts from aliexpress, you never know :) Btw, the way i did things till now using step-down and LEDs ... i never bothered with what voltage the LED needs, i only kept in mind the max current it can handle. So i would start as low as 1.5V ... and if i wasn't happy with the current flowing, i would slowly raise the voltage value until i got 5-10mA per LED.

Now to clarify, in the end i plan to use a separate resistor for each LED, that is, 3 resistors together. But i am really interested how the thing would act with 1 resistor. I will include my findings here when i do them. For now, i included this interesting video.

https://www.youtube.com/watch?v=mBhSICvAEzI

Re: ESP8266 control system

PostPosted: Fri Aug 14, 2020 8:28 am
by eriksl
If the current is sinked, it's routed to GND, if the current is sourced, it's routed from Vcc. Not a real difference there.

Some IC's can sink more current then they can source. They're probably using a pull-down construction with a weak pull-up.

The ESP8266 (and many other microcontrollers) has totem-pole aka push-pull IO pins, where there is a separate fet for pulling up and for pulling down (gates tied together with an inverter). So the output is always tied to either Vcc or GND, never floating (unless explicitly requested by configuring the port as an open drain port).

So the current that can be sourced is equal to the current that can be sinked. I remember it's even 30 mA, not 12 mA, so you can safely attach a signal type LED, which typically may draw 20 mA at max, IF properly current limited. The 3v3 Vcc is typically far enough above Vf of the LED that it will "try" to lower the voltage somewhat by drawing more current (very much simplification here). If there is no resistor connected, the current will be limited/dissipated within the LED and the LED won't survive. If a proper resistor is inserted, the process will take place largely there.

From experience I can say any resistor between 10k (very dim, use for blue LEDs) and 300 will do, 1/8 of a Watt will suffice.