ESP32, Relay Module, and 5V DC Pump configuration
Hello guys, sorry to the ugly diagram.
I am playing around the 5v DC water pump and a relay module. I plugged the components like in the diagram and uploaded the code to test the components. After uploading the code to the esp32, it shows errors once in a while which sometimes messes the esp32. I don't have a power module at the time so i have to use the 5v of the Arduino Uno. Also the 5Vin of the esp32 that I have doesn't output any voltage hence i just used the 3.3v of the esp32. I tried to use the components on their own and it works fine, but once i put them all together, like in the diagram, it shows weird behavior.
code of the esp32:
errors that showed in the serial monitor:

5 Replies
You will need a separate power supply for the relay and pump.
The relay should not be connected to the 3.3v pin.
I also wouldn't connect both the relay and the pump to the 5v pin of the Arduino board.
So, you need a different option to provide 5v to both the relay and pump.
Like that sir?
ps. I am bad at lines. sorry for this

I would use a different power supply, not an Arduino board.
ok sir, thank you for the insight. I will try a different power module. But would the configuration would be the same to the updated diagram? Also, what would be the difference if I used a different power source compared to the 5v of the arduino? Will if fix the crashes of the esp32?
Not powering the relay from the 3.3v pin might help with any issues you're having with the ESP32.
The difference between using a different power source compared to the 5v of the Arduino would be the ability to reliably handle the current draw and the longevity of the power supply.