the project does not sound complicated.
programming the unit uses the same concepts of all programming.
it only does what you tell it, and in the order you tell it.
open valve 4 times
open other valve and run motor for x seconds
very simple. but I figure you did not describe how or when to start, if there is an emergency stop. and such.
5 volt power supply.
24vdc power supply
and another power supply for the arduino
you need all three power supplies, you cannot use the arduino as a power supply for the relays.
you should not power the arduino from the 5v power supply that will power the relays.
the relays have to parts. the load side. the load side does not know voltage, only amps. too high and it burns up. no other limitations.
the coil side is very particular. since you said you have 24vdc relays, you need to have 24vdc power in order for them to turn on and off.
the last piece of the puzzel is the signal. many people get the coil voltage and the load voltages mixed up.
if you were asking where to start, we would say to get one power suppy, 12 volts.
get all relays in 12 volts. the reason is that you can power your arduino from the 12 volt power supply.
Please post a link to the relay boards. if they are the ones we encounter with an opto on them then we can tell you how to control them.
if they are just ordinary ice cube relays, you can control them just as easily, but need a bit larger transistors.
since you have 5v relays, start there. check the data sheet on the PN2222 and make sure you connect the correct pins. some data sheets show the pins as if looking up at the bottom of the chip, others as if looking down on the PCB.
when looking at the sketch, the arduino and the base (and only the base) of the transistor must be 5 volts.
the center section, the coil section must be rated for the coil voltage of the relay. the only selection criteria is for the coil, this selection has nothing to do with the load, solenoids or pumps. the right section is the contacts. they ONLY ever see the motor voltage, could be 1 volt or 1,000 volts if the relay is rated for that voltage.
the proper power supply is to supply 5 volts to each relay board. you can connect them all to the power supply.
power the arduino with it’s own power supply
connect the grounds.
as for the pin connections, we typically suggest you do not use pins 0 or 1 on the digital side, but rather start with pin 2. 0 and 1 are used RX and TX.
since all your work appears to be for relays, start with 2, 3, 4, 5, 6, 7, etc…
it is very easy to have two pins be driven at the same time.
these will be executed in sequence faster than the relay will respond. for all purposes, it will be at the same time.
here is a suggestion. write your program, connect an LED to each pin. test it. if you are happy that the LED’s light in the correct pattern, then connect your relays.
you did not mention how you want to signal the program to start, or if you need to have an emergency stop.
also, read “blink without delay” you should not be using delay in the program if you have an emergency stop.