Hello Guest it is April 19, 2024, 02:44:36 AM

Author Topic: Mach 3 Spindle control problem  (Read 9509 times)

0 Members and 1 Guest are viewing this topic.

Mach 3 Spindle control problem
« on: February 04, 2014, 10:01:15 AM »
Dear Experts,

I am new to this forum and this is my first posting - so apologies in advance!

I am trying to set up Mach3 together with a Smooth Stepper with BOB interface to control a 3 axis XYZ mill and Spindle motor.  This machine is a Denford Triac Mill with all original electronics except for the old processor board. All is well with the 3 axes, i.e. stepper drive, limit switches, home switches etc. but I am having a problem setting up the Spindle control.

The spindle drive requires 3 input signals.  One is a 0-12V analogue input signal (to set up the RPM) which is derived from a PWM/ integrator circuit.  The second signal is just a digital signal to toggle a single “Spindle Go Relay” (SGR) on or off, and the third is another single digital signal to toggle a “Spindle Reverse Relay” (SRR) to change the rotation direction.

I am using the following setup:

Under “Spindle Setup”, I have set “motor control” to have “Use Spindle Motor output” and “PWM” is checked.  Under “Motor Outputs” I have enabled the Spindle Motor and assigned two output ports on my BOB for the Step and Direction.  The Step pin shows the desired PWM signal.  This is no problem with this -  the spindle motor turns fine and the speed can be controlled either manually or by setting an S1000 (say) command in a G code file.

My problems are with the two relays (SGR) and (SRR).

I have set up the “Direction Port” in the ”Spindle Motor Output” menu to control the SRR (which does toggle correctly with the M3 and M4 commands).  In the “Spindle Setup” menu, under Relay Control, I have assigned both the CW and CCW boxes to OUTPUT#1.  In the “Output Signals “ menu I have assigned OUTPUT#1 to a  physical port and pin on my BOB and this drives the SGR.  The thinking behind this was that when either M3 or M4 were selected within a program, OUTPUT#1 would be true and the SGR would turn ON.  Indeed this is the case and so apparently all was well when I checked all the signals on an oscilloscope.

So now the problem:  I energised the whole system and ran a small test program below which was just to turn on the Spindle in the CW direction and to hold it at a fixed speed:
M03 S3000
M01

The motor ramped up fine and continued to run at constant speed as expected.  I then pressed the screen PROGRAM STOP button to halt the program whereupon there was an almighty screech and bang and my workshop was plunged into darkness.  A few fuse replacements later, when power was restored, I investigated what was going on back with my oscilloscope.  It turns out that when the STOP button is activated the Spindle Reverse Relay momentarily changes state *BEFORE* the STOP relay turns the drive  off.  Thus the motor is instantly switched from forward to reverse while turning at full chat.  This is not pleasant and potentially dangerous.  [ I would liken this to doing an emergency stop in a car by slamming the gear into reverse before disengaging the clutch.

This prompted me to investigate (firstly with my ‘scope and spindle drive disabled) what would happen if the following code was executed to toggle between forward and reverse:
M03 S1000
M04 S1000

I found I could make this happen safely by inserting (say) 4 secs delay in the CW and CCW ramp delay boxes.  However this is really only a cludge, because the REVERSE relay *ALWAYS* operates before the OFF relay (but by then the PWM signal has ramped the speed down to zero so the spindle motor is stationary when the reverse relay operates).  This fix does NOT sort out the STOP Button problem - this happens instantly.

The root cause of the problem is the deliberate delay incorporated into the OUTPUT#1 signal (and further additional delays in all subsequent higher PORT #Numbers) which is built in to the MACH3 software.

So my questions are:-
1)   Do I have the correct setup or is there an alternative configuration which would solve this issue?
2)   Can I route the OFF relay signal to come out through (say) OUTPUT#1 port so that I can use a higher port number (say) OUTPUT#2 for the SRR so that the delays are in the correct sequence (i.e. the OFF relay always operates before the Reverse relay)
3)   Why is the screen STOP Button causing a repeatable momentary glitch in the Direction signal of the motor output signal?  Is this a software BUG?
4)   What do the” PWMBase Freq” and “Minimum PWM” parameters actually do?  It seems that when I modify these, the PWM signal and frequency remain unchanged.

Any help would be gratefully appreciated.

Regards,

Geb

Offline Fastest1

*
  •  920 920
  • Houston, TX
    • View Profile
Re: Mach 3 Spindle control problem
« Reply #1 on: February 04, 2014, 12:11:53 PM »
I could easily be wrong but I would think each direction would require its own output to be used. Does the unchecking of disable spindle relays have any effect?
I want to die in my sleep like my grandfather, not like the passengers in the car! :-)