CNC Motor Driver

This is a bit of electronics refit work I did together with Brian Bolger who I work with.  He also runs his company, CD Modelz, making parts for model farm machinery.  The CNC router below is one which he made himself, and the motor driver to the right which was bought separately is what we will be looking at.  It is a 4-axis 1.5A stepper driver  (the 4th axis is available for the machine but not shown here) which is controlled via a PC parallel port using software such as Mach3.

Recently, the driver had been playing up: stalling, missing steps intermittently, etc. so we had a rummage inside.  Here are the contents.  The power-supply consists of a toroidal transformer with a rectifier and smoothing caps on the PCBs.  The heart of each axis is a Toshiba TA8435 stepper driver and its associated passive devices.  The rest is mainly interconnect and heatsink hardware bolted to the aluminium case.

We found that the PCBs were in a poor state of repair with tracks lifting and poor connections on the chip-sockets.  Rather than trying to fix the board which would be hit-and-miss, we decided to assemble a new board and re-use the other components.

Things have moved on a bit in stepper control from the drivers used above, and with the increasing popularity of hobby robotics, there are many more options.  Modern driver chips from companies like Allegro use DMOS technology to significantly reduce power-dissipation and, consequently, package size.  The new packages are generally surface-mount devices which can be tricky to solder, but PCB modules with the driver-chip and associated passives are available from robot shops.  The type which I elected to use was the Pololu stepper driver carrier with the Allegro A4983 device.  It is available in two versions: with and without voltage regulators – I’ll come back to this choice later.

The next step was to check how well these modules would integrate into the remains of the CNC drive.  The A4983 is rated at up to 2A, while the old driver supplies 1.5A and the motors are rated up to 2.5A, so no problems there.   The absolute maximum supply voltage is 35V – I stuck a multimeter on the output of the power supply to find 34V peak.  This is way too close for comfort, so I needed a way of stepping down the transformer without too much work.  It would have been possible to partially uncoil the secondary winding, but this would have involved unravelling a lot of the protective banding around it and then coming up with a suitable replacement covering.  Instead I decided to add some windings to the secondary in the reverse direction in order to reduce the effective winding ratio; then I could just cover the extra coils well with tape.  This would take a bit of trial and error as the number of coils is unknown without opening the transformer, as is which winding direction is actually ‘reverse’.

I set up the test rig below to measure the output with different windings.  The transformer is connected to mains and the output through the rectifier is connected to a capacitor for smoothing.  I also added a fan as a load to bias the rectifier as this will give a more representative output voltage.  The peak voltage is measured with a scope for different winding setups.

On the first attempt I added around 10 turns using some insulated wire from a hacked up inductor.  The voltage went up to 37V peak, so obviously the wrong direction.  Wound back around 12 turns in the opposite direction and almost exactly 30V which will do nicely.

Here’s the bandaged up 30V transformer ready to go.  I just cable-tied the extra winding to secure it and then covered with a lot of insulating tape.  Put some heat shrink on the end of the new wire to tidy it up:

So finally it comes to the board itself.  The aluminium extruded case has a slot for a PCB which is 73mm wide so this was a starting constraint on board space.  The other dimension shown below is common Eurocard length of around 160mm.

Apart from the original functions of the driver, a further requirement was that the spindle-motor could be switched on/off by program-control.  There were some unused outputs on the parallel-port connection and I chose pin-14 for this function.  The switching is performed by a relay with a 5V coil which can switch the 220V feed – the rectangular block in the middle of the PCB – and this is where the regulator module comes in.

Normally only one regulator module would have been required to power the 5V logic supplies, but the relay coil consumes significantly more power, 80mA in all.  Each regulator can provide 100mA, so allowing for 10mA for the logic supply for each axis, two rectifier modules would be required – this also happens to make the board nice and symmetrical which is a personal obsession so a good result all round.

I won’t go into too much detail about component selection and design details here but can provide any information if requested – the main components are:

  1. Two large (6,8ooµF) capacitors for supply smoothing and buffering
  2. The driver modules themselves
  3. Clamping diodes to supply and ground rails on all motor leads
  4. Motor connector terminal blocks
  5. Power-supply terminal block
  6. Logic (step/direction, control) terminal block (green one to the front)
  7. Relay and switching transistor

Note that the external clamping diodes are not necessary in the general case as the body diodes of the driver’s internal H-bridge will perform the same task.  These diodes are not well specified in the data-sheet though and their forward voltage is quite high (1.2V).  In this application where we’re operating close to the voltage limits it’s not a bad idea to use diodes with known characteristics.  The ones I selected for clamping to the positive rail are ultra-fast and have low forward voltage (Trrm = 35ns; Vf = 750mV), so should prevent any voltage transients appearing on the pins of the chips.  Another plus is that they will also reduce power dissipation within the drivers.

I had used other Allegro driver parts in previous designs and been able to run at 1.5A with no heat-sinking in a low-airflow environment.  The other part (an A3982) has a much bigger packages than this, though – SOIC24 vs. QFN28 – so was able to dissipate a lot more heat.  The QFN package dissipates most of its heat through a soldered heat-pad to the PCB, but these Pololu modules have quite a small board area so this option is limited.  Also, from reading articles written by people who have used these, they can get very hot at around 1A.  We had already specified a fan for the refurbished board (shown below to the left), but now a heat-sink seemed like a good option as well.  There are no QFN-specific heat-sinks which I could find, and most stick on types small enough would still have significant thermal resistance – not a problem though as Brian just drew a big one up and machined it from aluminium. The completed structure is shown below with the finished board and wiring.  The heat-sink has 4 ‘feet’ which touch onto each driver chip with a thermal pad for electrical insulation, and a clamping bar underneath also with thermal padding.

Finally, it all goes back into the case.  The PCB slides into the track in the case and the power components are bolted underneath.  Fan and grille are bolted onto the front panel and the rear panel is given some air-holes and closed up.

After a little bit of setting up pin-numbers in Mach3, the new driver ran first-time.  Here is a video of it running an engraving add-on – I am told that the bit is not a proper engraving bit, hence the poor definition of the edges towards the end.  So there it is – a working 4 axis CNC driver for around €100 in parts.

6 Responses to “CNC Motor Driver”

  1. […] […]

  2. Nice project. Well done

  3. Great job. The improvement over the old driver was immense. Plus at €100, try buying an off the shelf driver for that amount!

  4. wow, excellent. Better than the flux capacitor would you say?

    • I would say that they each have their own merits, Mary. The flux capacitor would be my first choice for time-travel applications, while the CNC driver is the clear winner for running CNC machines.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: