Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: gyrojeremy on January 12, 2022, 09:32:44 PM

Title: Glitch on X movements
Post by: gyrojeremy on January 12, 2022, 09:32:44 PM
hi All.
I've built a cnc mill out of an old G0484. It's a 3 axis with clearpath servos and an ESS for the motion controller. This is all run from Mach 4 on a windows 10 PC.

I have a random but not so random movement issue occurring and cannot find the source.
What happens is when traveling in X plain, it will rapid move times 10 speed. Let me try to explain.

1. I use Fusion 360 CAM personal use, so the only rapid moves aloud are basically the G53 moves. Therefor no rapid moves should happen during movements from point A to point B, It should all be G1 moves.

2. I have rapid (G0) moves on Mach 4 set to 10%, G53 moves move at 10%. These random X moves (that are meant to be G1 moves) will happen at 100% rapid. If I have rapid on Mach4 set any higher than 10% and these X movements occur, it will trip the current overload on the servos and halt all movements but the gcode will still be running on Mach4.

3. It only does it to X movements. Not Y movement and not XY movements. And has never happened to Z movements ether.

4. This doesn't happen on all X movements. It only happens on transition moves. Sometimes it wont happen at all on a Gcode program. When it does happen, it is the same every time the program is run. I could run two programs back to back (program A and program B), it could miss behave on program A and run fine on program B. I could loop these programs all day and it will always happen on program A and never happen on program B.

It sounds like it's the Gcode right?? I'm only learning to read gcode but I can't see anything obvious. Post processor maybe?? Has anyone ever struck this before?

I've attached the latest program it did it on. Drilling holes in a PCB. It rapid moved fast all X transition moves, even though rapid on Mach4 was set to 10% and there shouldn't be any rapid transition movement to begin with according to Fusion360.


Title: Re: Glitch on X movements
Post by: KatzYaakov on January 14, 2022, 02:45:03 AM
what the size of this random movment? is that happend all long of movment or only at end and begin of segment?
Title: Re: Glitch on X movements
Post by: gyrojeremy on January 14, 2022, 03:45:45 AM
Will be the entirety of the transition move. Length of move makes no difference.
Title: Re: Glitch on X movements
Post by: KatzYaakov on January 14, 2022, 07:45:25 AM
bater add video or photo or sketch  because not so clear what you talk about
Title: Re: Glitch on X movements
Post by: gyrojeremy on January 15, 2022, 02:38:21 AM
Ok here is a video. https://youtu.be/rdZwMy1R7X0 (https://youtu.be/rdZwMy1R7X0)
It's doing it on every X move. Rapid is set to 10%, feed rate should be 150 I think but it looks faster than that. G code is attached.
Title: Re: Glitch on X movements
Post by: joeaverage on January 15, 2022, 04:53:24 PM
Hi,

Quote
I have rapid (G0) moves on Mach 4 set to 10%, G53 moves move at 10%. These random X moves (that are meant to be G1 moves) will happen at 100% rapid. If I have rapid on Mach4 set any higher than 10% and these X movements occur, it will trip the current overload on the servos and halt all movements but the gcode will still be running on Mach4.

That's a fault right there. If a servo, any servo, trips out over current, over voltage, following error or what ever then the machine must stop. The servo will certainly stop...and signal the error.
Your Mach4 installation should be monitoring the HLFB fault signal and Estop ALL servos if any one servo trips out. I take it you do not have any fault monitoring? That's a disaster waiting to happen.

Next issue is why the X axis is tripping out? Is the X axis much heavier than the others? In a servo, current is linearly proportional to torque and torque is linearly proportional to acceleration.
Do you have the X axis acceleration set (in the drive OR Mach) higher than the other axes? Have you set (in the drive) a more restrictive current limit?

Not sure what Fusion has to do with it. I use Fusion but a paid subsricption...I don't like paying much, but you do get what you pay for and 'bang for your buck' Fusion can't be beaten for value
for money in my opinion. I use Fusion to design the circuit and then export the files to EAGLE, because EAGLE has a UserLanguageProgram called PCB_to_Gcode that will generate Gcode files
for isolation routing, drill files and mill files. Note that the drill files have a syntax that works with Mach3, which was a bit slack as to what kind of code it would accept, whereas Mach4 is a bit stricter.
The code needs to be edited slightly to work on a Mach4 machine, and I use to do it by hand, but I have written a macro which takes the original (Mach3 compliant) drill file and make a new file
which is Mach4 compliant.

