ESP-01 and PIR sensor false readings

Hello community,

in the past couple days I was playing around my HC-SR501 PIR sensor and my NodeMCU to create a device signaling me if somebody stays or moves in its range. The wiring was like this:

Sensor Pin NodeMCU Pin
Vcc ---> VU
GND ---> G
OUT ---> D4

As the PIR module works from 5V I have used the VU pin of the board which gives me the USB 5V instead of using one of its 3V pin which is just 3.3V and at this point I was happy because everything worked like a charm, I had no false readings at all!

Then I thought its a waste to use a nodeMCU for just reading one digital input so decided to use an ESP-8266-01 module for reading the sensor. Once I have programmed the ESP-01, I just used my ESP-01 programmer to power my ESP-01 with the following wiring:

Sensor Pin ESP-01
Vcc ---> +5V pin of the USB on the programmer
GND ---> GND
OUT ---> GPIO2

And the problem: while this wiring seems correct to me, its obviously not because I got so much false readings that the device is practically unusuable. I have tried: using 10k pullup or pulldown and also tried supplying the sensor from 3.3V none of these solved the problem. The wires are not the problem, I read 5V on the Vcc pin of the sensor and the output is at either 3.3V or 0V.

I read that the sensor is 3.3V inside so I just need to bypass the voltage regulator and it will work from 3.3V. This might be true and I will try it later (once I grab a hold on soldering station), but until that I'd like to understand what do I do wrong, why my setup does not work and if there is anything I can do to fix the problem?

Thanks in advance!