ESP8266 doesn’t connect to WiFi when powered by power supply

I’m doing a project whit an Azdelivery D1 Mini with an ESP8266-12F WiFi chip.

When I tested it at my desk it worked fine, I powered it via the micro usb connector either via the usb port of my computer and via a 5V 1A power supply, then I took then the board and the power supply to their final location but I started having problems connecting to the WiFi.

I tried to keep the usb cable and the board away from the nearby AC cables and I tried changing the power supply but the problem remained.
Without moving the board I tried to power it with my laptop to try to do some debugging, it connected right away whit a much lower and stable ping (8ms stable powered by the laptop, 100+ ms and fluctuating a lot when powered by the power supply).

Then I powered it whit a power bank and the behavior was identical as when it was powered by the laptop.

What should I do? Should I try to buy a better power supply? Or should I try to solder a capacitor to try to smooth the voltage?

Thanks for the help

Cheap power supplies are notorious for being unable to provide nameplate power. I suspect that the power supply is marginal and that the final location has poorer wifi reception. The combination could explain the symptoms you see. I'd get a better supply.

Get a better power supply.

For items like the ESP32-CAM, I solder 2 super caps in series across the 5V line.

I’m using an original Apple charger for an iPhone, I don’t know if they are better or worse than an average power supply.

Since I need to buy another are there some specs that I need to look for?

Hmmm. That's my supply of choice for Arduino projects, I ran an Uno with wifi for years using one. It will only provide 500mA of course - how much does your equipment need?

Less than 500mA for sure, there’s only the ESP and a Time Of Flight sensor.

The strange thing is that it works when plugged in a socket near my desk

I don't know if the ESP can run the wifi at different power levels, but that's all I can think of that might differ by location, unless the socket at the final location has issues. The laptop and power pack worked but they weren't reliant on wall power.

It might be interesting to use the power pack and charge it there using the Apple charger.

The cheap power supply may actually be current rated properly but its ability to respond may be limited.

Imagine if you will 1 car and a skateboard at the stop light. The car and the skate boarder want to get up to 1 mile an hour, well within the ability of the skateboard or car. When the light turns green the car quickly gets up to one mile an hour while the skateboard requires more time.

The car and skateboard have the potential, Voltage, to go one mile an hour but the car has more ability to provide power (Current) quicker then the skateboard.

I am guessing that the power supply in use does not have the ability to supply the surge current of the WiFi module.