I will post the macro if you want it.

The point is that EAGLE has no BS restrictions over rapids....ie the Gcode produced by 'pcb-gcode' has NO restrictions

Craig
Title: Re: Glitch on X movements
Post by: gyrojeremy on January 15, 2022, 05:35:45 PM
The servo trips out because of the load it comes under while trying to move at lightning speed. The issue is, it should not be trying to move at those speeds in the first place.
And it doesn't do it on every gcode program. It doesn't do it if I write the program in the mdi.
I do have hlfb for the servos but now that you mention it and due to my lack of knowledge I would guess that Mach4 has no idea what to do with that input. I certainly haven't added any program to trigger E stop from hlfb.
Title: Re: Glitch on X movements
Post by: joeaverage on January 15, 2022, 06:13:47 PM
Hi,

Quote
The servo trips out because of the load it comes under while trying to move at lightning speed. The issue is, it should not be trying to move at those speeds in the first place.

OK, you have some issues there. As I posted earlier current is proportional to torque and that is proportional to acceleration.

I use 750W Delta servos, and this is broadly How I set them up.  I know the rated torque of my servos, its published in the manual.  Additionally I have done a detailed calculation
of the total momentum of each axis, the Y axis being the heaviest I'll start there. My servos can accelerate the Y axis including a reasonable estimate of the weight of the
workpiece, vice and jigs, at 2.7m.s-2. Note this is just rated torque, and therefore rated current. The peak current ( equivalently peak torque) is three times that.
I have tested my machine at that acceleration and it works fine with no overloads but it lurches around something chronic and scares the hell out of me.

What I have done is left the servos programmed that way, namely max acceleration (cont. torque)is at 2500mm.s-2, and the max current at 300% of rated current. So my servos are tuned to
their safe maximum.

In Mach4 however I have detuned them to what I want. For instance I've set the maxium speed of the servos (in the drive) to 5000 rpm rather than their rated max of 3000rpm. This means I can have g0 rapids
of 25m.-1.....but this is scary fast....and so while I can have it I don't really want it. In Machs Motor tuning page I have set the max speed to 12.5m.s-1, it's fast enough.
High acceleration is desirable for good toolpath following, but in turn demands more current in the servos and requires greater dynamic stiffness of your machine....so there is a balance to be struck.
I've settled on (in Machs Motor Tuning page) a max acceleration of 1500mm.s-2.

Note that my Y axis is 115kg of cast iron and I allow a workpiece/vice/jig mass of 35kg for an axis weight of 150kg. It accelerates at 0.15g EASY......and I could have it do much more....but it makes me
sweat just watching it!

The basic idea is to set the servo at its reasonable maximum that does not cause faults and then use Machs Motor Tuning page to select those parameter WITHIN the servos capacity.

Thus if you set Machs max velocity at 12.5 m.s-1 the machine should never exceed 12.5m.s-1 EVEN if the servo drive is programmed to be able to go 25m.s-1.
Likewise I've set Machs max accel to 1500mm.s-2 despite the servos being capable of 2700mm.s-2 at rated current and 7500mm.s-2 at max current.

I have a separate fault signal from each servo, and an on-screen LED, so I can identify which of the servos has faulted. If any one of them faults the machine stops, but I can see which servo it is.
I haven't had a servo trip out in the six months since I finished the machine...they are brilliant.

Craig
Title: Re: Glitch on X movements
Post by: joeaverage on January 15, 2022, 07:31:07 PM
Hi,
 its Sunday morning here so I thought I'd make a couple of PCB's, these are ones that I make reasonably often and so like to have one or two in stock if a customer
enquires.

They are surface mount in the main so there are not a lot of through holes, see pics. The drill file takes 1min8sec to drill the twenty-thirty holes or so. The mill file takes 1min24sec
to mill the outline and the four 4.25mm holes.

The top etch file take 46min to run and the bottom etch file 18min.

I could run them faster....but I'm not in that much of a hurry......after all what else would I do....go to church???

