Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: boydage on August 09, 2024, 03:24:35 AM

Title: How does Mach 4 Store Offsets?
Post by: boydage on August 09, 2024, 03:24:35 AM
Trying to get to the bottom of how I ruined a couple hundy dollars of alloy today. One of my motors faulted and E Stopped my machine. Its a large router with a 4th axis. I restarted and rehomed the machine, but then discovered the hard way my Z had dropped about 1mm so destroyed the part. X and Y were fine. It was a 2hr operation. So hurts a little.

Do I need to restart Mach 4 to retain offsets? Not keen on this happening again I was a little surprised. I thought, if the machine is homed, it will return to the offset as good as the homing switches are. Am i wrong? Have been before
Title: Re: How does Mach 4 Store Offsets?
Post by: Cbyrdtopper on August 09, 2024, 08:28:19 AM
In my experience, you don't lose your offsets unless Mach4 crashes.  I added a bit of code to some probing routines to save the profile after it sets a tool offset or I use my probe.
However, if Mach4 didn't crash, you should've just been able to home your axis and be good to go again.  I've done this countless times.  Make sure your physical switch didn't move on your Z axis.  Or make sure it is repeating.... you can look at your offsets in the "View" --> "Fixture Offsets".  You can sit there and home the axis several times to see if there is a significant change in position.  I'd use a dial indicator to do this.
Title: Re: How does Mach 4 Store Offsets?
Post by: boydage on August 09, 2024, 03:58:41 PM
Huh, is that right? Thats what I thought. So yesterday the Z dropped about 1mm, with a 4th axis op that took 2mm off my part. I didn't notice just due to the time it happened until I got the part off and it was exactly ok everywhere except for approx 2mm thinner. Good for a paperweight.

I have siemens homing switches and will check my mountings, I was not sure I followed your instruction to check my offset return although I will probably work that out when in front of my machine. I did make a new part yesterday and it was fine after reprobing my Z on the 4th.

So when I get an E Stop signal out of my drivers, the only fix is to depower and repower my control circuit. Restart Mach 4. Rehome.

The challenge presented is if I have a part in my 4th axis vice and lose either X or Z of the WCS I am screwed. Its in the Y direction so the back plate of the vice is that reference. I was wondering what to do now to avoid this again. I could setup a referance block somewhere and reset with the known offset.

But in all reality I will try to find out the problem instead of a fix over the top. Or perhaps this was a one off..... Thanks for the words
Title: Re: How does Mach 4 Store Offsets?
Post by: Cbyrdtopper on August 09, 2024, 04:06:26 PM
--Store Fixture and Tool Offsets
function m900()
local inst = mc.mcGetInstance()
mc.mcProfileSave(inst)
mc.mcToolSaveFile(inst)
mc.mcFixtureSaveFile(inst)
end --m900()

if (mc.mcInEditor() == 1) then
   m900()
end


I made this m900 Macro and run it when I make any changes. 
You can also just put the code in a button on the screen and press the button whenever you make any changes.
If you have home switches on your machine, you should be able to restart mach4, home the machine, and start machining again.
But again, like I mentioned earlier, if Mach4 crashes.... it loses any data that has not been saved.  Running this bit of code will ensure you don't lose any tool offsets or work offsets.
Title: Re: How does Mach 4 Store Offsets?
Post by: boydage on August 09, 2024, 04:32:53 PM
Far out. Thanks a bunch for this. I have been burnt, I am going to install this and use it. Regards
Title: Re: How does Mach 4 Store Offsets?
Post by: rufustoad on August 11, 2024, 11:37:44 AM
WOW I was coming to post the same exact thing. I am not smart enough to install this code though.

In my case if I hit e-stop or abort the program before it is finished, I get into all kinds of trouble. I actually lose homing switches, auto probing and who knows what else. This has been going on for a long time with me but fortunately it's not happened on a valuable part, and I just thought it was a part of MACH.
Yesterday a part slipped from the clampdowns so I stopped the program quickly and before I stopped, I heard it skip, no problem I will rehome. Go to rehome and the Z+ switch is not noticeable HOWEVER the LED light comes on in diagnostics. Now I have to reboot all including MACH. I rehome and then go back to my work zero and both my X and Y are off and I am not sure if it grabbed the homing process, I did several days ago or what, but X was off a mile. It is very confusing to me. I keep thinking my control board is puking but after I saw this post I seem to be wrong. 
Title: Re: How does Mach 4 Store Offsets?
Post by: boydage on August 12, 2024, 02:46:36 AM
Mr Rufustoad.

