Typically electronic enclosures are metal boxes with a large opening at the front. Buying a dedicated enclosure comes at its cost, but can bring some features which metal cabinets for other purposes often don't offer. Things you should look out for an enclosure:
size: The recommended size is 24x24x8" or 600x600x200mm. This assumes that the VFD and a normal 36V PSU are mounted inside. If you want to place a Cisco server PSU or a PC inside, you will need more space. If you mount the VFD outside you may need less.
removable mounting plate: you can mount everything on the mounting plate outside of the enclosure and then move the mounting plate inside. This makes mounting everything easier.
Ventilation and filter: The parts inside the enclosure produce heat which must be moved outside, so you need at least one fan. Both the air inlet and outlet should be covered with a filter to avoid dust and metal chips polluting or even shorting the electronics.
If you are on a budget:
check for second hand enclosures
use an old mini server case
split the electronics to 2 smaller enclosures, e.g. tower PC cases
There are several factors that need to be taken into account for positioning the components.
put parts together that you need to connect together
separate high voltage (120/240V) and low voltage (48/36/24/12/5V) parts
separate noisy parts from sensitive parts (see ->EMI)
spacing for VFD: check your manual. HuanYang VFD requires vertical mounting with 50mm to the sides, 120mm top and bottom
Ventilation: The enclosure ventilation should work with and not against the VFD fan. It is recommended to create a draft over the stepper drivers, as these can get quite hot.
space for cable channels: Cable channels keep everything ordered and nobody sees the mess inside if the cover is on.
optionally: leave some space for later additions, like an additional stepper driver for a 4th axis or a mesa upgrade instead of the bob.
Image 1: Air inlet is to the left of the steppers, air outlet is to the top right of the VFD. The main power switch and on button were not taken into account during the design of the enclosure and now almost touch the side of the VFD. Also note that there is space for a fifth stepper driver in the top-left corner as a possible future upgrade.
Image 2: The VFD is actually a bit crammed into the corner. An Air exhaust directly above it would be recommended. Also the stepper drivers should be mounted directly to metal for better heat dissipation
Some of the parts create electromagnetic interferences which can disturb other parts. Simplified, high frequencies at high voltages or currents create most emi, this is mainly the VFD and less important the stepper drivers. Low voltage control signals like the step and dir signals from the parallel port (bob or mesa) are sensitive to emi. Emi issues are a bit erratic, some people get away with things others don't. Sometimes it is difficult to say if a problem is caused by EMI, like infrequent skipped steps or triggered endstops. Here are some tips to avoid problems:
Keep distance between noisy and sensitive parts
Don't run those cables parallel to each other, crossing is much less a problem
Use shielded cables. For the VFD a double shielded cable is required. Normal shielding is recommended for the stepper motor cables and signal cables. For the latter you can use cat5/6 cable (see wiring).
Use twisted pairs if signal lines are not grounded
central ground point: Grounding should be done at a central point or in a star topology. Don't create ground loops. Don't forget to ground the enclosure.
There are multiple ways to connect multiple wires to each other, but the two most common ones are:
Terminal blocks (used in enclosures shown above) : These are commonly found in industrial control cabinets. Each element is mounted on a din-rail and generally has 2 or 4 gates that are connected to each other. Multiple elements can be interconnected. Using the 4-gated version is marginally more expensive, but saves space in the enclosure. When using terminal blocks with stranded cables, ferrules are required.
Wago 221 blocks: These are convenient for prototyping but also work well in this application. Wago blocks come in diferent sizes, from 2 gates up to 8 or so. Each of these gates are connected to each other. You can print connectors to mount the blocks to a din-rail. When using wago 221 blocks, ferrules are not required.
For the enclosure shown in image 1, the following parts were used:
Enclosure (600x600x200) with removable backplate
VFD (from ali kit)
36V power supply (from ali kit)
4x stepper drivers (from ali kit)
Parallel port breakout board (from ali kit)
35mm din rail, L = 500mm
60x40mm (WxH) cable tray, L=1700mm (If possible: go for a version that's tall instead of wide. One size smaller probably also would have fit fine)
2x 12V 120mm case fans, with filters
Main power switch
On-off momentary switch
2x power plug outlet (1for PC, 1 for the water pump)
2x M20 cable gland (power inlet and spindle cable)
A variety of GX16 aviation connectors (4 on the motors, 8 on the enclosure. Figure out how many you need for your build. I'd use cable glands next time.)
Panel mount double USB port (for RS-485 and BOB 5V power)
RS-485 usb dongle
230V 13A 2 pole breaker
30 terminal blocks (2 gates each - I'd go for 4 gated ones next time)
3x 10-pole terminal block bridges (cut to size as needed)
24V DC contactor (4kW, 3 phase normally open)
24V 60W din-rail mount power supply
20A DC 1 pole breaker
Buck converter (converts 24V to 12V for the case fans)
extra DB25 cable
Aside from that, for this build two E-stop switches were also installed on the machine.