Introduction: CNC Controller - Complete Rebuild.

About: I enjoy working in wood and metal, doing overnight bushwalks, playing music, solving problems etc.

When I first built my CNC router, I used a TB6560 driver board and 2 x ATX power supplies (2 * 12 = 24 Volts) to power it, but the board died and the power supplies gave me grief, so I replaced them all..

The old box was too big, and when I replaced the power supply and driver board it had lots of large and ugly holes in it so I rebuilt the box as well.

Step 1: CNC Controller Rebuild

This instructable is in 3 parts:

1) Make the box

2) Install the Components

3) Wire it up, set the DIP switches and test.

I love using junk & recycled stuff to do projects, so a lot of what I used for the re-build is recycled.

Step 2: Bill of Materials:


1 X piece of 16G steel 120mm x 100mm for the breakout board bracket

16 X plastic spacers 12mm long, cut from empty biros

1 X dual 240V power point

Wire mesh to cover fan hole

1 X SPST toggle switch

1 X DPDT mains switch

1 X 7805 voltage regulator

1 X 7812 voltage regulator

1 X 100mfd 50V electrolytic

2 X 470mfd 25V electrolytics

1 x .22 mfd greencap

1 x .1 mfd greencap

1 X Rubber grommet

1 X 15 pin D connector

1 X single RCA connector

1 X computer style mains socket

1 X computer power cord with moulded plugs

1 X Computer fan

1 X 30 amp 12 V spindle relay

1 X two connector insulating block

4 X plastic feet

4 X Pieces of sheet metal for the case

4 X Self tapping screws for the back panel

4 X 3mm short bolts for the power supply

2 X 2mm bolts for the voltage indicator

7 X Metal standoffs with screws

1 X Computer 12V power plug & socket

Wire with push - on connectors


3 X TBH7128 Stepper motor drivers

1 X Breakout board

3 X rainbow ribbon cables with plugs


1 X 24V 10 amp switching power supply

1 X digital voltmeter module

Step 3: Tools:

Metalworking tools: drills, tin snips, scriber etc.


1/8” Pop rivets

Pop Rivet gun

Pieces of angle iron or rigid bar (for bending sheet metal)

soldering iron & solder.

Extra (desirable) tools:

Wire strippers

Drill press

Band saw

Sheet metal bender

“third hand” PCB holder ( to help solder wires together).

Circle cutter suitable for metal, as some larger holes need to be cut.


Step 4: Construction Notes:

The physical components were layed out on paper and these dimensions transferred to the metal. Measurements were scribed on so they didn't rub off during the construction.

Because there are a few folds to be made in the metal, it helps to write on each folding section which way it folds, and along what line, to avoid confusion.

I have attached a fusion 360 plan "CNC box V21" which shows the panels and the holes.

To see the dimensions, open this file in fusion 360, then double click the relevant sketch.

When making sheet metal boxes, I like to cut the major holes before bending & riveting it together.

When bending the metal any panel with a large hole (eg. fan hole) is the one that is clamped down securely and the adjoining sheet with no nearby holes is the one that is bent to form the corner.

Note: Until all the drilling, cutting and sanding is done, despite using various PCB's and components to check alignments etc, it is best NOT to install them yet, no matter how tempting that may be.

Metal shavings kill electronics.

Step 5: Making the Box:

Working on the main part of the box:

Circular holes: It's best to use a hole cutter for the fan hole, but if you don't have one, drill holes around the circumference and carefully file it smooth.

Rectangular holes: Using a nibbler, or hacksaw cut diagonal slots from the centre to the corners to make the flaps for strength and to provide rounded edges.

Fold the 14mm "joining" tabs to 90 degrees then fold the 2 short sides in to form the box.

Re-measure along each side, top & bottom to confirm size & squareness. (Important.)

Mark and cut a top & bottom panel to fit these dimensions.

Fold a 14mm re-inforcement flap @ 90 degrees along one long side of the top & bottom (as per Fusion 360 diagram).

Mark and drill 3mm rivet holes in the top & bottom panels 8mm from the edge. (These holes are a guide to drill the holes into the main part of the box.) Exact positioning along the sides is not critical. (See photos.)

Before riveting the top flap, carefully measure the mounting holes on the 24V power supply, transfer these measurements to the top cover and drill 4 x 3mm holes.

Check that the holes all line up with the ones in the power supply. When the power supply is finally mounted it should be about 17mm out from each edge to avoid collision with the 14mm joining flaps.

NOTE: if you use the same type of power supply as I did, it has holes for 3mm machine bolts, but they must NOT be longer than 5mm. The bolts I used came out of ATX power supplies.

Once you are happy with the hole positions, rivet the top on the box but don't install the power supply yet.

Step 6: The Bottom Panel:

Rivet the bottom panel, but don't rivet it along the front side because a support needs to be inserted.

Note that the driver boards stick out of the box about 20mm. This is so that the plugs for the steppers and the 24V supply have easy access, and it allows the cooling fins on the driver boards to sit right in the hole for maximum airflow. (see photo)

Step 7: The Box (continued):

Driver board support:

Cut a piece of metal 180mm long and 50mm wide, fold it in half lengthwise, and position it so that it sandwiches the bottom panel of the box. (One edge slips between the bottom of the box and the 14mm tab, and other edge is under the box.)

Drill & rivet one hole at the end, then line it up so that it is parallel with the box body, before drilling and riveting a hole at the other end. Put more rivets in the middle.

Attach the ground terminals for the shields that cover the Motor Driver cables. (See photo)

