Arduino stops working correctly as soon as a DC motor is connect

Hello,

I'm trying to connect make a simple circuit in which i have an arduino that reads sensor values and when that value goes above a fixed value it triggers the DC Motor and makes it works. To connect both I'm using a MOSFET IRLZ44N, the motor is a simple 5V motor which is connected to an external power source (5V and 1,5 A), the ground of that source is common with the ground of the arduino.

When i run the program with the external power source disconnect it all works well but as soon as i connect it, the arduino goes haywire priting unknows caracters in the serial monitor and stopping working in effect.

This is the desired wiring:. and this is some photos of mine: ..

I know that the capacitor is in the external source terminals instead of being in the motor terminais as in the schematic but I think that isn't really relevant.

I don´t really know what is the source of the problem and I'm really new to this so forgive me for my possible errors.

Regards

Photos:


Welcome to the forum

Please post a schematic showing all components, how they are connected and how they are powered

Your case seems to be a typical and common case here on the forum of a project without using a snubber.
Post your schematic (even if it is freehand) so that we can help you better.

I'm sorry, here it is.

Is V1 a completely separate power supply from that used for the Arduino?

Is the Arduino GND connected to V1 GND? It must be, but that is not clear from the schematic.

Yes V1 is a separate power source and yes, both grounds are connected.

Other than the ground issue, I don't see anything wrong with the schematic.

Perhaps the actual wiring does not match it. Please insert photos of the wiring in the post, not as external links.

Why don't you think that is relavent?
What else is different in the actual wiring?
Are you using PWM for the motor?

Your title says stops working when you connect the motor.
So is it when you connect the motor or the power supply?

Well, I said that I thought it wasn't relevant because that's what one of my university professors said, and as he pointed out, it's practically the same. Nothing else is different. I'll send the photos. And yes, I am (Gate/port 11).

The external power source is always connected, it is when i connect the positive terminal of the motor to the power source

Even with the MOSFET off?

Sorry I didn't understand what you are asking... If the power source is connected when the mosfet isn't "activated" (I don't know the correct term) ? If that's the question then yes

With the power and motor connected, if the MOSFET is off (not activated) it should be the same as having the motor disconnected. So I would suspect the the MOSFET is bad.

I've though of that as well, but I have a couple of them with me, and I just tested one (run the arduino and it worked fine but as soon as I disconnected and connected the usb to power the arduino for the second time it stopped working again )

I dont believe that I damaging them but I'm really at a loss here...

So are we, because you are not providing enough information to determine what the problem is.

However, breadboards cannot handle motor currents. They are designed for temporary experiments with low power logic circuits, so that IS a problem.

Now I see the pictures.
So it one of those water pumps and you also have a soil moisture sensor is that correct?
If yes the it does indeed make a difference where the capacitor is connected.
There should be a diode and a 0.1uF capacitor connected directly across the pump terminals.

I can only thank all of you for your patience—I'm doing my best to give you all the information I can. My problem really is the inconsistency of my results, some time is does work and some times it really doesnt. You have said that breadboards cannot handle motor currents but my motor is listed as having between 0.2 and 0.5 amps, can those currents really be a problem?

In addition to post #17
Also do not run those pumps out of water, you will damage them

Thats is correct sir, I have a diode 1N4007 across the terminals, but the capacitor isnt, I shall correct that but I only have with me a 0.68 uF (the one in the circuit and this moment) and 2.2uF, can I use the 0.68 or is that a problem?