Just two quick questions:   Should you mains earth reference your electronics?

Just two quick questions:
Should you mains earth reference your electronics?
Should you Ground and/or earth your frame if you are using an aluminum frame?
I don’t really want to mess up with dangerous mains-level voltages
Thanks in advance

Most printers use low-voltage DC power from a purchased power supply. Earthing the frame should not be necessary in this case.
As far as the earth reference, go with what your power supply uses on the low-voltage side. (Usually the negative lead.) This may or may not be mains earth connected inside the power supply, but I wouldn’t connect it on the outside, just in case.

The PSU should the appropriate ground internally. Externally connecting them may cause a ground loop which may affect analogue signals that are referencing 0 volts. Unless you know specifically of a problem and what it is I suggest you stay away from meddling with mains voltage dragons … for you can be made crispy and taste like chicken !

It’s important to know the difference between AC ground and DC ground. If you have a metal frame that has (potentially) exposed metal parts and you wire it to your DC ground, all you have to do to create a potentially damaging short circuit is let anything that is not at 0V touch the frame. If the frame isn’t connected to anything, you’d have to simultaneously let the frame touch two contacts that are at different voltages. How likely these situations are depends on the design of your printer, how tidy and secure your wiring is, and how careful you are about turing power off before working on it, but the possibility of accidentally touching one non-0V wire to the frame will always be greater than the chance of accidentally simultaneously touching two wires at different voltages to it.

Though not generally necessary for 3D printers, exposed metal parts should be connected to protective earth (usually the third contact on power outlets, wiring color yellow/green or plain green).

my rule is that anything that could potentially have exposed high voltage, either through a short circuit, wiring fault, or other should be connected to earth ground. the entire case of a power supply is connected to earth ground. should the power supply fault and provide full AC power over any of the leads, you would want any other chassis or enclosure connected to earth ground. this would prevent a potentially deadly situation where a fault would cause the chassis to be a wall power potential. by grounding it, it would trip a breaker or fuse instead of killing you when you touch it.