Craig
Title: Re: Glitch on X movements
Post by: KatzYaakov on January 16, 2022, 10:35:21 AM
first about accl deccl , the first improve its to add external resistor this improve a lot but and its long story between me and craig
its about S curve ,its totally game changer ,and because mach not support it you can try the s curve that exist in the servo pack
but you must keep this value same on all axiss that interpolate  and must make the CV more precise
Title: Re: Glitch on X movements
Post by: gyrojeremy on January 16, 2022, 04:17:58 PM
Ok I'm winging this from memory and I'll double check the numbers next chance I have.
I'm using clearpath servos. And they are set up via the clearpath software Auto tune. From memory I think I did de-rate them to about 75% max torque as part of that setup. These servos have a peak torque rating of about 7.75Nm. Can move axis at max 7000mm/s with acceleration at 10000 something's.
Like you say, it's scarry and clunky.

In Mach I limited the max travel speed to 5000mm/s (will have to check on that, may even be 3000mm/s) and acceleration to 1000 something's.
Basically I set it up so I could visibly see the deceleration and acceleration when moving back and forth at max speed. This was also well below the clunkiness of fast acceleration. All Axis are set with the same numbers, X axis being the lightest at maybe 45kg including the 30kg vice.
The Auto tune was run with the vice in place as well.

I like your PCBs. Very tidy.
Will see what I can find out about adding resistors
Title: Re: Glitch on X movements
Post by: joeaverage on January 16, 2022, 05:55:11 PM
Hi,

Quote
first about accl deccl , the first improve its to add external resistor this improve a lot but and its long story between me and craig

Can't with Clearpath servos, there is no place to hook up a braking resistor....I can do so if I want or need with my Delta servos because they have a separate drive
but Clearpaths do not have a separate drive.

As it turns out I only use 60% of the acceleration that my servos could provide, and that's only its rated acceleration, its overload is 500% more than that! Despite my machine weighing over 800kg
it still lurches around, not uncontrollably, but it does move so so winding up the acceleration only makes that worse.

Quote
In Mach I limited the max travel speed to 5000mm/s (will have to check on that, may even be 3000mm/s) and acceleration to 1000 something's.

Did I read that right.....5000mm/s ........or is it supposed to be 5000mm/min?. 5000mm/s is 18km/hr!!!!

Craig
Title: Re: Glitch on X movements
Post by: gyrojeremy on January 16, 2022, 07:08:35 PM
Lol. mm/minute not mm/s
Title: Re: Glitch on X movements
Post by: gyrojeremy on January 18, 2022, 04:56:19 PM
Checked over the numbers this morning and you were right Craig. Turns out I had an extra zero on both max velocity and acceleration on the X axis. giving them a speed of 50000 and acceleration of 10000. Run the same drill hole program and it run sweet.
Title: Re: Glitch on X movements
Post by: gyrojeremy on January 20, 2022, 01:33:16 AM
I've been reading stuff about the HLFB on this thread- https://www.machsupport.com/forum/index.php?topic=37464.20 (https://www.machsupport.com/forum/index.php?topic=37464.20)
I think I have mine wired in series to one input. Will definitely have to take a look at this.
Title: Re: Glitch on X movements
Post by: joeaverage on January 20, 2022, 02:11:23 AM
Hi,
if I'm not mistaken the HLFB output is an opto-transistor. Given that the base is purely optical there is no DC ground reference
so you can indeed wire them in series.

Phototransistors saturate in a broadly similar manner to a regular BJTs but tend to have higher saturation voltages, say 0.8 V or so compared
to 0.2V-0.3V for a small signal BJT. Thus if you had three in series all saturated then the voltage would be 2.4V. If you have a 5V BoB then you are in
no-mans land. If you have a 12V or better still a 24V BoB then 2.4V should still be comfortably below the low level threshold.

What sort of motion controller or BoB are you using? Is there any need to economize on inputs? Do you not have enough spare inputs to have one HLFB per
input?

I use an ESS and I made my own BoB. I elected to have ports 2&3 of the ESS as input dominated, ie pins 2-9 of each port as inputs in addition to
the regular inputs 10,11,12,13, and 15. Port 1 has pins 2-9 as outputs and are used for Step/Dir

Port 1
Outputs 1, 2-9, 14, 16, 17 =12 outputs
Inputs 10, 11, 12, 13, 15 =5 inputs.

Port 2
Outputs 1, 14, 16, 17 =4 outputs
Inputs 2-9, 10, 11, 12, 13, 15 =13 inputs

