Upgrading a CNC milling machine part 3Follow article
Adding a spindle interface board, configuring software control and testing.
In parts 1 and 2 of this series we retrofitted a Denford Novamill with new Gecko 201x stepper motor drivers and a BeagleBone Black (BBB) with Probotix cape (PBX-BB) for control. Existing parts like the stepper motors, home switches and emergency stop button were connected up, Machinekit (a fork of LinuxCNC) installed on the BBB and configured to move the 3 axes.
In this post we will connect up a new board to interface the BBB to the existing spindle motor drive board, then configure it in Machinekit before finally engraving some material.
Note that CNC machine control cabinets often have dangerous voltages present, so care must be taken when working on them.
The Novamill spindle is driven by a DC motor under the control of a Sprint 400 drive board. This takes a relay input to control motor on/off and 0-10v to control spindle speed. Originally this was handled by the same board that drove the stepper motors, that was removed in part 1 of this series.
The Spindle V5 board
On the PBX-BB we have a spare set of stepper outputs, labelled 'A axis'. This can be mapped in Machinekit to control the spindle rather than a fourth axis.
The Spindle V5 board was selected to provide the interface between the PBX-BB and the Sprint 400, as it converts stepper pulses into 0-10v for spindle control and has a relay to control start/stop. Since the particular variant of the Sprint 400 we have is not isolated and floats at mains potential, it is extremely important that this is isolated from the PBX-BB. The Spindle V5 uses opto-isolators to provide this.
Fitting the Spindle V5
Conveniently there was room inside the existing cabinet to mount the Spindle V5. A mounting plate was made and the assembly fitted to the DIN rail along with a new fuse holder. Referring to the wiring diagrams and tracing wires within the cabinet itself allowed for planning of the new connections needed. New diagrams were sketched out before any changes were made so that wires could be checked off as they were added or removed.
Throughout the project crimp ferrules have been used to maintain tidy connections between different boards and modules – these are quick and easy to use, giving great results. Wires were also labelled with wire markers to facilitate documentation and later reference.
Once the wiring was complete it was double-checked before the cabinet was powered up to confirm that the Spindle V5 power LED illuminated as expected.
In part 2 we referred to the .hal and .ini config files. In simplified terms, the .hal file defines the hardware and configures the 'wiring' between software and hardware inputs/outputs; whilst the .ini file determines various parameters loaded by Machinekit such as axis scaling, acceleration and soft limits. Together the two files provide Machinekit with the information needed to control specific hardware and allow a high degree of configuration.
For example, looking at the [PRU_CONF] section at the top of the .ini file, we can see the PRU being defined:
We can also see the number of stepgens – software step generation by the PRU – defined as 4. We defined the first 3 stepgens (0, 1 and 2) in the last post to control axes X, Y and Z. We can now use the 4th (stepgen 03) to control the spindle motor. The screenshot above shows a section of the .hal file that configures this. Two of these lines configure which hardware pins will be used for step and direction output:
setp hpg.stepgen.03.steppin 52
setp hpg.stepgen.03.dirpin 147
In modifying these files reference to in-depth information on the HAL (Hardware Abstraction Layer) helped. As with our last post we also sought assistance on the Machinekit Google Group and used the pinmux.ods spreadsheet to ascertain pin numbers.
Once the spindle could be controlled from the software a tachometer was used to determine spindle speed and ensure that the scaling was correct. This was sensible – as with any machine of unknown history – to independently verify that it is working within recommended limits, in this case a maximum spindle speed of 5000 rpm.
Using the machine
To protect the bed of the machine a sacrificial MDF one was made and affixed. Whilst not needed for our first engraving job, it will be useful for when we need to mill down to the bottom of a workpiece.
A suitable toolpath was generated from a design file and loaded into Machinekit. With a small engraving bit in the tool holder and loaded into the spindle and a piece of engraving laminate on the bed of the machine, the axes were homed and the engraving bit 'touched off' to the laminate.
Our Denford Novamill is now working again, with the new Geckodrive stepper drivers giving fine microstepping and motors that run cooler than with the old drivers. The combination of the BBB with it's PRU and Machinekit give us a compact solution with excellent real-time software step generation, that allows a high degree of user configuration.
Our latest configuration files can be found here – note that they are specific to our setup, and will need editing for use with different machines.
To recap, below is a list of the main parts used in our conversion:
Please note that the parts required for conversion will vary from machine to machine.