Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Machtank on March 26, 2020, 02:56:27 AM

Title: Screwcutting issue under Mach4
Post by: Machtank on March 26, 2020, 02:56:27 AM
Gday all. I have an issue with mach4 when screwcutting, both G76 and G32 are effected.
The spindle speed constantly varies as each cut progresses. Starts out slow around 75 rpm, rises to 400 rpm at the end of each cut. the command speed being 400 rpm. The Z feed is increasing to compensate, but cuts an interesting Thread. The effect is very like CSS as the Diameter increases, except its the Z axis.

Only happens in screwcutting and the correct G97 is specified.

I am using an ESS, but I cannot find any issues in the Configuration.

Hoping someone can help. I took a video of this that I could include if it helps.
Title: Re: Screwcutting issue under Mach4
Post by: Graham Waterworth on March 26, 2020, 08:33:30 PM
Is your spindle override set above 100%
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on March 26, 2020, 11:33:07 PM
Thank you for the response. All overrides are set to 100%.
Since the first post, I have setup a new (Very Standard Mach4 Lathe profile) with no effect.
Tried everything I can think of. Checked the config of both the ESS and Control.

Screwcutting works fine under Mach3 on this computer with the ESS, so something of a mystery to me.

Title: Re: Screwcutting issue under Mach4
Post by: Graham Waterworth on March 27, 2020, 12:06:10 PM
Have you got Feed Per Rev set (G95)
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on March 27, 2020, 08:05:32 PM
Feed per rev is G99 under Mach4 and is set.

This is a link to a YouTube video of the issue https://youtu.be/YqWxuqiohYk

The Gcode is correct to the manual, and also the built in screwcutting wizard as listed below.

N0 (Machine type - MachMotion Lathe Canned Cycles)
N5 (Filename: C:\Mach4Hobby\GcodeFiles\fffg.tap)
N10 (Generated on 03/27/20 at 13:38:32)
N15 G00 G40 G54 G64 G80 G90.1 G99 G18 G21 (Safe Start Block)
N20 %


N25 %
N30 (Starting Gcode for Threading Cycle: ThreadingCycle-0)
N40 G00 G40 G54 G64 G80 G90.1 G99 G18 G21 (Safe Start Block)
N45 %


N50 %
N55 T0101 (Tool Change)
N60 G99 (Feed per Revolution)
N65 G97 S400 (Constant Speed)
N70 M03 (Spindle Forward)
N75 M09
N80 G00 X14.00 Z5.00  (Rapid move to Clearance Height)
N85 G76 P020560 Q0.05 R0.3 K1
N90 G76 X9.72 Z-20.0 R0.0 P1.14 Q0.3 F1.5
N95 G80
N100 (End Gcode for Threading Cycle: ThreadingCycle-0)

N105 %
N110 M09
N115 M05
N120 M30
N125 %
N130 (End Gcode file)
N135 %
Title: Re: Screwcutting issue under Mach4
Post by: Graham Waterworth on March 27, 2020, 09:43:54 PM
Its as if you have X & Z the wrong way round and G96 commanded.
Title: Re: Screwcutting issue under Mach4
Post by: Brian Barker on March 27, 2020, 09:45:43 PM
Hello,
Could you tell me what type of spindle you have? For example is it step and direction?
Even better can you share your profile? Under help you can package your profile.
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on March 28, 2020, 12:20:42 AM
Will add attachments 1 by 1 in a minute as I get errors (.log not allowed, Filename already exists ETC)

I have attached the Profile + I've been playing with the diagnostics, ESS1.txt (formally .Log) makes interesting reading.

ESS Build 253 and Mach4 4.2.0.4300 (All the latest I think)

Spindle is Step/Dir control (Via C11 Bob built in 0 - 10 volt output).
this works very well in all circumstances other than screwcutting, and CSS works well.
Spindle doubles as Axis "C" but even before this addition, this problem existed.
Spindle pulse is 1 pulse per rev as per Mach3 (C3 optical sensor board). No other encoder.

