@gloomyandy Grounding can be complicated, and most publications about that are it as well - or quite indeterminate and vague. You can imagine the grounding line of mains as a big cage which shields its tiger (AC power) against the outside (which we are part of). General rule: AC leads may never touch the cage.
– Note of caution: there are regions on earth without this third grounding line: I don’t cover this case here. Stop reading. –
In contrast to mains power, low DC voltages are dinky cats, they need not to be caged, but - as is the case with computer equipment or our printers - there are plenty of them: 3.3V, 5V, 12V, 24V, or even negative voltages. These DC voltages often need a common reference point: ground. Ground is different from the AC mains cage, but may be connected to this.
As a rule of thumb, within a printer, there should be one single connection to the tiger’s cage (the mains grounding line), and all DC Power supplies should reference this point, i.e. should explicitly connect their ground to that. As it's bound to earth, this is a good thing.
All metal parts of our printer should also be connected to this single reference point, by this building a kitty cage of our own. This implies that we keep all further DC cables separate from this, both poles. The reason is that we can’t really trust our cage: our playful kitties churn lots of amps, jump around with voltage spikes, handle sensitive signals and provoke static charges with their balls of wool …
So, the second rule is: don’t save a line and connect your load (controller, sensor, motor or heater) to the metal nearby - that’s the cage, not ground power. Always use a separate line, keep it distinct from the kitty cage.
To protect against static charge, we need a third rule: all metal which might be electrically isolated from the frame, e.g. steppers on printed mounts etc., need to be wired to some part of the cage (metal framework of our printer) nearby.
That’s as short as I can put it - three simple rules. – Oh, I forgot one last cat in my zoo: Shielding. For our purposes, a forth simple rule is good enough: connect the cable’s shield to GND of the source (usually a Duet), not to the destination’s ground and not on both ends. Then, all kitties should be happy, and our printers, too. 😊