I am pretty new to using Arduino and have to power 2 12V pumps. I have an external 12V DC supply and 2 5V relays to independently control the 2 pumps, but I have no idea how I'd wire everything nor do I get if I need any other components (MOSFETs, resistors) to make sure I don't fry anything.
An Uno output cannot supply sufficient current to directly drive a relay. There needs to be a transistor driver to switch the current. The linked relay module has the driver on board so should be OK.
I think the better way is to use the transistor to drive the motor and not use the noisy mechanical relay that will wear out.
Choose the motor driver 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. Zero your meter lead resistance before measuring the motor coil 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.
Also, if required, the transistor driver allows the use of PWM to vary the speed of the motor. Not possible with a relay.
The relay and the motor require external power supply(s). The Uno is not a power supply and cannot, safely, provide the current to drive relays and motors.
So a MOSFET for each pump as opposed to the relay. Do the MOSFET also need external power supplies? And secondly, for the code, I can give a condition like a sensor reading > 1000 to switch the transistor on, right?
Also in the drawing, are the diode and capacitor necessary for the circuit, or is that an example of the kind of motor?
No. They need so little power that you may be able to run the Uno from the 12V supply without it overheating, and not need a separate 5V power supply for the Uno. But that's a maybe. Tell us what else will be connected to the Uno - sensors, displays?
Yes
Yes. The diode protects the rest of the circuit from the jolt of reverse voltage/current that is created at the moment when the pump is switched off. The cap suppresses electrical noise that could cause problems in the circuit when the pump is on.
Here are the MOSFET motor driver and the relay module(with transistor driver) driving a motor to show the power supplies required. The MOSFET only driver only needs a motor supply, the relay needs a coil driving supply and a, separate, motor supply. Do you see an advantage to using the relay?