CNC Controller Board

stepperDriveRenderIso5 withSpot

As noted in the second portion of how NOT to build a CNC mill we reference the need for a new controller board.  This board is designed to interface with EMC2 over a parallel port.


Desired Features

  • integrated stepper drivers
    • current selection via inexpensive single turn pots
    • automatic idle current cutback
  • spindle on-off control (connector for external relay)
  • emergency stop switch input
  • home switch input
  • multiple power options
    • ATX power supply
    • auxiliary logic voltage
    • auxiliary motor voltage
  • parallel port connector

Probably the most noteworthy feature this board is automatic idle current, which deserves a bit more discussion. A small MCU will be included on the board which will be looking at the step signal of each axis. When the microcontroller sees that a single motor’s step signal has been inactive for a period of time (i.e. one second) it will throttle the amount of current going to that motor. Since the current is controlled by a voltage going into the A4982′s Vref pin, and analog multiplexer will be used to select between the running reference voltage and the idle reference for voltage (which is approximately 33% of the running idle current).  Including this feature on the control board minimizes the number of outputs required from parallel port. Although disabling the stepper drivers would be easier, it is more advantageous to still supply a small amount of current to provide holding force since there could be some back driving force on the motors when cutting material. This holding torque will prevent the motors from moving unintentionally, which would result in inaccuracies.


What Isn’t Included

This board is intended to be small, inexpensive, but above all provide the essential functionality to adequately control a CNC. With all this in mind, there is no isolation between the controller board and the PC.

This is done for two reasons:

  1. Optical isolators require a fairly large amount of current to drive ( usually around 10-20mA): not all parallel ports are capable of providing this current. Traditionally, optical isolation is used in industrial situations where there can be a large potential difference between two circuits that are being connected. In our home CNC applications, will generally be plugging the computer into the same outlet as the CNC controller, so there should be little to no difference in potential between these two circuits.
  2. Galvanic isolation requires two separate logic supply voltages in order to provide proper isolation. This means that we would need a logic supply for the PC side and a another logic voltage supply for the controller side, which gets costly.

There is also no ESD protection provided other than what is already included on the IC’s.  Again, this is to reduce costs – this is geared towards being an inexpensive board for home hobby use, not industrial environments.

Design Considerations

Since this board will (hopefully) be used for quite a while, some effort was put into a better, more user-friendly design than the A3982 stepper driver board.


Heat Dissipation

Considerably more attention is paid to heat dissipation. The stepper IC’s all have thermal vias underneath them going down to a solid ground plane on the secondary side of the PCB. This ground plane contains no thermal reliefs around the vias, which will help to transfer the heat efficiently. The planes were also continued uninterrupted for as long as possible to provide a greater amount of surface area to dissipate the heat.

Low Impedance Current Paths

A fair amount of attention was paid to creating short, direct current paths for all high current signals. Polygon fills were used extensively on a per signal basis to increase the amount of copper on each trace, but still get around other components without interference.


All vias going to the thermal ground layer have direct connections (no thermal breaks or “wagon wheels”) to efficiently transfer heat.  Routing was done in such a way as to minimize the number of thermal breaks in the ground layer.

Routing of the 24 V power line was also given careful consideration. Its route is as short as possible with as wide a trace as is practical, with no layer changes.

Liberal On-Board Documentation

There are few things worse than coming back to a project a few months after it’s made and having to go and dig up the schematic before making any connections. With this in mind, a fairly large amount of documentation is included on the board. Jumpers are not only labeled, but each configuration is detailed in a graphical manner.


Specific jumper to cut options are also detailed on the board. Most I/O on the board is labeled on a per signal basis, both on the parallel port, motor, and home switches have individual signal labels. Even the voltages of the ATX power connector are labeled on the secondary side of the board for quick reference.

Current Control

One of the really nice features of some of the industrial stepper controllers is something referred to as “automatic current cutback”.  Basically, the controller senses when the stepper motor isn’t being driven, if it’s idle, reduced current is delivered.  This is good for several reasons: it reduces the heat dissipated by the motor and driver, as well as reduces the current load on the power supply.  Things don’t get as warm/hot and everything should last longer.

The reason the reduction in current should work in our application is partly because of the lead screws – they provide a type of gearing, which makes it more difficult to “back drive” the motor when it doesn’t have full torque applied to it.  If you’ve ever tried to turn the end of a geared-reduced motor, you’ve experienced back diving force – the gear-reduced shaft is extremely hard (if not impossible) to turn by hand.

