A while back I obtained a desktop CNC lathe. It was stripped from its electronics, so this was a good opportunity for me to learn how to retrofit a CNC lathe. In this post I will cover this DIY project at a high level. The details for all of the components used and how they are connected can be found in the embedded videos. Also I have included a PDF file in this article, which contains the electrical diagrams, BOM and settings for the CNC controller and VFD. I hope that by sharing this journey it will help people to get an estimate of what takes to do a retrofit on an older CNC machine. This is not an ultimate guide on this type of work, it is just to share what I have learned so far. Let me know if you have any questions in the comments section below or under one of the YouTube videos.
Safety notice: working with mains voltage is dangerous. It can kill you. If you copy anything from this build it is at your own risk. Have your work verified by a licensed electrician before turning the equipment on.
The PDF file below contains the wiring diagram, Bill Of Materials and software parameters. It is free to download.
1 – Introduction, SZGH Controller Dry run, Motor Wiring and VFD Settings
The EMCO lathe that I bought on a local online market place seemed to have all of the mechanical components, but the electrical components were removed and came separately in a box. Since I do not have full user manuals of the mostly proprietary EMCO components, I decided to start fresh and replace all of the components, except the spindle motor and turret board.
To control the lathe I opted for the SZGH 990TDb-2. The reason for choosing this model was the relatively low price and the large feature set. It has all of the Inputs and Outputs that I need, a programmable PLC and good manuals in English. I also considered the Masso G3, which looks like a great option (especially the touch model), but it was quite a bit more expensive.
The SZGH controller looks a bit like a classic Fanuc controller, but in my opinion the SZGH interface is much more intuitive. Although the unit itself was 350 euros when I bought it last year, the total came to around 800 euros with taxes and shipping included. All cables except the one for linear scale feedback are included in the package, which makes connecting it quite easy. I also bought an IO board and spindle encoder separately.
To drive the X and Z axes I purchased 2 closed loop stepper motors. They came as a set and included the stepper driver, which eliminates the need to find a compatible driver yourself. The stepper motors have a closed loop between the motor and the driver, allowing it to correct for any position errors detected by the encoder on the back of the motor. The closed loop does not reach the SZGH controller, but for my application I have no need for that feature. The SZGH controller does have the option to read the position of the axes, but besides the aforementioned missing cable this would also require scales on both axes.
The stepper motors are 3 phase models, which is not intentional, I was just looking for motors that would fit in the enclosure and also have limited power, to prevent the risk of damaging the mechanics with overpowered stepper motors.
Spindle Motor Wiring
The lathe still had the original Spindle Motor mounted in place. It is a 3-phase motor with a rated power of 0,37 kW.
It was already wired in a delta configuration and I am sticking to that setup. The name “Delta” refers to the shape the wiring diagram has when you draw it out on paper. In reality it looks different, due to the way the wire terminals are positioned. See picture below. L1, L2 and L3 are the lines going from the VFD to the AC motor.
The lathe itself runs on 230V / 50 Hz. To convert the single phase input power to a 3-phase connection for the motor a VFD is used. Also, the VFD allows for an infinitely adjustable RPM of the spindle.
Because I was not able to reuse the proprietary spindle drive unit that came with the lathe, I bought a new VFD. To limit my losses in case something went wrong I opted for a cheap model I found on Amazon: the SAKO SKI780-0D75G-1. It is a 0.75kW model and has a maximum outout of 4.0 Amps. It can roughly deliver twice the power needed to drive the motor. From online resources I understood that oversizing the VFD to twice the required power is a common factor to be on the safe side.
In order to reduce electrical noise in the mains line I have placed a 2 stage power line EMI filter between the mains plug and the VFD. This is rated at 20A, which is plenty for this application.
To reduce EMI emitted from the outgoing lines of the VFD, I placed a Ferrite ring between the VFD and the spindle motor. The more formal name used for this specific model is a “Zero Phase Converter”. This noise filter is designed specifically for use with VFDs. It should be placed over the lines as close as possible to the VFD. Each of the 3 wires should be individually looped through the ring 4 times to achieve the maximum filtering effect.
- Motor Control mode
For now, I have made a couple of key changes to the parameters to get started. The motor control is set to default as V/f control, which is the most simple control mode. This works, but makes the motor emit a high pitch noise. I changed this to Sensorless Flux Vector Control, which made a big difference. It sounds much better now. This mode is an efficient method to control a motor and adapts to the motor dynamics without the need for encoder feedback.
- Switching Frequency
This is the switching frequency of the VFD. A higher frequency generates a cleaner waveform, reduces high pitch noise from the motor and increases efficiency. There are however also downsides: It reduces the life of the VFD, generates more heat and increases the EMI, which may affect the functioning of other components in the system. So there is a tradeoff. I am setting this as high as possible to reduce noise, but might have to lower it if I run into issues with EMI.
- Refer to the PDF linked at the start of this article for more changes I made to the VFD settings, including a short explanation. For now these settings work but I will update the document if I make any changes later on.
More details on the Controller, stepper motor connections, VFD and motor wiring is included in Part 1 of the video series on this project. Also make sure to have a look at the wiring diagram in the PDF file.
2 – Panels for the lathe cabinet, Stepper motor replacement and tool modifications
The lathe was missing a back panel and a bottom panel. I ordered aluminum panel to size and mounted them onto the lathe. Rubber feet ware added to the bottom panel.
For both the X and Z axes I designed custom motor mounts. Nuts were pressed into the mount, for mounting the stepper motors. Using nuts is a very easy solution, but care needs to be taken not to overtighten the screws holding the motor. Otherwise the plastic may be permanently deformed.
For the lathe I bought both a set of HSS tools and a set of tool holders with carbide inserts. Since all tools were too long to fit in the turret I shortened then using an angle grinder. The same method was applied to shorten the round tool holders for the boring bars.
More details of the items discussed above are provided in Youtube video part 2:
3 – Tool Turret wiring and programming
In the original configuration of the lathe, the turret was driven by a custom EMCO turret board, containing a relay and power resistors. I have reused this board in the new setup. The relay is used to switch between forwards and backwards rotation. When rotating forwards the turret motor receives 24V. When rotating backwards part of the energy is dissipated by the resistors on the board, which basically act as a voltage divider. Only 10V is across the motor leads when rotating backwards.
A pawl and ratchet mechanism it used to lock the turret in place at each position. Even when the turret has reached a position, the motor is still activated, holding the turret in place.
The turret has an encoder wheel at the back and 2 optical sensors. The first sensor is only triggered at tool position 1, while the second sensor is triggered at each tool position.
Linked below is the “ProgramTool” file, which is the macro for the SZGH controller to drive the turret. A demonstration of how the turret operates with this macro is given in video part 3. In the ProgramTool file itself, I have placed comments behind important lines of code to explain how the macro works. If you have any questions on the macro, please leave a comment below. Note: the file now has a .txt extension. The file extension needs to be removed before copying it to the controller.
More details of the items discussed above are provided in Youtube video part 3:
4 – Polishing the safety door, connecting the E-stop and ladder programming
The lathe has a polycarbonate safety door which was heavily scratched. I applied wet sanding, starting at 1000 grit to remove the deeper scratches and working my way down to 5000 grit to get an almost scratch-free transparent surface.
The cover was finished up with a coarse and fine polishing paste consecutively, to obtain a very smooth transparent surface.
The original external E-stop was faulty and therefore needed to be replaced. It was connected to one of the inputs on the IO board (M14).
In order for the controller to respond to the E-stop on M14, the ladder needed to be modified. This can be done directly on the controller. Alternatively, you can also edit the ladder on the PC with a special editor and then upload the ladder file back into the controller.
Details on the ladder modifications for the E-stop and other items discussed above are discussed in detail in video part 4:
5 – Replacing the spindle bearings, a safety switch and adding a spindle encoder
The bearings on the spindle were worn and were making strange crackling noises, so I decided to replace them. The bearings were replaced with the same type as the original: 6006-2Z deep groove ball bearings. These cannot withstand as much axial force as tapered roller bearings or angular contact bearings, but for light use I hope they will suffice.
I fitted brackets in the back of the lathe onto which I mounted 2 DIN rails, allowing for 2 rows of components to be placed in the back of the lathe.
The safety switch for the door was replaced, as the original switch was behaving unreliably. I used a similar type, in a normally closed configuration. The safety switch for the door will stop a program and the spindle in automatic mode, but it will still allow you to jog the lathe in manual mode for tool setting. The safety switch fitted behind the side door, where the drive belt is housed, will simply trigger an E-stop, as you are not allowed to run the spindle and open the side door in any mode.
To be able to cut threads a spindle encoder is needed. This allows the controller to track the spindle angle and move the slides in a correct manner, such that the thread will have the correct pitch and start at the same angle for each consecutive pass.
All items discussed in above are covered in much more detail in video part 5:
Questions or other feedback is welcome in the comments section below.
CAD files for all custom parts used in this build:
VFD settings and programming: Video by James from Clough42 for more detailed information on VFD programming: https://www.youtube.com/watch?v=RQKPtf7stiw&list=PLDlWKv7KIIr_Znhfg8obxwcduFee5Ub5z&index=2
Article on the most useful VFD settings including background information: https://www.controleng.com/articles/top-5-vfd-parameter-changes-explained/
Information on Sensorless Vector Control: https://resources.system-analysis.cadence.com/blog/msa2021-sensorless-vector-control-of-ac-drives