Looking at the diagnostic file, it looks a bit like Warp9 might have an issue.
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on March 28, 2020, 12:21:42 AM
Attachment 1 the Diagnostics
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on March 28, 2020, 12:22:58 AM
Attachment 2 the Profile (Renamed)
Title: Re: Screwcutting issue under Mach4
Post by: Brian Barker on March 28, 2020, 08:02:45 AM
Can you please change your configuration to PWM for the analog output? That may fix you up. I am on my phone now and if it works I will tell you why it is doing it .
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on March 28, 2020, 09:24:13 PM
Brian - thank you for your help.
My speed control board (Built in to C11 Bob) only allows for Step pulses. Having said that, I did try resetting to PWM. The result was as expected, I got 3 speeds (dead slow, Mid range and flat out), so no change from parallel port operation. I did try screwcutting, and got a stable mid range speed, but not very useful.
On the same unit tried Mach3/ESS. Worked perfectly. Good speed control, and perfect Screwcutting.

Unless this can be fixed (I hope so, as I like Mach4 / ESS) I do have a couple of options.
Bearing in mind there are 4 machines (2 on USS), and all using the same spindle control.
1) Use a separate Speed control board.
2) Stay with Mach3. (At least I can use up my Current USS boards). Buying ESS as Parallel ports fall over.

Option 1 could be attractive if I can find one that doesn't want to take over everything. (Just PMW in - Voltage out)

Still hoping for a fix however.
Title: Re: Screwcutting issue under Mach4
Post by: joeaverage on March 28, 2020, 09:32:17 PM
Hi,

Quote
My speed control board (Built in to C11 Bob) only allows for Step pulses.

I didn't think the C11 had a PWM to analogue circuit built in.

If I'm correct then a low duty cycle PWM signal would result in an effective low output, ie dead slow
and a high duty cycle PWM signal would result in a high level output, ie flat out and any
intermediate duty cycle would result in an intermediate speed but could not be called controlled.

Can you control spindle speed from MDI? From what you've described I would guess not.

Craig
Title: Re: Screwcutting issue under Mach4
Post by: joeaverage on March 28, 2020, 09:35:34 PM
Hi,
my apologies I was confusing BoBs, the C11 manual clearly shows a PWM to analogue output.
Please disregard my previous post.

Although I'm still interested can you control the speed from MDI?

Craig
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on March 28, 2020, 09:55:10 PM
Craig Thank you for your comments. Yes, the C11 board manual does say PWM - Voltage, but further down, describes how to setup as Step/Dir. I have never got PWM to work with this board's 0 - 10 volt output (Wish I could).
No speed control at all Direct on screen, MDI, or in program. Only Slow, Mid, Fast not speed control at all.

Just found a PWM to Voltage control board on Ebay - Simple, small, Cheap (AUD15.40). Will give this a try, cannot loose.
Title: Re: Screwcutting issue under Mach4
Post by: joeaverage on March 28, 2020, 11:49:08 PM
Hi,
threading requires a stable spindle speed, the more stable the more accurate the pitch of the result.

The key word here is 'stable', is does not have to be accurate. For instance you might dial up 500 rpm
or so, but whatever non-linearaities results in a speed of 400rpm. Mach will read the actual speed, whatever it is
and then calculate the Z axis progression rate to make the thread. It does not matter to Mach particularly that
the speed is 500 OR 400, so long as it stays the same throughout the operation.

In truth Mach does try to recalculate the Z axis progression on the fly in order to get the right pitch despite spindle
speed variation, however the best result is till had when the spindle speed is constant.

You may be interested to know that Warp9's ESS has a fairly new (six months or so) feature of PID spindle control.
The spindle is fitted with an encoder of some kind, including an index signal, and the PWM output of the ESS is
adjusted under PID control to vary the analogue output with a view to control spindle speed in closed loop fashion.
This is a boon if your spindle is marginally powered or has very little inertia. It must be said that the closed loop
bandwidth is not high, certainly not as high as a position loop servo, but sufficent for an improved spindle speed control
for threading.

If you cannot control the spindle speed in a program or an MDI then threading is a joke. You must solve this lack of
spindle speed control. A PWM to analogue circuit can be made with a resistor and a capacitor (5 cents each) at the simplest,
and with an op amp and a handful of resistors an capacitors (less than $5.00) if you want something a bit flash.

Do you have or have access to an oscilloscope? If you do probe the PWM output of the ESS and see whats happening.
I'm suspicious that the BoB is not set up quite correctly.....everyone else has got PWM to work....why not you?

