Desktop CNC Milling Machine

I'm a sucker for cheap Chinese gear.

I just bought a small (30cm x 30cm) desktop CNC mill from China, to make PCBs and other things, from CNCDIY.

Its a smallish machine, with a welded aluminium frame and recycled stepper motors. I'm still waiting on the control electronics, but it looks like it will do the job.

Some initial thoughts:

  • The wiring to the stepper motors is Cat5 - I should replace this with something with more current capacity
  • There are no home/limit switches - I will have to add these to get a usable device out of it
  • The spindle is not switched - I will have to come up with a way to PWM it from the computer
  • There is a wire soldered where the fuse should be on the stepper control board

Mechanics

Here is the CNC mill, complete with a rather liberal coat of bright blue paint. It is a moving workpiece machine - I would have preferred a moving gantry as it would take less space.

Control Board

The control electronics came installed in a PVC DVD case.

 

The board is based around an array of 3 Allegro 3977 stepper controllers. These controllers support up to 8 microsteps for increased positioning resolution (but at the cost of speed and linearity).

The small red switches (labelled 1S1, 2S1 & 3S1, but the labels are obscured in the photo) control the microstepping level, see the table in the bottom right of the board.

The pots (1W1, 2W1 & 3W1) control the maximum current through the motors. Unfortunately, the motors are covered with a thick layer of paint, so I can't tell what the current rating is.

Limit switches can be connected to P4, a pin header in parallel with a female DB9 connector. I found that the internal pullup resistors on my parallel port were insufficient (or nonexistent) so I could not get a clear reading off the switches until I added 33kΩ resistor between each of the switch lines and +5V. I did this by soldering the resistors in between the pins on the P4 pin header.

pullup resistors
Z axis limit switch
Z axis home switch

Pin Header P4
DB9 Description
1 1 Ground
2 6 Ground
3 2 ???
4 7 ???
5 3 X Home
6 8 Y Home
7 4 Z Home
8 9 A Home
9 5 +5V
10 5 +5V

 

An additional axis can be connected to P1, a pin header in parallel with a male DB9 connector.

Pin Header P1DB9Description
1 1 Direction
2 2 Ground
3 3 Ground
4 7 Step
5 6 Ground
6 8 Ground
7 4  
8   N/C
9 5 +5V
10   +5V

 

There is a single jumped marked 'X' which toggles the enable line on all the axes.

The [123]X4 jumpers seem to be related to the reference voltage for the current limiting PWM - not sure how just yet. Maybe moving it to "off" (pins 2&3) disabled current limiting?

Finally, there is a parallel port connector, also in parallel with a pin header.

Parallel Port Pin Header Description
1 1  
2 3  X Step
3 5  X Direction
4 7  Y Step
5 9  Y Direction
6 11  Z Step
7 13  Z Direction
8 15  
9 17  
10 19  
11 21  X Home
12 23  Y Home
13 25  Z Home
14 2  
15 4  A Home
16 6  
17 8  
18 10  Ground
19 12  Ground
20 14  Ground
21 16  Ground
22 18  Ground
23 20  Ground
24 22  Ground
25 24  Ground

EMC Setup

After some trial and error, these are values I found for the EMC Stepconf setup:

Setting Value
Steps per revolution 200
Microstepping 8
Leadscrew Pitch 1.75mm

PCB workflow

  • Design the schematic in Eagle
  • Layout the PCB in Eagle
  • Print out the PCB on a laser printer, think for a bit then go back and fix the problems
  • Generate GCode with PCB-GCode
  • Optimise the GCode with PCB-GCode Optimizer which can be downloaded from MediaFire
  • Drive the mill with Linux EMC

22nd June 2009 Update

I soldered some microswitches salvaged from old DVD drives together and attached them to a stripped serial cable to create home/limit switches for the machine. Things aren't quite working correctly - the machine is unable to read the switches, even though I have confirmed at the parallel port connector that they are shorting to ground correctly.

23rd June 2009 Update

Trying to figure out why the switches weren't being read correctly, I moved them to the parallel port that controls the laser engraver. One switch now read correctly, but the rest didn't. After some probing with a multimeter, I realised that the lines are shorted to ground when the switches engaged (as expected), but float at 0V when the switches are free. It looks like the internal pullup resistors are worthless on the parallel ports I'm using. I've added 33kΩ resistors between each of the switches and +5V to pull the lines high. Linux EMC can now correctly read the state of all the switches.

When setting up the homing under Linux EMC, I came across this gotcha: If your home position is 0, and the initial position is positive, then your home search velocity must be negative in order to seek home correctly, otherwise, it hits the other limit switch and gets very confused.

29th June 2009 Update

There was a huge amount of runout in the spindle supplied with the machine. I've picked up a second unit (a $30 special from ALDI) to play around with. Since unmounting the spindle is a bit of a pain, I tried the collet from the new one on the original spindle - no more wobble! It seems that the collet is extremely important in keeping the bit aligned.

2 July 2009 Update

I bought some 19mm pine to create a level surface on the mill. The idea is to bolt it on top of the Y axis platen. This will then be milled to create a level surface, ready for cutting PCBs on. To generate the G-Code for the surface, I used Michel Gouget's Surfacing Druid. For now, I am just using a single layer. Eventually, I plan on using 2 layers, with an array of nuts trapped between them and bolt holes going from the top to the nuts to provide a way of securing workpieces.

Resurfacing the platen

3 July 09 Update

The slight banding visible I believe is due to the spindle not being perfectly perpendicular to the workpiece. I will have to figure out how to measure and correct this. In the meantime, I will re-run the resurfacing at 90 degrees to even out any uneveness.

5 November 09 Update

I've noticed there is a bit of skew of in the mill, which results in double sided PCBs not aligning properly, and squares being turned into parallelograms.

To measure the skew, I cut 4 holes at the corners of a 10cmx10cm square, and measured the diagonals (A is top left to bottom right, B is bottom left to top right) and the bottom edge (C). The angle at the bottom left of the square is 'a'. Using the cosine rule: cos(a/2) = ((B/2)^2 + C^2 - (A/2)^2) / BC. For me, A = 140.38, B=141.45, C = 99.63, giving me a=89.579°.

Now that I know the angle, I can correct for the skew using the millkins kinematics module for EMC2 (trivial kinematics with skew correction).

The millkins.skew parameter tells the module how much X is skewed by when Y moves, so if Y moves 1 unit, X will move 1/tan(a) = 0.00734 units, so I will set millkins.skew to 0.00734.

 

AttachmentSize
Ebay_Listing.htm152.1 KB