In the last picture you shared, I see you're using a 9V battery. That type of battery doesn't provide enough current for your motors, and it could also harm your ESP32.