Port 3
Outputs 1, 14, 16, 17 = 4 outputs
Inputs 2-9, 10, 11, 12, 13, 15 =13 inputs

Total
Outputs =12 + 4 + 4 = 20
Inputs = 5 + 13 + 13 = 31

I have used them this way:

Port 1
10 outputs = Step/Dir for up to 5 servos
1 output = Enable, applied to all installed servos in common
1 output = Reset, applied to all installed servos in common
5 inputs = one alarm per servo

Port 2
10 inputs(
X++, X--, X home,
Y++, Y--, Y home,
Z++, Z--, Z home,
Probe.)
3 inputs (Spare)
3 outputs(
Spindle On/Off
Spindle PWM
Coolant Pump)
1 output(spare)

Port 3
5 inputs(
Incremental/Velocity jog
2 inputs, X/Y/Z axis select
2 inputs MPG A/B inputs)
8 inputs (spare)
4 outputs (spare)

Outputs 15 committed, 5 spare
Inputs  20 committed, 11 spare

So as you can see I have used inputs where I need to without trying to economize at the expense of function, and yet still have a healthy margin
of spare IO.

Craig
Title: Re: Glitch on X movements
Post by: gyrojeremy on January 20, 2022, 03:35:39 AM
They are indeed wired in series. Had no idea what I was doing when I wired all this up and was just following what other people had done. And I'm pretty sure there is no software to support the HLFB anyway. It's currently just an input that does nothing. Once again, at the time had no idea what it was for or meant to do.

I'm running the ESS with a C25 BoB, 5v. I think it would be beneficial to run a 12v or 24v system to mitigate signal interference. I think the clearpath servos support that so would be just a case of upgrading the BoB. I've attached the pin layout. I do have 2 spare inputs which I'll use to change HLFB.

Would you like to share a picture of your BoB? Do you sell them?

Was just online looking at the C52 for the third port expansion. Would cost to get it from the states and add a whole other level of ugly to the control panel. The MB3 looks like a clean option.
Title: Re: Glitch on X movements
Post by: joeaverage on January 20, 2022, 04:38:00 AM
Hi,
Quote
I'm running the ESS with a C25 BoB, 5v. I think it would be beneficial to run a 12v or 24v system to mitigate signal interference.

No, if you choose the impedance levels correctly then the noise performance is IDENTICAL between 5, 12, 24V systems....it all comes down
to Signal-to-Noise Ratio....not voltage level.

My mini-mill which I operated for seven years had a 5V BoB and 5v signaling. My new build mill, in service for about six months now, uses Delta
servos, which use 24V signaling as is common with industrial gear, thus I made my BoB 24V also, excepting the Step/Dir outputs which are
5V differential for higher signal speeds. My choice to use 24V signaling is not about noise performance, its about having a clear and consistent
design throughout supported by a wide range of suitable electronic and electromechanical parts.

I looked at the MB3, its a well thought out design and a quality build and deserves its high reputation. If using the MB3 you are perforce limited
to the design choices CNCRoom have made. When I designed my BoB I could have exactly what I wanted and absolutely nothing I didn't.....no
compromises. My own BoB has been working great....but like all designs it can be improved.

I have found that I can make a better PWM circuit than my existing circuit. When I get around to making the new circuit it will be within 1% of
linear with duty cycle whereas my current circuit is linear within  7.5%.

About a fortnight ago I discovered that the circuit (2 dual channel OP-amps per axis) I used for generating the differential Step/Dir signals
while fine with my Delta servos is just a little to noisy for Step/Dir of my Allen Bradley servo used for my heavy duty spindle motor.
I have redesigned the BoB so that the differential Step/Dir signals are generated by a new generation line driver IC.....with considerably better
characteristics than my previous home-brew attempt. The ICs are $11.00NZD each, I require three of them, which is a little more than I like
paying for analogue ICs, but they look the part. I ordered them 10 days ago and they turned up yesterday from the UK, freight free.

My mill is working perfectly well with my existing BoB....so I'm in no great hurry to build another....but will get around to it in the next few weeks.
I want to be able to use my Allen Bradley servo spindle motor in Step/Dir position mode so that I can use it for rigid tapping. I've used it for rigid tapping
on my mini-mill a dozen or so times over the previous two years since I built the spindle. I have only just started to make the changes necessary
to have the same functionality with my new mill which lead to the discovery of the noise shortcoming of my first BoB design.

