- Sat Apr 10, 2021 5:07 am
#91076
btidey wrote:It is not a great idea to connect a LED to a GPIO without a series resistor to define the current. For example the red LED starts conducting around 1.2V across it and will rapidly increase as that voltage increases. With 3.3V from a GPIO the current would theoretically be enormous but in practice gets limited by the drive capability of the GPIO. This is not well defined and so you don't really know how much current is going through the LED, and it is putting unnecessary strain on the GPIO. Instead you should use a series resistor to set the current. So for example if you want 5mA through the LED then assume the LED will drop 1.5V then the resistor should be (3.3 - 1.5) / .005 or 360 Ohm. The voltage dropped by the LED will vary depending on its color.
Second the power supply. Your charger is dropping to 3.1V when loaded but this is measured with a voltmeter which is giving you an average reading. If there is pulses in the current drawn then the voltage may be dipping well below the voltage you measure and this could be causing mal-operation of the ESP. A power supply that is dropping by 0.5V when under what should be a modest load does not sound like a supply that is fit for this use. You need one that can supply 0.5A without a significant drop.
The LIPO measuring 2.8V sounds bad as well. A charged LIPO should start at about 4.2V and go down gradually to 3.3V when it discharged. Measuring 2.8V would indicate either that the battery is suspect or fully discharged or that you have high resistance power leads connecting the power to the ESP so that voltage is being dropped across them.
Hello btidey, thank you for your answer.
I was not aware that the resistor on the LED would limit the max current. In this case the red pin is more obvious because the work voltage it's a lot lower, but what would you do with green and blue pins? also use a resistor? Or it's not necessary because the work voltage is similar to the output voltage?
I managed to buy a new power supply that has stabilized output. It worked properly initially.
Right now I'm having new problems, and I think it's related to the LEDs without current control.
When I turned the power on the first few times the ESP was working perfectly. Then the behaviour change and it's not running the code anymore I guess. Even tho it turns on. If I remove the LED from the circuit before I power it, and only then plug in the LED, then it
sometimes work.
Trying to figure out if I need a "booting" circuit for the rgb LED. Might create a new post for that one.
Sorry for my late late reply.