Craig
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on March 29, 2020, 12:11:21 AM
Craig
My spindle control works perfectly in Mach3 and Mach4 for everything except Threading under Mach4.
My spindle motor has plenty of power, and in normal turning, spindle speed does not vary at all from no cut to heavy cut.

The issue here is that I need Step/direction control to operate the C11's voltage output, and there is seemingly an issue with ESS/Mach4 when spindle control is not based on PWM. If you do know how to set a C11 board to Control the output voltage based on a PWM signal, Please let me know.

I cannot think why it is an issue, all I expect of the spindle speed control is to stay where I set it, without the ESS/Mach4 virtually shutting off the spindle at the start of the cut. It just needs to match the feed to the indicated speed. Further up this post is a link to a YouTube Video that shows what is happening very well.
Title: Re: Screwcutting issue under Mach4
Post by: joeaverage on March 29, 2020, 02:45:26 AM
Hi,

Quote
The issue here is that I need Step/direction control to operate the C11's voltage output, and there is seemingly an issue with ESS/Mach4 when spindle control is not based on PWM.

Natively Mach4 and the ESS are for PWM. But it sounds like your C11 has a frequency to voltage conveter in it rather
than a PWM to analogue.

One alternative is to get a BoB that has a normal PWM to analogue circuit in it, the C25 ($29.55) for instance.

The other alternative is to use step/direction control....Mach4 can certainly produce a step/dir signal pair for a spindle.
See attached.All that would be required would be to ensure that the step output of the ESS be assigned to the
(spindle) step input of the C11.

Craig
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on March 29, 2020, 04:15:59 AM
Craig. yes back where this post started.
I have a problem with Mach4/ESS/Step/Dir Spindle Control ONLY when screwcutting.
All Other functions good. Mach3, same hardware good.
Title: Re: Screwcutting issue under Mach4
Post by: joeaverage on March 29, 2020, 04:52:40 AM
Hi,
have you tried the setting I posted?

Have you considered an regular PWM to analogue board?

Craig
Title: Re: Screwcutting issue under Mach4
Post by: joeaverage on March 29, 2020, 04:55:16 AM
Hi,

Quote
All Other functions good. Mach3, same hardware good.

I thought you said that you could not control the speed, how then can you say all other functions are good?

Craig
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on March 29, 2020, 05:09:23 AM
Never said I cannot control the speed. ONLY in Screwcutting where something other than I is in control of the spindle speed (and stuffing it up)
Title: Re: Screwcutting issue under Mach4
Post by: Brian Barker on March 29, 2020, 07:32:12 AM
I will send a message to Greg and Andy, they may be able to make it work.

If you want to have some fun make an RC circuit and convert the PWM into a voltage. This is how we did it back in the day :)

What do you have for a spindle drive? Can you simply talk to the VFD over modbus? I don’t use analog very often anymore. Why wire when you can talk to the device :).

Sending a message now to the ESS guys
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on March 29, 2020, 08:44:29 AM
Brian
That's good of you. Thank you, it will be a big help if we can get this to work as is. Primarily this is my development machine for Ezilathe, and I do need to get back to mach3 periodically, just to check I haven't stuffed it up, so less hardware changes the better.
Managed to get a simple PWM - voltage board on ebay, cheaper than buying the components here, not much of a change to the hardware if required.

My spindle drive is a Chinese AC servo motor (very good, inexpensive, using them a lot these days) but no Modbus in mine (Option only). This gives me the capacity to use spindle as a Drive "C". Very handy.
The mention of RS-232 these days brings back too many memories of days spent fiddling with cables and protocols on old PLC's. Probably will consider Modbus, but not yet.
Title: Re: Screwcutting issue under Mach4
Post by: Brian Barker on March 31, 2020, 08:44:42 AM
Had a conversation with Greg and he told me that he fixed an issue in the ESS firmware that may sort your issue. Please get the latest plugin from them and test. This is what he told me he fixed:
 "The fix allowed a specific motor to continue at the last commanded velocity while it waited, and then the spindle would continue spinning."
I think you may be in luck! This was done 3-4 months ago