Quote
Would you like to share a picture of your BoB? Do you sell them?

I'll take some photos of them, they are split into two boards. Given that I have design improvements to make to both of them...no I haven't sold any,
but may do. They are hand-made and hand soldered which makes them a labor of love rather than a profit making exercise. I could post
the design files if you wish to make your own, although it might pay to wait until I have the GenII boards made, tested and in service before
copying what I have done!.

Quote
Would cost to get it from the states and add a whole other level of ugly to the control panel.

My ESS, BoBs and power supplies are screwed  to a plastic chopping board, they are about the right size and cheap source of plastic. So when I say
that my control system is 'breadboarded'....I bloody well mean it. I have another breadboard that has the single board PC and its power supply,
yet another breadboard that has the three Delta servo drives, the AC distribution buses and  EMI filter and yet another breadboard for the VFD and
Allen Bradley servo drive for both spindles. You might laugh, and to be fair its pretty untidy......but better than my mini mill. When I built that
I just nailed the various boards and things to a piece of MDF, promising to go back and do it properly later. Seven years later and its still the same. There
is nothing more permanent than a temporary solution.

Craig
Title: Re: Glitch on X movements
Post by: gyrojeremy on January 20, 2022, 02:26:31 PM
I have to be honest, most electronics, circuitry is well beyond my current level. I dabble in it when the project requires it but it's all very much trial and error and smoke.

My mill is working ok as is but I'm not sure I'll ever be content with it. There is always things I'd like to improve on. The spindle is one of them. It's only a matter of time before the retro fit bearings give up and I wont be replacing them, it will be a whole new spindle design. I'd love to machine up a new spindle cartridge but I'm afraid my little lathe is just not up to the task.
Spindle motor and drive are on that list as well so will need the ESS third port at that point for the encoder on the spindle. Rigid tapping would be a nice option to have.
Title: Re: Glitch on X movements
Post by: joeaverage on January 20, 2022, 04:50:30 PM
Hi,

Quote
I'd love to machine up a new spindle cartridge but I'm afraid my little lathe is just not up to the task.

You might surprise yourself too.

I have a 750W 24000 rpm asynchronous spindle, and I use it extensively and have done so for seven years. It spins too fast with way to little torque to be
a serious contender in steel and stainless......so I made my own spindle. I was lucky enough to find here in New Zealand a second hand 1.8kW Allen Bradley AC servo
and drive for $900NZD including shipping ($650USD). I still had to buy and/or make the cables, another $250NZD and buy the setup and tuning software for another $200NZD.
I still had a good torque dense motor for a spindle at reasonable price.

Like you I thought I would be unable to make a creditable spindle housing, my machining skills just aren't up to that standard. The problem was however that the cost
of a precision spindle or getting one made was just beyond my means. By this time I had already bought a 'You Beauty' Rego-Fix cyclindrical tool holder ($450NZD) and
a set of P4 matched angular contact bearings, seals from the UK,....so I had all these parts on hand and yet could not use them. In the end I decided 'to hell with it' I'll make
my own and see how it goes....and thats what I did. The design was very straight forward as I needed to consider very carefully how I was going to do it to maximise
my chance of success WITHOUT sending it out for cylindrical grinding....and costing a fortune. While my attempt was far from perfect it works a treat. I don't have the bearings
as well aligned as I would like and they run hotter than I would expect so instead of getting thousands of hours use I suspect I'll get hundreds....but still I'm very happy with
my effort. Most importantly I have been able to utilise all the parts I invested in and have got the functionality that I wanted. I've had about 200 hours use with it, my highspeed
spindle has seen thousands in the same time but when I need low speed-high torque, I NEED it.

Craig
Title: Re: Glitch on X movements
Post by: joeaverage on January 21, 2022, 05:21:08 PM
Hi,
have attached a couple of pics of my two BoBs.

I will eventually get around to making both these boards anew. The IO board will have a minor modification to do with the PWM output circuit.
The Servo board will have the dual OpAmp's replaced with a dedicated line driver IC (AEIC-7272-S16).

Otherwise the board layout will stay the same, namely two boards 60mm x 180mm.

I am giving some consideration to making one single board which would allow the ESS to sit atop the BOB in a similar manner to the MB3.

Craig