Could you tell me a model of diode that can be used? I don’t want to make a mistake because I don’t know much about diodes.
I’m not an expert myself, but a 1N4001 solved the problem for me with solenoids in a similar setup.
See this discussion:
I suggest you test it out and see if it helps.
No. It is not. The pump turn-on is sucking the 5V battery level low for a few microseconds. Long enough to reset the ESP.
To prove this, use a second power supply for the pump:
Whomever suggested separate grounds- DON’T. Separating grounds is rarely needed.
If the problem disappears using a separate PSU, then you can go back to the single supply, but put a large capacitor across the battery, preferably at the ESP. At least 10mf. (Mind the capacitor polarity). Depending on how much is the start current of the pump you may need an even larger capacitor.
Your ‘schematics’ are almost impossible to read and I don’t see any difference between the two.
There is no battery, there is a single 5v power supply, what you say I had thought at first, and so I connected my tester to the power supply, and then I connected the pump, but the power supply maintained 5.05v the whole time.
The pump draws about 400 mAh when immersed in water.
If the tester is not able to detect it in a few microseconds, it is possible.
However, it seems rather strange to me, since the ESP32, the LEDs connected to it and the DHT sensor go crazy continuously as long as the pump remains connected, from the esphome log I see that the ESP32 signals that the DHT sensor has a problem, that the LEDs are continuously turned on and off as if I had done it manually by pressing the physical button connected to the ESP32, in fact the log signals that I pressed the button, even if it is not so, it does not happen just for a moment when I turn it on, but always, until I turn it off.
Try a separate PSU. It is a simple test and if I am correct, the pump running will make no difference to the ESP.
If the pump motor is brushed (do you have the specs?) then noise is guaranteed.
You really need an oscilloscope to see what noise the pump motor is introducing. A .01uf capacitor at the ESP may help with motor noise.
Yes, the pump has a brushed motor, I have already tried powering the pump separately, in that case everything works correctly.
The pump looks similar to this one.
You can’t measure “stable” 5v with multimeter, it’s too slow to show quick voltage collapse. If you really can’t use separate psu for pump, try to add capacitors at least. Separate psu would help also with interferences.
To complete correct setup of relay module, move gnd to jd-vcc side. It doesn’t resolve your problem, but in case you decide to go with separate PSUs, at least you have optoisolation like designed
I found a capacitor 0.1uf like this at home.
I tried it and it seems to work.
You have all the info to further improve your setup.
Also twisted/shielded signal/sensor wiring is improving reliability.