Electronic – Unstable relay when using single power source

esp8266power supplyrelay

I am trying to control a 5V fan using an ESP01 and a relay module from LC Technology.

The setup works when I use 2 power sources but my setup requires a single power source which is unstable. The relay turns on but turns off after a couple of seconds.

Stable setup:

enter image description here

Unstable setup:

enter image description here

I do not know all the electronic terminology, which has made it very hard to search for a possible solution. I hope someone here can help with the missing pieces.

The USB PSU supplies 2.5 amperes, which should be more than sufficient.

Best Answer

Try re-wiring like this and adding a 1000 uF capacitor: -

enter image description here

If this doesn't work then maybe your USB supply is dropping too low when the fan is activated. This could easily cause the circuit to reset.