This controller implements automatic current reduction with a small PIC MCU that is monitoring the step lines coming from the computer.  When a channel’s step line doesn”t toggle at least once a second, the MCU flips an analog mux that selects a voltage reference that is around 33% of the set current.



Flexible Supply Voltages

Several different supply options can be selected.  The board can be powered directly from an ATX power supply, providing 12V to the motors and 5V to the on-board logic.  This is convenient/inexpensive if you have an old computer power supply laying around collecting dust.

One of the advantages to using constant current drivers for commutating the stepper motors is the fact that higher supply voltages can be used to drive the motor coils.  These higher voltages help to overcome the inductance of the motor coil, reducing the time it takes to energize the coil, and let the motor spin faster.  An external input voltage connector is included if a separate, higher voltage (e.g. 24V) supply is desired.  Motor voltage is selected via an ATO fuse selection – no soldering is required.

In addition to the high voltage input, the board also has a 5V regulator, so only a single external supply is needed.  Just in case the regulator is overheating with a higher input voltage, a separate 5V input is also provided (jumper selectable).  The high current motor voltage is selected via an ATO style automotive fuse, with the clips arranged like a 2 way jumper.  If you’re interested in high current jumpers, they’re discussed in the wiki.

VoltageSelectionJumper VoltageSelectionSch



The board itself is based upon the Dangerous Prototypes DP10080 Sick of Beige board layout.  The goal of the SoB layouts is that common inexpensive acrylic cases can be made and PCB designers can simply design a board around these dimensions.  This board was already setup to the max dimensions allowable in the free version of Eagle, so it was pretty simple to round off some edges and move our mounting holes to be compatible with the sick of beige layout.  For more information on the cases check out the DP blog category.

At this point, it doesn’t look like any cases are available for the DP10080 layout.  Acrylic wouldn’t really be the best option for this design anyway – an Aluminum base plate with some thermal pads under the driver IC’s would work well as a heat sink – carrying heat away from the driver chips and spreading it onto the case.

Design Files

Eagle schematic and board files are in the hardware SVN repository.  This version is tagged revA.  For a “bleeding edge” version, you can take a look at the stepperDriveInterface trunk.


What’s Next?

The A4982 QFN drivers that were designed into this board seem to be back ordered for a few months just about everywhere.  TSSOP equivalents are available (which would require a layout change), so the actual board will either be slightly different or delayed into 2013.

If you’ve read a few of these design posts now – what do you think?  Is there other information that would be useful that’s not included, something that is especially useful, etc?  Let us know in the comments (or forum for lengthier discussions).

Tagged with: ,
Posted in Electronics
  • Muvindu Tharanga

    i saw a pic in your board can you provide the code with this .

    • bamos

      All design files for the board are located in SVN (see “Design Files” above).  There is a small MCU on this board, but no code was written for it.  This board is currently at revB – I’ll be posting an update post soon on it, the MCU will change from a 12f to 16f PIC.

  • Xxoops


    I can’t open your eagle files.

    • bamos

       A little more detail would be helpful – i.e. version of eagle, what error’s you’re getting, etc.  The files were created with Eagle 6.2 – so you’ll need that version (or later).

      • Xxoops

        Eagle 6.3.0


        line 7, column 67: This is not an EAGLE file.

        • bamos

          I have 6.3 and 6.4 installed as well, under Windows XP – no problems.  You’re probably downloading the webpage that contains the file you’re looking for (open the problematic file with it with a text editor and you’ll notice it’s most likely HTML). 

          Click on the link to the file you want, then on the next page, right click the “download” icon and hit “save as”.  Hopefully that should get things squared away fro you.

          • Xxoops

            Thank you very much.


          • bamos

            Sure thing!  I’m glad you got things working.

  • Xxoops

    I want to buy your CNC controller board Rev. B.

    • bamos

      Hi again, Xxoops, I’d be happy to send you a bare (unpopulated PCB).

      Note that I never got around to writing firmware for the MCU on-board (and it hasn’t been tested at all), so you’ll either need to bypass it (just solder jumpers across the mux) or test and write firmware for the MCU. The board works well without the automatic current cutback, as long as you’re not pushing the drivers to their limit and have adequate heat sinking (I’ve been using it with my CNC since it was built without issues).

      To assemble the board, you’ll need to source the parts yourself and be comfortable with surface mount soldering and likely need either a hot plate or hot air to get the exposed pad TSSOP’s soldered.

      Let me know if you’re interested and we can discuss any details privately over email.

      • Xxoops

        Dear Bamos,

        My email xxoops at g m a i l . c o m