Thanks
Brian
Title: Re: Screwcutting issue under Mach4
Post by: thosj on March 31, 2020, 11:16:57 AM
OP has the latest version of the ESS plugin, v253, which IS about 4 months old, so that's likely not going to fix him up.
Title: Re: Screwcutting issue under Mach4
Post by: jose luis on March 31, 2020, 04:28:08 PM
hello, how have you configured the encoder ?. I also have a problem with threading. But in my case the tool is positioned and does not advance as you do. So I ask you if you have done any special settings or something. Might you help me? thanks
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on March 31, 2020, 09:22:06 PM
Brian. Thank you, but already have the latest ESS Build 253. On the warp9 forum, an issue with OB spindles (sounds like the one you mention as fixed above). Hasn't fixed my problem. Will try PWM to Voltage board when it comes (Will post result). Also looking forward to ESS build 254 (Coming soon !). Just downloaded Mach4 4.0.0.4446 as beta, will sit on that, as problem seems to be ESS.

Jose Luis. I have a Mach3 style single pulse per rev index pulse in Mach4. However it does need to be configured in both the Mach4 Control and ESS Plugin. In Mach4 Go to Control Config / Input signals tab and find "INDEX" (Well down the list, near Estop). In ESS Plugin, go to input signals and find "SPINDLE INDEX (RPM INPUT)".

Hope that helps.
Title: Re: Screwcutting issue under Mach4
Post by: jose luis on April 01, 2020, 09:41:53 AM
Hello machtank, thank you very much for answering. From what you give me about the configuration, are you using the csmio ip controller?
Can you send me a photo of that configuration you have? If it is not too much trouble?
I have the index active.
From what I have seen you do not use the same controller that I am using, and it does not let me activate that function that you describe to me.
I insist again thank you very much, let's see together we can put this into action. thanks.
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on April 12, 2020, 02:12:58 AM
Now Using Mach4 4.2.0.4469 / ESS V256.
Using OB Spindle, still not working but different (Possibly setting of motor) Motor running at set speed to start of screwcutting, then Speeds up a bit, with a definite fluctuation, before settling down to a stable speed. Conclusion - Someone (Warp9 or Artsoft) is still Stuffing around with the set speed.

Thank you Brian for suggesting PWM spindle control, Got the PWM-Voltage board and set it up today on the lathe.
PERFECT… No fluctuation in speed at all. Just what I needed for screwcutting. Will cut some threads in a day or so, but (hopefully) nothing can go wrong now.
Title: Re: Screwcutting issue under Mach4
Post by: joeaverage on April 12, 2020, 03:51:25 AM
Hi,

Quote
Motor running at set speed to start of screwcutting, then Speeds up a bit, with a definite fluctuation, before settling down to a stable speed. Conclusion - Someone (Warp9 or Artsoft) is still Stuffing around with the set speed.

No, thats spindle PID.....you have to tune it, it sounds like its fairly close but PID tuning is the name of the game.

Craig
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on April 13, 2020, 01:20:31 AM
No. Spindle PID not the issue. Available, but not required in PWM (Used trimpot on module to give good speed control for all functions).
PID not available in OB Spindle (Not in this setup anyway).
There is an issue in the OB spindle Configuration, that only occurs when screwcutting, Perfect for all other functions.
No amount of PID adjustment will fix this.
Title: Re: Screwcutting issue under Mach4
Post by: joeaverage on April 13, 2020, 03:10:13 AM
Hi,
spindle PID is a function of the ESS not Mach.

Craig
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on April 13, 2020, 03:38:06 AM
Yes, I noticed, but still no value here.
Title: Re: Screwcutting issue under Mach4
Post by: joeaverage on April 13, 2020, 05:04:01 AM
Hi,
no value? It was created and implemented by Warp9 especially to deal with the need to maintain tightly controlled spindle
speed while threading....no value??

Craig
Title: Re: Screwcutting issue under Mach4
Post by: Machtank on May 15, 2020, 11:02:00 PM
Threading has been working well for a while now (Plenty of variety of threads produced), so the PWM board change was the total solution.

Having said that, Constant volume cutting is a little bit strange. First cut fine, but others way deeper than expected.
Expecting 10 cuts, I get 5 (First cut OK at 1/10 of total volume). I do not think I have missed anything. Mach3 Does this type of cut correctly.
Mach4 - Constant depth cutting is Working fine.
Constant volume is my preferred option, so currently using G32.