Improving safety and implementing basic motion control with a BeagleBone Black
Upgrading CNC machines can be a cost effective way of equipping your workshop with serviceable and easily maintained tools, with a reduced initial financial outlay. Understanding how your machine works and perhaps more importantly, being able to repair and improve it's capabilities, is also highly rewarding.
In a previous series of posts, we covered the upgrade of a desktop CNC milling machine, including the conversion to Machinekit (a fork of LinuxCNC) control, running on a relatively cheap and rather compact computer, the BeagleBone Black (BBB).
Following this successful project we decided to take undertake the conversion of a CNC plasma cutter. This machine is floor standing and will cut mild steel sheet without any trouble at all.
In this first post we will review the problems with the machine as we received it, before taking a look at the rewiring the control cabinet, fitting a BBB running Machinekit and getting the X and Y axes moving under this new control.
High voltage warning symbol from Wikipedia
Disclaimer: Plasma cutting torches use lethal voltages. This post and others on this project will describe aspects of our conversion. This is not intended as a comprehensive guide or how-to. Each machine and working environment is different and it is your responsibility to ensure that any modifications you make to a machine meet appropriate safety standards.
Upon taking delivery, first impressions of the plasma cutter didn't seem too bad. It was affordable and looked to be built around a CNC router table – therefore the X/Y axes are fairly heavy duty – with the routing head replaced with a plasma torch.
Controlling the machine involved copying a design file onto a USB stick, inserting it into the controller pendant and using this to home the machine and run jobs. This was long-winded and a rather sub-optimal workflow, particularly as the pendant only accepted certain USB sticks formatted in a particular way.
The original plasma unit proved fairly problematic and was soon replaced with a Hypertherm Powermax 45. This was far more reliable but did not interface correctly with the automatic torch height controller, resulting in a variable quality cut.
Further investigation into this torch height controller and the control cabinet electronics soon revealed some problems that needed remedying. Unlike the Denford CNC milling machine from our previous series of posts – that has a host of wiring diagrams and documentation available from the manufacturer – there was no documentation, minimal wire marking and redundant components within the control cabinet, adding to the confusion.
It was not clear how the system worked, making fixing problems difficult.
The decision was made to address the chaos and bring some clarity to the control cabinet. In doing so, we would remove any doubt of the workings of the machine, moving towards a more satisfying workflow and a higher degree of configuration and control with Machinekit.
The first job was to document the existing wiring, both visually with plenty of photographs as well as by using a multimeter to trace the routing and connections. It quickly became apparent that corners had been cut. For example, with multiple wires soldered together, covered with heat shrink and tucked into the trunking.
All wiring and connections were noted down in a spreadsheet for future reference. A second spreadsheet was also readied, to be filled out as the cabinet was rewired. This is an important part of a project as it can save a great deal of time further down the line, avoiding the need for re-checking things as they are removed, disconnected or forgotten.
The top of the control cabinet featured two latching switches that looked as though they could illuminate but in fact did not, and an emergency stop (ESTOP) switch that was not correctly secured and therefore difficult to operate.
Two intake fans for cooling were mounted on the side of the cabinet, but without any filters. This would allow for dust, swarf and other workshop detritus to be sucked into the cabinet – not ideal when you have high voltages and power present!
All of the above issues and more were noted down and a bill of materials (BOM) was compiled.
With everything documented and photographed, the bulk of the control cabinet contents were removed. New parts to be fitted included:
- BeagleBone Black
- Pushbutton switches
- LED units for pushbutton switches
- ESTOP switch
- Panel mount USB connector
- Panel mount HDMI connector
- Panel mount Ethernet connector
- 120mm fan filters
Note that this is not a comprehensive list and just shows some of the new parts ordered.
Before fitting these new components some preparation of the cabinet was required. A blanking plate was made to cover the hole for the wire from the pendant to the original controller interface. Some existing components such as the 240v filter were relocated to make space for DIN rail, upon which new components could be mounted.
The cabinet sides were also measured and positions for new connectors marked out before holes cut. Drilling and hole cutting was done as early as possible to reduce the chance of swarf causing problems with the new control electronics. With the hole cutting complete, the cabinet was thoroughly cleaned to minimise risk of any problems due to remaining swarf.
USB and HDMI sockets were mounted towards the top of the cabinet to allow for interconnection of peripherals and the BBB. An Ethernet socket was also mounted closer to the bottom of the cabinet, to keep the network cable out of the way.
The power and ESTOP switches at the top of the cabinet were replaced with higher quality units that were properly secured in place.
An off-the-shelf Ohmic sensor module was installed. This is connected to a tab on the plasma head and provides a way of 'touching off' by measuring the resistance between the head and the workpiece. Configuration of this will be covered in a future post.
With plenty of space on existing and new DIN rails, terminal blocks were installed, allowing the original soldered bundles of cables to be replaced with a safer and more maintainable solution.
Each new wire was labelled with wire markers and noted down in the new wiring spreadsheet. Depending upon requirements, ferrules or other crimp connectors were added to the ends of all new wires to ensure reliable electrical connection throughout.
Fuses were also added to the low voltage power supplies to reduce potential damage caused by a fault somewhere within the cabinet.
BeagleBone Black control
The BBB has sensitive inputs and outputs and therefore requires a separate board to interface it with the other cabinet electronics. Since the Probotix PBX-BB worked well for our previous milling machine conversion, it was also selected for this project. This protects the BBB from potentially damaging noise and spikes, as well as breaking out the connections with screw terminals. More information can be found on the Probotix wiki.
The plasma cutting machine currently has a DC motor to control the height of the plasma head. To interface the PBX-BB with this motor, a simple H-bridge breakout board was used. This could have otherwise been made up on vero board using a H-bridge IC and several other components.
To control the plasma on/off – equivalent to spindle on/off – something was required to interface the PBX-BB and Hypertherm plasma unit, which requires dry contacts to be closed to turn the arc on. For simplicity, an existing opto-isolated relay board was used to interface the two.
These boards were all mounted on an acrylic plate, added to the cabinet and wired up as required.
Two homing switches are used on the table, for X and Y axes respectively. These are hall effect modules that require 24V supply and sink up to 50mA when activated. These were connected to relays, which in turn are wired to the PBX-BB inputs. See the illustration below for a simplified control signal diagram, including this homing switch solution.
With the wiring completed it was visually inspected with reference to the new spreadsheet, before each connection traced with a multimeter.
The BBB was not fitted during the initial power-on tests, in case of any remaining wiring errors. Following a successful test it was then fitted and a monitor, keyboard and mouse connected in preparation for the first boot.
The BeagleBone Black. Photo by Gareth Halfacree
For convenience and stability, the latest Machinekit image was downloaded from here and written to a micro SD card. For the adventurous, Machinekit can be built from source and is an active project with regular contributions.
Machinekit is highly configurable, facilitated by the use of the HAL (Hardware Abstraction Layer). Put simply, this allows for re-configuring of hardware inputs and outputs, together with machine parameters through the editing of a text file. A detailed guide to the HAL is available here.
Note the # characters used to comment out each line
To test the basic functionality of our new control system, the .hal and .ini files used for the CNC milling machine were copied and edited to suit the plasma cutting machine. The focus for this first test was to simply get the X and Y axes moving, so most of the lines were commented out to keep things simple.
Moving on up
With our configuration files loaded onto the BBB, the system was booted and Machinekit started. Fortuitously, control of the X and Y axes could be moved as expected. We had a working motion system.
With the X and Y axes moving a plan could be drawn up for the next set of actions. In the following post we fine tune axis movement, before configuring homing, basic torch height setting and plasma control from within Machinekit.