Thanks. Ok. I reckon its a bug and a totally unacceptable one now I think about it. I had the issue with using the stop button making my machine jerk and lose position. Which is really to be honest totally unacceptable for a CNC machine of size. I did post something about this previously somewhere, someone was kind enough to give a workaround using the feedhold button.

A few weeks ago I entered my stock on a HUGE cut, large enough to start to slow my 6kw spindle down. Whilst I was messing around looking for the feedhold button (a stupid habit) it snapped a 10mm endmill.

My experience with equipment is E Stop should remove all control power, and a stop should be just a stop. Not a backwash of surges and faults somewhere. I can understand if say if my Y gantry at full rapid move might pose a problem stopping urgently. But in a normal op at normal speed, we should be able to use these functions without losing positions and offsets.

Ok. Rant over. How shall we proceed with a fix? I am using Mach 4 with the ESS. I do rememember a machine I worked on, we needed to remove an earth off a PSU in the machine that was causing the PLC to lose its programming. Made in Italy they are on a different grid power suppply, I think ours in NZ is teratera or something its about the earthing system. Anyway, we sorted it and the fault was very similar. Perhaps it can be sorted with software. What I do know, is I need a functionional E Stop and stop button I can use without bombing my machines settings and offsets. Are we on the right forum?
Title: Re: How does Mach 4 Store Offsets?
Post by: Cbyrdtopper on August 12, 2024, 09:15:36 AM
Just to cut in; in my experience with several Machine Tools, I've never seen a "Stop" button, it is always "Feedhold".  Haas, Doosan, Mazak, other Fanuc controlled machines all have feedholds.  It is Feedhold then reset.   Feedhold is a controlled stop of (as far as I can tell) the motion planner.  The ESS has (or did have) a "Controlled Stop" option in the setup.  If you want to check that box, it will make the stop button a controlled stop. 
Your feedhold is what you need to press when you need to stop the machine for minor issues, E Stop is the last resort for major issues due to the abruptness of the stop is should cause.

In regards to the E Stop; we wire our estop's into an e stop relay that in turn cuts power to the contactors controlling our servo or stepper drives, our spindle, and our coolant (just in case); the relay also has a NC circuit that we wire back to the motion controller so we can use the e stop signal inside Mach4 to let it do it's thing on the software side. 

In the past we have had serious issues with, as you call it, a backwash of surges and faults due to bad wiring on our part.
Rufustoad, I think you have some more underlying issues going on if you hit estop and you lose your inputs.  Also, if you part slipped, you need to re-establish your part's work zero before you can just rehome and continue machining.   If you shut down Mach4 properly you do not lose any of your offsets that you have made, you only lose offsets when Mach4 crashes unexpectedly. 
Title: Re: How does Mach 4 Store Offsets?
Post by: boydage on August 12, 2024, 03:10:59 PM
All cutting in is invited and welcome. Actually you made me go back an reread that last post from Mr Rufus. Agree actually, there is something going on with your machine I would be inclined to look at earthing paths myself.

Interesting you have wired a separate relay for your e stop is that a more robust way to cut power? Assuming its fail safe closed. The Mach e stop most certainly works, just its the end of anything I need to fully rehome the machine both stop and e stop.

I guess and hate to say it, Mach 3 was fine in this instance none of these problems occurred for me anyway. Both router and lathe. Putting it to more thought, I have a screen controller with a mouse. Perhaps I need to put a physical, amber color feed hold physical button adjacent to the e stop. Its not very often I need to use it, the irony is if I have hit the stop button and forgotten to check my lost offsets, that's normally when something goes very wrong.
Title: Re: How does Mach 4 Store Offsets?
Post by: Cbyrdtopper on August 12, 2024, 07:09:01 PM
It’s an actual e stop circuit relay. It’s a module we get from automation direct. It is controlled from the e stop switch; the relay has 3 normally open and 1 normally closed circuit.  We wire our servos from terminal blocks that are fed from a contactor. The contactor circuit is ran through the e stop relay.  The normally closed circuit we feed back into our motion controller so mach4 can have the e stop signal.

