This week I spent some time with my aunt and uncle. My uncle is a mechanical genius and a visit to their property is always enjoyable. This trip was no different, me being led on the obligatory workshop tour as my uncle filled me in on the status of his various car restorations, instrument making projects and machine tool acquisitions.
This trip was a little different, this time I was able to make a contribution to one of his projects. Some time ago he had purchased a Chinese 6040 CNC mill on eBay:
Unfortunately he hadn’t been able to get it going and it had been sitting idle. It had been supplied with Mach3 v2.58 but whilst the software installed ok and the controller powered up, the only thing it would do is power the stepper motors and ‘hold’. No amount of jogging or config change would make it step.
The CNC controller is generic Chinese, the beige one with a sloping front panel, variable frequency drive (VFD) controller, 4 channels (X, Y, Z and A) plus an emergency stop. It connects to the PC via a parallel cable. After taking off the cover I found a TX14175 parallel breakout board (BOB) and four stepper motor drivers, model TX14207. The VFD front panel was marked PRT-E750.
Poking around the PC’s parallel port with a multimeter I was able to measure 3.3 volts on many of the outputs, pins 1-9, with the ground connected to pin 25. According to the mill documentation pin 14 was meant to be an ENABLE signal but clicking the RESET button in mach3 made no difference to the voltage level on the pin.
Software Changes
The PC was running Windows 7 64-bit. According to the Mach3 requirements page this won’t work. It needs to be the 32-bit version so an operating system downgrade was performed and Mach3 v2.58 re-installed. After some minor reconfiguration and testing I was still unable to get Mach3 to toggle the parallel port pins.
At this point I took another look at the Mach3 downloads page. The current version is 3.043, a little more up to date than the version I had disks for. During installation of the latest version I encountered my first bit of luck, the system asked me if I wanted to install a parallel port driver. With the parallel port driver installed and the newer Mach3 configured I was able to get the multimeter needle to move.
Stepper Motor Configuration
The next stage was to connect the parallel cable and power up the controller. I decided to track down the emergency stop input by using the diagnostics screen and the ports and pins config page. A bit of trial and error identified the signal coming in on pin 10. I immediately got a warning about an external condition. Changing the input to active low fixed the problem and I could happily push the E-Stop and see the Emergency indicator light in the diagnostics panel.
I configured the enable pin next. From memory this was on pin 14 and was active low (I am no longer at my uncles place).
Stepper motor config was X (2,3), Y (4,5), Z (6,7) and A (8,9) – (step,dir). Once these were entered I was able to move the machine around. A little fiddling with the motor config and a ruler determined that there were 400 pulses to the mm. The pulse/mm setting is dependent on 3 things, the stepper motor (200 steps/rev), the ball screw (4mm/rev) and the drivers micro step setting (x8).
Other motor settings I played with were the maximum travel rate, 1200mm/min for X and Y, 400mm/min for Z and the max acceleration of 8mm/s^2. This was something I didn’t spend much time experimenting with. It seemed much improved over the default values without missing steps during movement.
NB. All step and dir pins are on port 1.
Spindle Configuration
This is the area that was hardest to nut out. From the information I had to hand there are two signals from the PC that are used to control the spindle. Pin 17 turns a motor relay on and off and pin 1 has a pulse width modulated (PWM) signal used to control the spindle speed.
The breakout board outputs two signals to the VFD. One is a simple digital (on/off) signal that is connected to the VFD Fwd input. This makes the spindle spin clockwise. The second output is an analog control voltage and is used to control the speed. The VFD is capable of spinning the motor in reverse but as supplied the CNC controller had not provided that capability i.e. the Rev input was disconnected.
You can operate the spindle manually using a front panel knob to control the speed. At minimum the display showed 0 and at maximum 400. This is the drive frequency in Hertz so it needs to be multiplied by 60 to get RPM. Maximum speed for my uncles spindle was 24,000RPM.
I found the public forum information on Mach3 spindle configuration to be poor and often misleading. The Mach3 manual gives a better understanding but no examples. You have to read several sections and then synthesise to get the complete picture.
For the TX14175/PRT-E750 combo I found that I needed to specify:
- Motor Outputs – Spindle – step on pin 1, active low (dir is unused)
- Output Signals – Output #1 – pin 17, probably active low
- Spindle Setup – Disable Spindle Relays – unchecked
- Spindle Setup – Clockwise (M3) Output # – 1, probably active low
- Spindle Setup – CCW (M4) Output # – 2 (dummy value)
- Spindle Setup – Use Spindle Motor Output – checked
- Spindle Setup – PWM Control – checked
- Spindle Setup – PWMBase Freq. – 5
- Spindle Setup – Minimum PWM – 0%
- Spindle Pulleys – Pulley # 1 – min 0, max 24000, ratio 1
It is important to bear in mind that Mach3 is processing Gcode to control the CNC hardware. A typical gcode block would be “S1000 M3” to make the spindle spin clockwise at 1000 RPM. Let’s walk through the above settings to determine the effects.
When Mach3 encounters an M3 code it will activate Output #1 (point 4) which is wired to pin 17 (point 2). This will turn the spindle on. It should also effect the VFD freq display – it flashes when off and is solidly lit when on. This is one way to work out the active low/high setting. If it stays solid when M5 is issued you have it the wrong way around i.e. motor on when it should be off.
When Mach3 encounters an M4 code it will deactivate Output #1 and activate Output #2 (point 5). As there is no output signal configured for this output nothing happens. The VFD display should flash.
Spindle speed involves generating an analog voltage from a PWM signal (google it). Mach3 needs to know the min/max spindle speeds which it gets from the pulley setting (point 10), 24,000 RPM. Using the speed from the example above, S1000, the PWM signal needs to be roughly 4% (1000/24000). This is output on pin 1 due to the settings in points 7, 6 and 1.
One thing I found when experimenting with the spindle speed was the effect of getting the active high/low setting for the spindle output wrong. If you find the spindle spinning fast at low values, e.g. S1000, but slow at high values, e.g. S24000, then this needs to be inverted.
Summary
This is by no means a complete configuration for a Chinese 6040 mill controlled by Mach3 but it should get you started.
Go make some chips 😉