IR beam - problem when powering esp32 with 5V

Hi all,

I’ve been creating an IR beam using the following scheme. I’m using a 2 led scheme and with following components:

  • R4 i used 22 Ohm
  • TR1 i used 2N2222 transistor
  • using led TSAL6100 for a narrow-angle

I’m using an ESP-VROOM-32 dev kit 1 to provide a modulated signal at 38kHz using ledc library.

Everything is working fine with a good range when I power the esp32 from USB. The problem arrives when I wish to power the esp32 directly with 5V input (pin Vin and Gnd). It appears that the range decrease to a few centimeters.

Do you have any idea how to solve this kind of issue?

Thank you for your help

Why are you using 22K when the diagram you posted says you need 2.5 Ohms? Yours is almost 10,000 times bigger than the recommended value.

I guess you mean the ESP-WROOM-32 but that's just a module and doesn't have a USB connector so exactly which board are you using?


Yes sorry i'll correct that
I'm using dev kit 1 of esp32
And the resistance is 22 ohm and not 22 k

The problem arrives when I wish to power the esp32 directly with 5V input (pin Vin and Gnd).

What is the current capability of that 5volt source.
ESP32 boards like the dev kit 1 could draw close to 500mA peak.

LED current is 0.65/22 = ~30mA for R4 = 22 ohm.
I would lower R3 to 1k for the 3.3volt logic of the ESP32.

The capacity of the input source is 3A so it should be fairly enough to provide current to all elements of the circuit.
I tried to reduce from 3,3 Kohm till 330ohm and same behaviour is happening to the circuit everything work fine when esp32 is powered by USB but as soon as both are powered by the same source all the system goes down.

Maybe there is an issue with the ground ?

Is the power source a secret?
Can we see it?

The 1k advice had nothing to do with the problem.
Just a sensible base resistor value for that 30mA LED current.

I'm powering a bread board using mb-102.
So i was guessing it should be fine.

That's interesting because the normal MB-102 power supply can only provide around 500mA, barely enough to run the ESP32.


I saw that mb-102 should provide 700 mA maximum and as I saw without wifi or any other the esp32 shouldn't consume 500mA. In the worst-case 200mA left is more than enough to input the IR led.

So to make a test, I powered esp32 with USB, the board with mb-102, and linked the ground together. It results in the same behavior as all devices connected to the mb-102: the range is dropping to just a few centimeters.

Did it remember you anything?

I saw that mb-102 should provide 700 mA…

That’s only true in SOME cases.
It depends on HOW you power that breadboard supply, which you didn’t tell.
Max current of the mb=102 could drop to <=200mA if you power it with 12volt.

Breadboards quality also varies, and there are ones with interrupted power rails.
Thinks could be solved quicker if you upload an image, as requested in the posting guidelines.

Some confusion here.

The "MB-102" is a solderless breadboard. It does not have any power or current rating, though it is generally suggested that it not be used for more than an Amp on the terminals.

If we are talking about a common "breadboard power module",

Then these suffer from the same problem as the Arduino.

The regulator may be rated for 700 mA, but with almost no heatsink this will only be for the few seconds it takes to overheat. Powered by 12 V and dissipating the balance, being 7 V, this will likely happen at less than 200 mA (1.4 Watts). :astonished:

If you supply it at 5 V through the USB connector, then it will be good for whatever the power supply is, or the rating of the polyswitch if fitted.