Working on the bottom of the box. use the driver boards as templates to mark out the mounting holes.

Support the other side of the metal with a bit of scrap wood, centre punch and drill 3mm holes and check that they all line up with the holes in the PCB's.

Step 8: The Back Panel:

Measure the dimensions of the back (open) side of the main box, mark & cut a sheet metal cover to fit over this opening with 10mm edge tabs on all sides.

Cut holes in it for the breakout board and 15pin D connector, and the RCA connector if you use it. (as per diagram and photos) and fold the edge tab 90 degrees so that they go outside the main box.

Drill 2 holes in each of the long edge tabs for the self-tapping mounting screws, fit it to the box, drill 2 smaller holes in the box to take the screws.

The breakout board is mounted on a strong steel bracket so that it will withstand plugging and unplugging of the 25 pin connector without stressing the board.

Mark & cut holes for the breakout board D connectors and for mounting screws onto the piece of 16g steel and bend it in an L shape, so that there is 12mm clearance between the board and the metal.

Check that the D connectors fit in the holes, and mark the mounting holes under the board. Punch and drill the mounting holes for the board. drill 3 x 3mm mounting holes in this bracket so that it can bolt to the back panel

Install the breakout board & plugs, onto the back panel.

Drill holes in the bottom of the box for the plastic feet and install them.

Fix up any paintwork which might have been damaged in the folding.

Install the fan with the wire mesh in front of it. I used 12mm wire mesh to maximise airflow.

Bolt in all other items, with suitable lengths of wires already soldered on them, and install the driver boards last.

Step 9: WARNING:

This project uses Mains power which can easily kill you.

If you don't understand mains electricity, or you are unsure about anything, then DON'T to do this next part of the project until you get advice from someone who does know.

Step 10: Wiring and Installation:

The original box was designed to be exactly deep enough for a single board that had the breakout board and 3 x TB6560 drivers all on the one PCB. I ignored all the bad press about these boards to “save” about $20 and seriously regretted it.. It never worked properly, then one day, lots of smoke came out, because its little cooling fan failed to start....

The smoking ruin was replaced with 3 x THB7128 individual driver boards & a separate breakout board, (see links) which has provision for XYZ, A and B outputs. These boards are much better although a 330pf capacitor had to be soldered between pins 1 & 3 on each THB7128 IC to fix spurious triggering.

Here is a good link showing how and why this is done:

Step 11: Wiring the Breakout Board to the Drivers:

Connection of the breakout board to the Drivers is straightforward. (See table)

Step 12: Connecting the Breakout Board (continued)

Note the bridge between terminals 1 and 3 on the driver boards (Cp+ and Cw+) which is essential, but not commonly documented. (see Photo )

Step 13: Setting the Dip Switches

See table showing how to set the DIP switches on a THB7128 boards with 6 switches:

A datasheet for the THB 7128 can be found at:

Step 14: Limit Switches

Looking at the photos of the back panel of the control box, you will see that there is an RCA connector on the back panel for a Z axis probe but I haven't been able to implement that function on this breakout board.

The 15 Pin “D” connector goes to the limit switches and the Estop on the CNC, and is wired to the appropriate terminals on the breakout board. (P 10 Estop, P12, 13, 15 XYZ limits)

Six pins are needed: Signal ground, XYZ limits, Estop and Earth Ground. The limit switch wires have been run in shielded cable to minimise false triggering, so the shield of the cable is earth ground, and the 2 wires inside each cable are for each of the three sets of limit switches and the Estop switch.

It doesn't matter which pin connects to which switch as long as you know how you have set it up.

Step 15: The Spindle Relay

I was doubtful that the “spindle relay” on the breakout board would successfully handle the inductive load of a router and vacuum cleaner so the small on board relay was used to control the 12 volt coil of a 30A, 250V relay from a microwave oven.

The PCB from a microwave control board was cut into a square around the relay leaving enough room for 3mm mounting holes. (a band saw is very good for this) The diode across the coil stayed, but all other superfluous components were removed. It's much quicker and easier than de-soldering and remounting the relay on another board.

Step 16: The Voltage Stepdown Board:

The breakout board needs 5 volts for logic and 12 volts for the spindle relay, and the 30 amp relay needs 12 volts, but the power supply is 24 volts so a voltage step down board was needed.

Step 17: Circuit Diagram:

Wire up the spindle relay the voltage divider board, power switch etc.

Note the “spindle over-ride”switch: The spindle relay controls power to the double GPO, which supplies the router, and a vacuum cleaner. (“dust collector”)

It is very useful to be able to turn the power point on without needing to use software, eg to suck up stray dust after a job is finished. The power over-ride toggle switch bridges across the breakout board spindle relay.

This control box has a voltage indicator, and an illuminated mains switch, mostly because they were on hand, but any kind of indicator and switch combination would work.

Step 18: Testing:

Once it is all assembled & the wiring all checked. it should be tested on the workbench.

I am assuming that you have done progress checks on each sub-assembly as you have connected them up. Eg. the Fan & mains switch etc etc.

I have included the details of the config that I used in Mach3 (PDF format.)

If you have some old stepper motors (eg. From defunct printers) then connect them up, plug the controller into your PC parallel port and with mach3 running, turn the controller on, and see what happens.

If you have Mach 3 properly configured, the motors should respond to commands.

It's a good idea to check the operation of the limit & Estop switches at this stage.

If everything works, all you need is a CNC to plug it in to.....

Metal Contest 2017

Participated in the
Metal Contest 2017

Reclaimed Contest 2017

Participated in the
Reclaimed Contest 2017