CNC Machine

Holy Christ, I haven’t posted on here in a while. The summer and fall quarter have flown past at pretty intimidating velocity and I’ve barely been able to keep pace; since my last post, I’ve worked at Facebook and Wheelz, secured and accepted an internship for next summer at Addepar which I’m very excited about, and taken two weeks off school to fly to Australia to race a solar car I helped build 3000km across the Australian outback.

My most recent project is a CNC router. My roommate and I decided fabricating PCBs is too slow / expensive. Etching is a pain, and CNC machines are cool. No further justification needed… We ended up buying a 7″x7″x2″ kit from Zen Toolworks which we’d been eyeing for a while. Building and wiring the thing was basically extreme IKEA involving an instruction manual written in somewhat comical English. The designers of the control board made the questionable decision of using a parallel interface, and the software that came with it, Mach 3, has a GUI that looks like the font was made by using a JPG for every character. Nevertheless, we succeeded in getting the system to work as a CNC.

Mechanical

For milling boards, we found V-shaped bits much better-suited for the purpose than very fine normal endmills; we were able to mill traces with 0.4mm clearance (15 mil) by setting the mill depth 0.02″ below the board surface. Our strategy to zero the Z axis was to lower the bit to near the surface of the board then loosen it and let it drop onto the surface.

Normal endmill (left), V-shaped bit (right)

We determined (destructively) that the fastest feed rate with the spindle powered directly off a 12V battery (we’re still working on a spindle control board to run it off ~35V, more on that later) is 2″/min.

Spindle Control Board

The CNC spindle board that came with the kit was pretty awful. It has Chinese characters all over it which made it challenging to use (every screw terminal is labelled with the character for ‘electricity’…) and frequently turns off for no apparent reason. The rocker switch they used also has 0.25Ω contact resistance (…)

So we decided to make our own, and create it using our CNC router! I got to work and designed a simple 555 adjustable duty cycle PWM circuit based on this topology, switching the motor low-side. The first rev turned out pretty reasonably fabrication-wise:

Unfortunately I failed and made a primary school mistake, completely forgetting about protection; no diode across the motor, no diode across the FET, no TVS across the power rails… So we made rev 2, with SMC size protection diodes and a truly beastly 2220 22uF ceramic cap across the motor. I don’t know what we were thinking, but it must have been along the lines of ‘better safe than sorry.’ Either that or ‘epic overkill makes us look cool.’

The 2-pin connector goes off to the motor

The cap used to be a 2220 surface mount cap. It broke in half when we desoldered it...

We had some very interesting results. The FET’s drain voltage appeared superficially much like half-wave rectified sinusoidal AC (which would’ve been nonsensical), but on closer inspection and analysis it turned out to be basically ring on a massive scale (at more or less PWM frequency of ~1KHz) about a voltage somewhere between 0V and Vcc. Examining the original spindle board that came with the kit, we saw exactly the same thing happening, but at a much higher frequency and with significant damping. After changing our cap to something more reasonable (10nF) we saw exactly the same thing on our board, though we can’t reproduce our observations in SPICE simulations, modelling the motor as an inductor. The ring is centred on a voltage between 0V and Vcc that changes depending on PWM duty cycle. We’re still trying to work out what’s going on but hey, it works :)

FET's drain voltaged referenced to 0V. 10V/div.

Toolchain

Altium → pcb2gcode → python scripts → g-code → Mach 3 → PCB!

I wrote a bunch of python scripts to treat g-code that pcb2gcode produces. It rectifies unnecessarily large global X and Y offsets that centres the board a couple of board lengths away from zero, which on a 7″x7″x2″ CNC is quite a lot. It also produces a limits g-code file that drills four holes that denote the outer limits of the board, which helps a lot with positioning. To this end I ended up producing a little python g-code library to write g-code to do simple 2-D specific tasks such as ‘mill from (x1, y1) to (x2, y2)’ and ‘drill hole at (x, y)’ etc.

Voronai

pcb2gcode lets you specify an offset parameter which determines how far away the toolpath goes from the edge of the trace. If you set this really big, pcb2gcode just gives you the path that comes closest to meeting the requirement, and the results are pretty cool; the board is electrically equivalent to the one in the gerber file.

Casualties so far

’nuff said. We’re novices, and breaking bits on this is better than breaking expensive bits with the Matsuura we have at the solar car shop. Small price to pay for a process that can take idea to a first rev in under a day.

Next Steps

Our plan is to design a new control board that communicates over serial and can control spindle speed. We’ll probably also write some code to read g-code and interface with it, completely replacing Mach 3. Watch this space; it’s about to be filled with fun toys!

About these ads

3 Responses to CNC Machine

  1. I don’t really understand, but tis sick anyway brah :D

  2. asuareao503 says:

    Finally! It’s been a while…

  3. Veni Johanna says:

    wow Bryant, you never cease to amaze me…

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: