Is it ok? - Page 1
Forum section: electronics / general

author: msuffidy
author_rank: Frequent Contributor
timestamp: November 20, 2022, 05:28:17 am
content: I got this idea tonight that I already wired up and I am not totally sure it is ok. I got this ESP8266 recently. So I had an Arduino nano. I had this IR LED with a resistor all soldered up with a value based on a 5V GPIIO. So I was thinking that if I connected a 5V to one side and the other to the GPIO when the GPIO is low that is a 5V path. I argued that with the 3.3V state, there would be next to nothing going through the LED and would appear off. The problem is this configuration usually has the same voltage when in the high state, like 5V. So there is a possibility of reverse flow in the high state of the GPIO. With the forward drop and a resistor like ah can't recall 100 ohms, is there any danger to this configuration? I think how it works is the resistor basically converts any potential difference to heat, but in this case there could be a voltage divider kind of scenario in the ESP8266? Here is video recording of it:https://www.facebook.com/100052965817466/videos/pcb.658734955902026/1338675976936546

author: DavidAlfa
author_rank: Super Contributor
timestamp: November 20, 2022, 05:33:49 am
content: Not ok, you'll be dumping 5V into the esp 3.3V power rail.

author: msuffidy
author_rank: Frequent Contributor
timestamp: November 20, 2022, 06:26:29 am
content: It was sort of ill conceived but I think the voltage drop of the IR led is greater than 1.5V, so 5-1.5V-3.5V which should be ok. Again the 5V I think is USB line and not outt of a regulator.

author: DavidAlfa
author_rank: Super Contributor
timestamp: November 20, 2022, 06:34:47 am
content: Measure the drop voltage first. Needs to be 1.7V for this to be safe.Why not use it like a normal output? Or a transistor?

author: Ian.M
author_rank: Super Contributor
timestamp: November 20, 2022, 08:26:15 am
content: USB max Vbus is 5.5V. Its rare for it to be that high, but many hosts and USB 'chargers' run their 5V supply a bit high e.g. 5.3V to compensate for typical voltage drops in USB cables. Therefore its even worse than David suggests, and the LED Vf needs to be reliably over 2.2V (5.5V-3.3V), which makes the above circuit unsuitable for single IR LEDs (or indeed most other LEDs except ~3.0V Vf blue and white ones)

author: wraper
author_rank: Unknown
timestamp: November 20, 2022, 08:44:39 am
content: It ok for high Vf LEDs such as white, blue and high brightness types of other color. However IR LEDs have the lowest Vf, so you shouldn't do this.

author: dietert1
author_rank: Super Contributor
timestamp: November 20, 2022, 09:43:11 am
content: Maybe the output to drive the LED can be configured as opencollectordrain. Then there will be an extra 0.7 V margin (from the output ESD protection diode).Regards, Dieter

author: hans
author_rank: Super Contributor
timestamp: November 20, 2022, 12:04:08 pm
content: It's not OK, but will probably survive for some time.In principle for the LED it works: if you pull GPIO low, the resistor+LED has a good current path to GND and will conduct normally. However if the GPIO is driven high, assume the GPIO is at 3.3V. The resistor+LED is connected to 5V. Although the voltage drop across the LED may be say 2V, this is only at areasonably large currentof say mA's.If the current is much less (say 50uA), then maybe the LED will only drop e.g. 1V. It's not an Ohm's law equation, but rather some exponential form, but the point is, some current will still go into the ESP32. The question is: is there somewhere for this current to go to? Well probably yes.. as the GPIO connects to the 3.3V (or otherwise through ESD diodes if the GPIO is an input), the ESP32 can "sink" this current to the 3.3V rail. Since the ESP32 in normal run mode consumes several mA, this small current leaking would mean the voltage regulator of the 3.3V rail would need to supply a bit less current (it's offset). This would not create any crazy voltages at the ESP32 chip itself that my destroy it. I bet if you measure the voltage at the GPIO set to 'high' it's still 3.3V, but I assume if you measure the voltage drop across the 100R resistor it may have some voltage drop (in mV's).The problem with this configuration is when the ESP32 goes into sleep. If the ESP32 is in deepsleep consuming single-digit uA's, then this e.g. 50uA leaking to 3.3V will be enough to pull up that rail to a higher potential. A too high voltage will degrade the part over time. Voltage regulators may also not like it to see their output being lifted up. Worst of all: the ESP32 has a chance to enter a latch-up condition on power up, which can destroy the chip.https://www.ti.com/lit/wp/scaa124/scaa124.pdfSome MCUs have 5V tolerant I/O pins, but these only work for input or open-collector/drain mode. And there are no ESD protection diodes present. Those would be OK to use for this purpose, but otherwise, please don'tIt's better to get a 5ct FET and switch the LED like that.

author: msuffidy
author_rank: Frequent Contributor
timestamp: November 21, 2022, 07:49:05 am
content: Well thanks everyone. I was mostly just doing a general test that time with 1 of 2 of those I have. I did the test on the more scruffed up one with my soldering. I will consider these issues in the future. I am not doing anything with it until I need to then I will deal with the 5v or 3.3 volt requirements. I would probably deal with a 5v requirement by using the 3.3 gpio as a switch to the 5v line using a transistor.

author: wraper
author_rank: Unknown
timestamp: November 21, 2022, 09:35:44 am
content: You can just use 3.3V for powering the LED. There cannot be much of additional load on LDO anyway since GPIO of ESP8266 is rated to 12mA max. You would need to use 5V only for high Vf LEDs.

author: tszaboo
author_rank: Super Contributor
timestamp: November 21, 2022, 10:05:53 am
content: Your LED will never be off. Use a transistor, they are simple and cheap.

author: SeanB
author_rank: Super Contributor
timestamp: November 21, 2022, 10:21:44 am
content: If you are really wanting to do this, accept that you will need to add 3 silicon diodes (1N4148, or pretty much any cheap silicon diode) in series with the LED, and also add another schottky diode from the pin to Vcc of the microcontroller, so as to bypass the built in ESD protection diodes, which are not really rated to carry current other than ESD events, and are rated for less than 1mA in case you actually turn them on. That then makes sure the IR LED will actually stay off when the pin is high, or at least will only run at a very low forward current and light output, and that the IO pin will not conduct current to Vcc when high impedance via those ESD protection diodes. The extra voltage drop will just reduce current when the pin is low, which if you are using as optocoupler drive, or close range use, is not a worry in most cases.