Does DC mini water pump need Relay? or can it connect directly to arduino?

hello, I'm new here, and I'm a beginner.

I'm making a project for my homework, it's a soil moisture sensor and a mini dc water pump. The problem is the water pump, I see many people on internet that says it needs relay , but I also see some youtube videos that doesn't use relay, they connect the pump directly to the arduino. I'm confused now.
I welcome any advice , thanks so much.

edit : and I'm grateful if someone can teach me how to write the arduino code for the pump thanks !

There's all sorts of of rubbish promulgated on YouTube, some uninformed, some outright mendacious.

Show me an electric motor that can move a significant amount of water, and run on less than 40mA

You must use a proper driver for the relay.
You can build or buy:

https://www.google.com/search?q=arduino+relay+circuit

1 Like

For a DC powered water pump you could use a logic level MOSFET along with a couple of resistors and a flyback diode as a driver.

Choose the MOSFET based on the stall current of the motor and the motor supply voltage. The stall current can be several times the running current. The stall current will be drawn, briefly, every time that the motor is started. The stall current should be listed in the motor data sheet. In the absence of a data sheet, the stall current can be estimated. To estimate the stall current, measure the motor winding resistance. Take several measurements rotating the motor a bit between readings. Use the lowest reading in the calculation. The estimated stall current is the motor supply voltage divided by the measured resistance.