CNC mill phase 3: PCB design

In my CNC controller design most everything is handled by the PC and the off-the-shelf breakout board and motor controllers. But there is an ‘optional’ hardware layer that provides a measure of safety–both for the user and the machine–and a degree of feedback as to the status of the system. This is where a couple of custom PCBs come in.

The design of this subsystem is based off a sample from the excellent Mach 3 controller software documentation (without permission to reproduce it, see page 4-24 of this pdf document). Essentially the system monitors a series of limit switches–designed to prevent the machine from trying to move beyond its mechanical limits in any axis–and one or more E-stop buttons, which together are called the ‘interface’. It also listens for a 12.5kHz electrical signal that the Mach 3 software generates when it is running normally, and if any of these conditions are abnormal the power is cut to the stepper motors and the machine’s spindle. The Mach 3 example does this in an analog way with a clever series of relays, and includes LED indicators and a reset button to provide system feedback to the user.

I realized that a microcontroller could do the same job and offer some more flexibility, and ultimately be simpler. At the heart of this board is a standalone Arduino–basically an ATMEGA 328 and a small handful of discreet components. The IC just to the right of that is a MAX232 chip for serial communication with the PC. This is certainly not necessary, but I figured I have a PC in the same enclosure, so why not enable it to connect directly to the Arduino, either for reprogramming purposes or for some future physical computing need related to the CNC mill. To the right of that is an HEF4538 monostable multivibrator IC and the rest of the ‘charge pump’ circuit provided by Geckodrive’s Mariss Freimanis, which turns the 12.5kHz signal from Mach 3 into a logic high or low into the Arduino. To the upper left is a simple 12VDC (from the PC power supply) to 5VDC power supply, for the ICs and the C-10 breakout board in the lower cabinet. This 5V and GND and the rest of the lines between the Arduino and C-10 board connect to a pin header, shown directly below the Arduino.

CNC mill - main board schematic

On the very far right is where the E-stop and limit switches will connect to an Arduino I/O pin, and a pull-down resistor to keep the pin from floating. The E-stop and limit switches are connected in series and set up in a ‘normally closed’ configuration. This is an added measure of safety as an inadvertently severed wire will indicate a fault, rather than fail to indicate a real problem should one arise. As configured here, a normal condition will read as ‘high’ on the I/O pin.

On the upper right is a series of switches and indicators: MACH OK and INTERFACE OK indicators, INTERFACE RESET and MOTION OVERRIDE buttons (each with their own indicators), and a PC POWER button with power and HD activity LED and a PC RESET button. The latter are not connected to the Arduino at all but go directly to the PC motherboard.

pushbutton The reason the other buttons and LEDs are part of the PCB is that I had a handful of Klockner-Moeller illuminated switches. Except that they are not actual switches and they are not illuminated; rather they are the actuator in a larger assembly that includes switches and lamps. Being real industrial controls, these full assemblies are extremely expensive. Also, I am dealing with signal-level voltages and currents and don’t need anything heavy-duty. So I designed my board to sit just under these switch actuators and provided a couple of small tact switches that are depressed when the big button is pressed. In the middle of each set of switches is two LEDs that will fire up through the middle and illuminate the button.

On the lower right and directly above the Arduino are two headers that connect to the relay board. This is where the AC power terminal block is, and where the relays that switch AC power reside. The first three relays are for switching the main power to the lower cabinet and AC power to two different (future) coolant systems. The other two relays replace the original power switch on the mill (it is a DPDT switch) so the controller box will now have control of the mill’s spindle.

CNC mill - relay board schematic

Since my PC board far exceeds the maximum size that the free version of CadSoft Eagle allows, I designed the Arduino board in two halves and joined them together in Illustrator. The large cutout for the E-stop button provided a nice natural break between the two halves. The upper half was also too big, so I designed it with much less vertical space between buttons and simply stretched the image out later.

CNC mill - PC board artwork

Note: if these images look very slightly skewed to the left, you don’t need to check your eyes. My laser printer warps the transparency film as it’s going through the hot printer, so double-sided PCB artwork doesn’t line up when flipped to face each other. So I printed two copies of a square grid and flipped them face-to-face, then measured the offset so I could compensate for it. Now as a last step before printing transparencies, I skew the entire page in Illustrator horizontally by -.179 degrees, and I end up pretty close every time.

Here’s the relay board, and a small daughter board for the USB connector on the front panel.

CNC mill - PC board artwork

Next step: PCB fabrication!

Comments are closed.