« Back to home

CNC Updates

It has been a long time since the last post but I certainly haven't been idle in the Lab. Most of my time has been spent working on my larger CNC machine (a CN3020T) including a number of control board redesigns and fine tuning a PCB milling workflow.

In my last update I described a simple ATmega328p based board running GRBL. That worked fairly well to control the small linear stepper assemblies I bought on eBay so I decided to use a similar board to control my larger CN3020T machine (which I've been having problems with for a while).

Driver and Logic Board

To actually drive the stepper motors I bought a set of single channel stepper controllers from eBay. These are TB6560 based controllers capable of driving up to 3A per motor, at less than $AU 6 each they were a much cheaper solution than the multi-channel board I had tried previously (without much luck).

Each board has a Step, Direction and Enable input which are driven by opto-couplers on the board. Activating the opto-coupler requires a 15mA current on the matching output pin which is well within the range of an ATmega. Unfortunately GRBL only has a single enable pin and driving the 3 enable outputs would require 45mA, more than double the output current provided by the AVR pin.

Output Driver

To get around this I wound up driving all of the outputs through transistors as shown in the circuit above which results in very little current being drawn through the IO pin.

Debounced Input

For the inputs - limit switches on the X, Y and Z axis and the probe - I used a simple debouncing circuit fed through a Schmitt Trigger to get nice clean pulses.

The core of the circuit was once again made up of a minimal Arduino compatible circuit built around an ATmega328p (in DIP format) with an external crystal clock.

Logic Board Detail

You can see photos of the etching and construction process for the board in this Google+ post I made at the time. One thing I neglected to do was include current limiting resistors between the output pin of the AVR and the base of the driving transistor - I simply cut a few tracks and adding them in later resulting in the messy underside of the board that you can see above.

Controller Setup

The board worked well and once I had the settings in GRBL tuned for my system I was getting some very impressive results - far better than using the controller that originally came with the machine. After tidying up the cables and mounting the PCBs as neatly as I could I finally felt like I was making some progress again.

Unfortunately some problems started showing up after a week or so of operation and strangely only when I moved from milling wood to starting to mill PCBs. The main difference was that I was now using the probe input regularly.

The chassis of my CN3020T is not grounded in any way and tends to build up a lot of static charge, even more so in the cold and dry weather we have had lately. When probing this discharges through the ground pin of the probe which is tied to the ground plane of the logic circuit. This leads to the voltage being destablised long enough to reset the AVR or, in the worst case, actual damage to the ICs.

Being able to probe the height of a PCB is essential to mill them correctly so I had to find a solution. I decided to redesign the board completely and incorporate some other changes I wanted to make as well.

For the new iteration of the board I decided to use an Arduino Nano module as the core processor. This combines the oscillator, CPU and USB interface into a single DIP module simplifying the board layout and reducing the overall component count.

Output Buffers

Another change I made was to simplify the output to the motor drivers. I replaced the transistor circuits with a 74HC4050 output buffer with a current limiting resistor to drive the opto-couplers. I also use the same buffer on the inputs and removed the debouncing circuitry. GRBL already does software debouncing on the inputs so it was redundant.

Probe Isolation

To protect the probe input I have isolated it from the rest of the logic circuitry with an opto-coupler. The LED (input) side of the coupler is driven by a separate 9V battery and has a completely isolated ground plane with the probe inputs acting as a simple mechanical switch. The output side of the opto-coupler pulls the input of a 74HC4050 buffer low and the buffered output is fed to the AVR.

New Controller Board

Once the new board was constructed it took less than an hour to get it running again. There were some changes to the GRBL configuration required - inputs and outputs that were previously inverted are not any more - and reconnecting the cables was a bit messier than it should have been. I didn't fully document all the connections last time, something I have corrected now.

PCB milling

I have been running with this controller for over a week now with no problems at all so hopefully I have all the issues resolved now. My focus so far has been on milling PCBs and I'm starting to achieve reasonable, if not great, results. A few more tweaks to the process and I should be able to reliably produce quality PCBs in a fraction of the time it took to etch them by hand.

As for the smaller CNC it has not been forgotten. I'll apply the lessons I learned with this controller board to redesign the smaller one and mill out the new version. Once I have those linear actuators working smoothly I can start constructing the chassis and do some real world testing on it.