Soil moisture sensors + Water Pump automation

I've posted about this project before, I'm making progress with understanding how this is going to work.
The purpose: To have 7 soil sensors in 7 plants and 7 water pumps. Each plant will have a soil sensor and will get water according to what it needs.
In the attached fritzing diagram, I've drawn one soil sensor and one pump, but this needs to be x7 the amount.
Power is delivered to the Arduino through the micro-USB port, so 5V with 1A or 2A, a regular USB charger. External 5V power is also connected to the relay board in the drawing.

The components:

Arduino:
Arduino MKR1000

Soil Sensors
Capacitive soil sensors

Relay board:
This (5V 8 Channel)

Or this

Pump (5V):
This

Or this

Questions:

  1. The relay board requires both external power to the JD-VCC and 5V power from the Arduino because the pumps require more amperage than the Arduino can supply, is this correct? If so, is it not enough to connect external power to the relay board? I don't quite understand why power also needs to come from the Arduino itself. I would think that the digital pins can just send HIGH/LOW to the relay and drive it with that.
  2. Is there any major difference between the two relay boards? I see the two types, the blue and the red, not sure what the difference is. For my project, should there be a preference?

Any suggestions will be highly appreciated.

If the 7 plants aren't too far apart and in a line you could have a pipe with 1 valve over each plant supplied with water under pressure from a single elevated tank/bucket kept full be a single pump. That pump won't need any Arduino, just a low level ON and a high level OFF automatic switch. It might be a small pump if the plants don't need too much water and their valves won't be open for longer than the tank/bucket can supply.. the small pump just runs longer to refill.

GoForSmoke:
If the 7 plants aren't too far apart and in a line you could have a pipe with 1 valve over each plant supplied with water under pressure from a single elevated tank/bucket kept full be a single pump. That pump won't need any Arduino, just a low level ON and a high level OFF automatic switch. It might be a small pump if the plants don't need too much water and their valves won't be open for longer than the tank/bucket can supply.. the small pump just runs longer to refill.

As for the valve idea, I would need 7 valves. Then with a single pump, I would connect 7 valves, but still DC powered valves, and I would still need a relay, correct?
Perhaps a valve like this?

when you are looking at moving things, you are talking about mechanics, not electronics.
although they work together, there are lots of ways to do something in each branch.

===
7 plants, 7 pumps

Imagine you have 7 plants with a pipe up to a hanging water basket.
The pipes all end in a semi-circle.
You have one servo with one pipe that can position that pipe over any one of the 7
One pump or one valve
You select plant #3 move the servo so the pipe is over the tube for plant #3 and open the valve, or turn on the pump

Plants arranged in a semi-circle around the servo
1 pump
Servo positions the tube
Pump turns and the jet of water arcs over and water lands in the pot

Hanging water bag
7 valves

we could keep going, but you get the idea

moryoav:

  1. The relay board requires both external power to the JD-VCC and 5V power from the Arduino because the pumps require more amperage than the Arduino can supply, is this correct? If so, is it not enough to connect external power to the relay board? I don't quite understand why power also needs to come from the Arduino itself. I would think that the digital pins can just send HIGH/LOW to the relay and drive it with that.
  2. Is there any major difference between the two relay boards? I see the two types, the blue and the red, not sure what the difference is. For my project, should there be a preference?

a RELAY module, that is the board you buy with 1 or multiple relays and has an Opto-isolator chip or FET or some such.

the relay is most often the blue Songle cube.
a relay is made of a coil and contacts.
the coil is isolated from the contacts. so you can have 230v on the contacts and 5v on the coil

the coil needs power. allow about 100mA per relay.

to energize the coil, you need to have some sort of device, transistor or FET to use the low current output from the Arduino.
An optoisolator has a transistor as part of the output side, 100mA rating is common.

The input to the Opto is often exactly the same as an LED. something between 10 and 20mA. because the opto uses an LED inside and the light is the signal and how it isolates the input from the output.

When you signal the opto, the transistor changes state. The coil is then energized and the coil sucks in that 100mA in a rush. causing load on the power supply. This can often cause a dip in the voltage.
When the Arduino signals the relay to shut off, the coil then is de-energized, the magnetic field collapses and the energy is dumped back into the coil wiring causing a spike, as little as 20% over input voltage but possibly 3 times input voltage.

As you can see, there are two really bad things going on with the power that drives the coils. Things we never want to the Arudino to see.

To address the back EMF spike, we use a diode, so that high voltage is effectively eliminated.
We can use large caps on the input to handle the inrush, so that too can be eliminated.

We could add another cap on the Arduino input to allow for the transient dip in voltage when the coil is energized.

Most power supplies have large caps so the running of the pumps and the driving of the coils will not interfere with each other and one power supply could be used for both.

Remember, the motors are also coils. so will add more of the above.

Now, if you can create a power conditioner to handle both the dip and the spikes, the noise on the power supply, you may be able to use one power supply for everything.
if you used 12V motors and coils and a 12V to 5V power module, that module might be able to deliver 5v to the Arduino without all the noise.

It is for the reasons above that it is highly suggested that you use a different power supply for the Arduino than the one driving the coil and motors.
As for the power supply for the relay coils and motors, the need for separate power supplies not nearly as important.
Often we see 120 volt AC motors on the contacts
12 volt DC on the relays
5V on the Arduino
So each of the circuits would naturally have it's own power supply.

=====================

part 2

each Opto-isolator is like an LED, about 20mA.
8 channels x 20mA = 160mA total output power from the Arduino allowance is required.

If you power the Opto's with the relay board, and only bring the Opto signal line to ground with your Arduino, then you are not delivering power to the opto's, but sinking. The Arduino board can sink a bit more than it can source.

You need to do your due diligence in calculating loads on your board.
You can source on some pins and sink on others and stay on the safe side of power through your Arduino.

Thank you for the great replies! I'll definitely think about it some more now.

moryoav:
As for the valve idea, I would need 7 valves. Then with a single pump, I would connect 7 valves, but still DC powered valves, and I would still need a relay, correct?
Perhaps a valve like this?

That's the kind of valve I've seen. I've seen others for 3/8" pipe. For drip irrigation I'd look for what is used out in fields now.

You don't want a valve that needs power to stay open or closed unless that period will be very brief.

I'd put the valves at the bottom, not up near the tank. I'd minimize how much pipe or hose is used.

The tank is a supply at pressure as long as there's water in it, it could be filled by a human, the pump would only be to keep the tank from emptying. Without the tank a pump must run to supply water under pressure.

If the main water supply is under pressure you won't need a pump so this is far from home use?

The tank could be a bag, it depends on how much water the plants need each day.

How dependable do you find the soil moisture sensors?

dave-in-nj:
each Opto-isolator is like an LED, about 20mA.

Optos work just fine at 5mA, likely at half that. Try with a 2.2K resistor and a 4.7K if the 2.2K works.

7 pins at 20mA each is already pushing the 200mA max (not continuous max) total of the controller chip. You want to use less if you expect to do anything but drive 7 relay modules.