Man! Sounds like a big automated hairball...
OK, This is too much for me to say do this, and do that, so I will just give you the general run down with the info you've additionally supplied. (thank you)
Your communications uses pretty much no power but is sensitive to electrical noise.
Your steppers use some power but more importantly create a large amount of electrical noise. They don't care about electrical noise.
The DC motors use power and cause broad band noise.
The solenoids use lots of power and create large current spikes and noise to accompany the spikes.
The game you must play is, Keep Away. You need to keep all these noise sources away from your communications.
This means no motor, or stepper, or solenoid, wires should be running next to, or in the same cable as the encoder, or communications signals unless you want dropped bits and lost encoder pulses.
You want sheilded wires for the communications lines because one of the three ways to get noise into the communications lines is thru capacitive coupling. That's two wires next to each other having mutual capacitance and hence 'talking to each other'. Having the comm lines being wrapped in a shield intercepts this 'talk' and shunts it to ground.
Next: Any wire carrying a current creates a magnetic field around it. Any adjacent wire will be 'inductively' connected to that same magnetic field. The more the power, the more the current, the more gets inductively coupled. Inductive coupling could care less about shielding! To combat inductive coupling you use twisted pair wire. Hence shielded twisted pair!
You want to use shielded twisted pairs for your communications. Preferably you want to run the same for the steppers and the motors as the same processes go into radiating their noise outward. You want to keep these noisy lines away from the communications lines and the encoder lines. Route them on opposite sides of the machine frame or at least try to keep them several inches away from each other. If possible have any power lines cross the comm and encoder lines perpendicularly. Run separate cables up to any motor with a single power/encoder connector and only have them meet at the connector.
As for two pair or one pair, do whatever you want to meet the rules I've stated. No power and comm/encoder in the same cable as this violates everything stated above.
Often its easier to just buy single twisted pair and run everything with it if the power capabilities are low enough to let you run your motors/solenoids with the same stuff.
The third way to have noise issues is conductive coupling. This is the comm ground returns sharing power ground returns. Very bad.
Ideally you would have, for the comm, the comm power(ONLY) and the comm, in a shielded cable. This would include the comm return. Then you ground the shield on one end or if the machine is large perhaps on both ends. Technically you should keep the machine all bonded together with short wire jumpers meant for keeping the machine electrically contiguous and leave the shield unconnected on one end.
Sometimes to be cheap you might use a single twisted pair for the comm A,B and the cable shield for the ground return. This is not optimal though. Better would be a twisted sheilded pair and ground wire separate from the shield so the shield can remain disconnected on one end. Hard to find this in a cable, so often you use two shielded twisted pairs in a cable and use one of the 'other pairs' for the ground return.
So in doing your layout think about the return ground currents needed for each subject and make sure a rational, specific, deliberate ground return is provided for each device that needs it.
Keith Cress
kcress -