# Configuring the motors of the CNC Mill

I’ve owned this CNC mill for several years. In that time, I’ve rebuilt it twice and added limit switches (crudely using hot melt glue!). There is something I have never done with it though, and that’s to actually use it. In fact, I’ve never cleanly finished configuring it. As I set out on my mission to cut an aprs tracking PCB, and carve out the shell of a model hovercraft (yes, these are my two current projects), it’s time to finally configure this mill correctly so that I can begin to make use of it.

**Tuning the motors…**

My Mach3 software is aware of all three axis motors, and the main spindle, and operates them correctly (almost), and it’s also aware of the limit switches, which function. The first of the problems that I need to resolve is one of calibration. My Mach3 software has no idea how wide the table is, or how many steps are required per revolution of the motors.

To resolve this problem we need to know a few things about the motors, and the board which controls them. The board is the easiest part to know, because I bought it myself to replace the one that came with the mill (a capacitor on the original board exploded the first time I plugged it in).

The board is a Toshiba TB6560 3-Axis driver board, and it looks like this….

However, the motors (which came with the machine) are a little trickier. I can tell that they are all MINEBEA CO motors, and there are some model number markings, which appear to be different for each motor. What I need to know for each of them is the number of pulses required per revolution.

First up, the X-Axis appears to read…

- TYPE:
**17PM-K405-G9V** - NO:
**T4X12-02** - DWG NO:
**AX050193C**

The Y-Axis motor reads…

- TYPE:
**17PM-K405-G10V** - NO:
**T4904-01** - DWG NO:
**AX050192E**

- TYPE:
**17PM-K405-G6V** - NO:
**T3124-01** - DWG NO:
**AX050193B**

So it’s time to use a popular search engine to find out more about these motors!

**Search Results.**

The search was easier than I expected, turning up a data sheet here http://www.cncitalia.it/upload_ele/pap_nmb.pdf and in case this document might be useful for someone else I’m mirroring a copy here. MINEBEA CO LTD Stepper Motor Spec Sheet

According to this data sheet, all three of my motors, despite having slightly different type numbers, fall under the same series and therefore have the same values with regards to the specifications that I need.

- Step Angle …………………………………………………………….. 1.8º
- Step Angle Accuracy…………………………………………….. +/-5%
- Temperature Rise………………………………………….. 80º C Max.
- Ambient Temperature Range ……………………… -20º to +50º C
- Insulation Resistance……………………. 100MΩ Min., 500 VDC
- Dielectric Strength…………………………….. 500 VAC for 1 min.
- Radial Play……………………………. 0.02 mm Max. (450 g-load)
- End Play………………………………. 0.08 mm Max. (450 g-load)

This data tells me that a single step is 1.8 degrees, which means there are 200 steps in one revolution.

Mach3 isn’t happy with this data alone though, it doesn’t want the steps per revolution but the number of steps per millimeter (as my mill is setup to be metric, otherwise it would be per inch) of motion. To calculate that, I need to know the number of revolutions of the motor will drive the cutting too one millimeter.

**Determining revolutions per MM…**

All three of the threaded driver rods in my mill are the same diameter, and the same number of threads per inch/MM, but how do I know for sure the number of threads (and therefore revolutions) there are in an millimeter, accurately? Well I decided to resort to a bit of an ugly trick…

That’s right. I held a rule up to my mill, photographed the threads, and then opened up the image in a paint program to count the threads. It appears as though one thread is around 1 mm across, and to be sure I calculated the threads per inch also. Running the math like this…

Steps-Per-Revolution * Revolutions-Per-Inch = Steps-Per-Inch

so 200 * 25 = 5000

Revolutions-per-millimeter = Revolutions-Per-Inch / 25.4

so 5000 / 25.4 = 196.85

Using the count of 25 threads per inch, it looks as though I should set the mill to 196.85 steps per mm, which is terribly close to my first estimate that each thread is 1mm (in which case that would be 200 steps per mm). So I’m going to start from the assumption that each revolution of each motor equates to 1mm of travel.

Given how crude my system of measurement is, I need to follow this up with a calibration test, to see if the numbers are accurate…

I marked out 1-inch squares on a piece of paper, and then cut it out and stuck it to my mill table with some Scotch double sided tape…

So now, if my revolutions per inch and steps per revolution calculations are correct, I should be able to accurately move the head 1 inch, and confirm it by the distance moved across the paper.

I’m going to tell my mill to move very slowly because it’ll give the drill bit more cutting time, and therefore I’ll go through drill bits a little less frequently. So I’m going to tell the mill to move at about 12 centimeters per minute. Here are my motor tuning settings (all three axis are the same…)

**Testing the settings.**

I jog my drill bit over to the corner of one of the 1-inch squares on the table.

Then I set the job co-ordinates on my screen to 0,0,0 and jog the drill bit to another corner of the inch.Oh no!

Mach3 is reading X=40.0700, Y=41.0700! I was expecting them both to read around 25.4 (given that there are 25.4mm in an inch), so what has gone wrong?!

*note: To be sure, I did perform the same test at 196.85 steps per mm as were the numbers from my calculations in inches, not because I questioned the math, but because it was a quick double check of my assumption from earlier.

**Fudging it again…
**

Now, I have been through this process before. There’s a process by which you can calibrate your mill by moving the bit a specified distance, and allowing Mach3 to count the number of steps (pulses) it took. Before I started trying to calibrate by mill this evening, it was set at 300 steps per mm.

With some experimentation, I’ve found that setting the software up at 325 steps per mm, I get really close to precise numbers. Trying both the X and Y axis in a single measure, I get 24.5mm for the X-axis, and 24.9mm for the Y axis. This puts me a fraction of a mm off measure in either axis, but given that I’m measuring by eye with pencil lines, that’s not all too bad.

So I’m now stuck with something of a puzzle as to where I went wrong. Perhaps someone reading this will recognize it and let me know!