That is an odd thing to run into if you switched from mach3 to mach4.
I use the HiCON now instead of the ESS, but I swapped a mill with an e stop an external buttons from mach3 to mach4 and didn’t have these issues.
Title: Re: How does Mach 4 Store Offsets?
Post by: rufustoad on August 12, 2024, 10:12:29 PM
Hi folks,
First I would agree, I did not seem to have this issue with 3 either. I had a very hard time swapping but I did it. There is a ton of control you have in 4 that you need to be a computer smarty to understand.
I do not have an estop on this machine (I should I know) but I really do not feel I need one. I use MACH4's Stop on the main screen. I often use the Feed Hold with no issues and if I am cutting something like plywood and have to stop suddenly then this seems to happen BUT not always.
I also have this machine earth grounded. The panel is grounded back to the main box that is also hooked directly to earth and then I also have the gantry grounded. Not saying your wrong by any means but this seems repeatable, and I really have no other issues.
They only time I really use this is when I feel I ran the CAM wrong or if a part slips but I always keep the same G54 so I do not need to reset the work home as it doesn't change.
Again, I use the stop that is in MACH (pic attached).
I am by no means a computer expert, but this does seem like a glitch?? I would be happy to check anything
Title: Re: How does Mach 4 Store Offsets?
Post by: boydage on August 13, 2024, 03:37:54 PM
Hi. Thanks for that. In my case it didnt pose a large problem until I installed a 4th axis which is a whole lot more to setup after losing position.

Mr Rufus your problem appears to be similar to mine abet more pronounced. But do look at your fixtures, parts moving is the worst, and as you progress if you upgrade your machine as I have done, its a large piece of aluminum that might decide to make a hole into something if it lets go. Timber, well I put a 200mm machined ball into the opposite wall off my lathe that was a fun day. The dent remains.

As mentioned its a problem for me if in the rare occasion I need to stop urgently. I am running close to the line on momentum with the largest Nema 34 I could find. A side business for me its all about time taken to machine so I do push the limits. Occasionally on a very aggressive run my Nema will lose its position and E Stop the machine, this is also untidy similar to hitting the buttons. Although, the stop button is the worst.

Earthing is an interesting subject and I am going to look further into my machine. My case, if I hit the stop button, the machine will stop immediately, then about a split second later I will see it shudder which is the problem. I can only think a surge, can only be in my mind. Back to earthing, I am electrical worker in cardiac so know a bit about it. If you have any shielded conductors in your system, and have connected both ends of the shield to earth, its plausible a ground loop will be created making the whole earthing process moot in that conductor. Not sure in your case but I am going to check those for a start there is a lot of room for noise in a cnc controller, and its a simple mistake.

I think also about me I am going to look at an estop relay, cant say I have ever seen or installed a specific one prior so thanks for that Mr Byrd. BTW I never look at sites but did look at yours. Super cool, my workshop is mostly joinery, I have designed a bunch of window/door tooling and automated several of my machines including a tennon machine. Although my router is not capable for large steel components.

Mach 3 to Mach 4? I had no choice I started running out of IOs, so took advice and upgraded. It was a package deal with the ESS. Still using Mach 3 on my lathe though its robust with XP.

Title: Re: How does Mach 4 Store Offsets?
Post by: Cbyrdtopper on August 13, 2024, 03:50:42 PM
Thanks for checking it out!  We like what we do.
We use mach4 because it runs so much better. We use a PLC to handle the majority of our IO.
Title: Re: How does Mach 4 Store Offsets?
Post by: rufustoad on August 15, 2024, 03:40:59 PM
Just a small update and a few questions. I had left Mach on for a couple days straight. I came in and was going to us the router and noticed that the program had shut down, but the panel was still live. So, I decided to reboot everything just in case. I started everything up and did a homing sequence and Z did not stop however it did record on Mach screen that Home was triggered. What actually stops the motor when home is triggered? 1 other thing I would love to understand. When I turn on my safeties, I can no longer run the home sequence as the machine will trigger the Z switch and then stop on limit switch fault. Am I missing something in the setup? I thought when MACH is asked to start the Machine Home sequence it bypasses the safeties and continues to the next steps, Z,X, then Y home. Once that is finished it then recognizes the safeties or am I wrong?

I had to reboot 2 times and then everything worked as it should.
Title: Re: How does Mach 4 Store Offsets?
Post by: Cbyrdtopper on August 15, 2024, 03:53:17 PM
Homing is controlled solely by the motion controller.  So you may need to restart your motion controller.  I had to do this when I used the Smoothstepper.  I haven't really had to do that with the HiCON.  Maybe try powering that off and try again.
I do know that you can double up your limit and home switches, I did this on a bridgeport series ii.  It would ignore the limit switches while it homed and then once it finished homing it would look for the limits again.