I don't see any problems, but I can't read resistor values or optocoupler part numbers. Can you tell us what they are? You will also need a flyback protection diode for each relay. (This does not have to be on your circuit board)
*** A) I'd keep the power and ground for the relays separate from the power and ground of the opto-isolators. While it is a common "gotcha" to forget to CONNECT grounds, where you are using an opto-isolator, you can have two... ummm... isolated circuits. Just ask yourself... for every device you want to Do Something... is there a path from SOME source of voltage, through the device and back to the ground ON THE SOURCE of voltage that you are using?
Looks okay. But remember: the circuits you are driving will allow high current flows... possibly too high... if you don't have some resistance in series with the voltages applied to the "inputs" of the optoisolators, unlike an Arduino input, which is, effectively, of a very high resistance.
===
And your English is fine. One bit of "fine tuning"... "I'm not an electronics engineer", or "I don't know much about electronics"... but what you meant was plus clear than anything I could dit en francais, even if I knew how to get the acccent... or whatever it is called.. under the c.
Connection will be like this : 24v+ ==== + side on relays === - side relays ==== optocoupler ==== ground opto === ground 24v
B) On input side :
Same, optocouplers are PC817
Resistor are 2.2k
Connection will be like this : +24v ==== push button === input ( which goes in a resistor ) === ground 24v
Arduino pins will be configured in pullup mode. So if I push a button, it enable the optocoupler and pullup pin will be connected to ground.
On the 2 board ground from 5v and 24 of optocouplers are disconnected. If you see somewhere I have connected them says me it's a fault.
The flyback diode should already there in the relays. I have put the drawings from datasheet. Should I put one more ?
The PC817 opto isolators have CEO = 35V which might be a little low for comfort on
a noisy 24V system.
The worst case is 50% current gain in the opto isolators, so they aren't really up to
switching 18mA with 20mA in. Also you need flyback diodes, so I'd suggest using
the opto-isolators driving some ULN2803's which can handle higher currents, and
include fly-back diodes (connect the COM pin to the 24V supply).
I don't see pull-up resistors on the input opto-isolator collector pins?
Also you seem to be routing 24V ground separately from all the relay wires? You need
ground return with each cable bunch to avoid generating lots of RFI. Same goes for the
input cabling too really.
Is the flyback diode compulsory ? As linked relay says it has one ?
If I use uln2803 after opto isolators, will I not inverse logic ?
On the input part, pull-up will be done on arduino.
On output and input 24v ground are connected together and there is a terminal block to connect it to 24v ground. Is it false ? 5v ground are connected together to arduino ground.
I'll attach better quality schematic in pdf.
I'm trying to understand all I can. Electronics is not simple