Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: thephridge on August 06, 2022, 07:54:35 AM

Title: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: thephridge on August 06, 2022, 07:54:35 AM
Howdy. So we were having issues with M4 freezing. We uninstalled and re-installed the latest. As it happens, our PMDX Smart Bob 411gave up the ghost about the same time (PMDX is graciously repairing it). But, we bought an ethernet Smoothstepper to avoid USB connections. Anyway, after a lot of struggle and paying a company to set up the ESS with M4, our Y axis runs backwards when we try to run a file. New files or files made before the switch. When we hit execute G code, Y crashes into the home switch. I tried a bunch of things that I thought would reverse the issue but so far to no avail. If anyone has any ideas, we really need to hear them. Thank you.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: Steve Stallings on August 06, 2022, 08:47:52 AM
The direction that a motor runs can be affected by many things.

The Config>Control>Motors tab can be used. Highlight the desired motor on the right side of the panel and look for a check box at the bottom for Reverse.

The polarity of the direction signal can be configured in the ESS plugin.

The wiring polarity of the stepper driver outputs to the motor coils can change the direction, though this likely does not apply in this instance since you probably have not changed any of this wiring.

Note that the direction of jogs using the keyboard can be configured independently of all of the above and it is possible to have the keys mapped differently from other motion sources. Using on screen jog buttons would bypass this issue.

Lastly, it is common for machines to be configured such that the home switches double as limit switches. This is done by setting up duplicate entries in the Input Signals table such that the same signal is used by Home and by Motor1--  for example.

Mach4 should stop ALL motion if ANY limit switch is tripped. You should use the Diagnostics tab to view the hardware Input Signals to confirm that limits are configured and working. This screen is accessed from the Diagnostics tab at the right end of the same line of tabs the begins with Program Run, not the Diagnostic tab at the top line of the screen.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: thephridge on August 06, 2022, 09:26:35 AM
Thank you, Steve. It seems that its a very specific issue. After some G code tweaking, we discovered thatM4 is changing the Y direction at the outset of a file run. It holds true for old files that we've run many times before the new setup and new files that we created to see if there was a difference. For instance, the G0 line of code that normally would read G0 X -20.3583 Y 22.0912 Z0.2000 would cause the Y axis to run back into the home position. Conversely, adjusting the same line of code to G0 X -20.3583 Y -22.0912 Z0.2000 (note the Y change to -Y) made it run correctly I tried to tweak pin setting for some time last night but nothing made a difference. I can't help but believe that its some very minor tweak somewhere but its elusive.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: Steve Stallings on August 06, 2022, 09:34:34 AM
I recommend using on screen jog buttons to confirm operation while testing and adjusting parameters. That way you can avoid crashes.

Also confirm that the on screen DRO moves in the expected direction even when machine goes the wrong way.

If that is the case, there must be a configuration problem.

Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: thephridge on August 06, 2022, 09:52:54 AM
The Y DRO matches the direction of actual travel in both the original file and the adjusted version of the code. In both cases, when Y moves to the minus, the DRO shows the minus and vice versa.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: joeaverage on August 07, 2022, 04:38:49 PM
Hi,
Mach does not nor cannot change the direction. It means that you have code written for one machine but your new controller has one axis reversed. Change the direction
in the ESS Prot&Pins tab.

Craig
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: Steve Stallings on August 07, 2022, 05:26:43 PM
This case is more than just configuring the motor direction correctly.

The DROs and machine run correctly if you use the on screen jog keys.

When Gcode is run, one axis moves backwards. The Gcode itself has been supposedly been validated on his older setup with a PMDX-411. We have been trying to figure out if a G51 parameter is stuck somewhere. Adding a G51 Y-1.0 to the Initialization string in Mach4 makes things work correctly.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: joeaverage on August 07, 2022, 07:07:55 PM
Hi,

Quote
The Gcode itself has been supposedly been validated on his older setup with a PMDX-411.

That is the point, the code works with the old setup but not with the new control setup, ie the new control setup has one axis reversed by comparison
to the old setup. Its far from impossible that the old setup had the Y axis contrary to the industrial standard but if the Gcode for that machine had be written
in consonance with that setup it would work.

The simple expedient is to change the direction of the Y axis alone in the new set up and try running the code. If the code work then OP has to decide whether
he wishes to retain the non-standard setup OR change the Gcode to suit the industrial standard OR use a g51 when using old code.

Craig
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: Steve Stallings on August 07, 2022, 07:50:40 PM
I guess it is possible that the old setup had the Y axis misconfigured and original poster did not realize that he had worked around it by changing the Gcode. The replacement PMDX-411 is on the way to him and maybe he can reload his old configuration to check that. The testing with using the on screen jog buttons to verify that the DROs and machine moved in the correct direction convinced me that Mach4 was driving the machine correctly in this case. Sometimes people get confused when one axis moves the cutter and the other axis moves the table. I wonder if that could be the source of the problem.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: joeaverage on August 07, 2022, 08:09:05 PM
Hi,

Quote
The testing with using the on screen jog buttons to verify that the DROs and machine moved in the correct direction convinced me that Mach4 was driving the machine correctly in this case. Sometimes people get confused when one axis moves the cutter and the other axis moves the table. I wonder if that could be the source of the problem.

That has been my experience also. I do not favour using jog buttons to make calibration and/or direction tests either. You can assign a button to jog in either direction whereas a
g0 move is the positive x direction should cause the DRO to increment upwards and the axis advance such that the X ordinate increases, no question about how the jog buttons have been assigned.

Craig
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: Steve Stallings on August 07, 2022, 09:28:29 PM
Yes, the on screen jog buttons can be modified, but it is far more common to find that users change the keyboard ones without understanding the system. I was trying to find a way to avoid Gcode issues and prove that Mach4 was working correctly. Comparing DRO readouts to observed machine motion was the critical part.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: joeaverage on August 07, 2022, 09:45:40 PM
Hi,

Quote
Comparing DRO readouts to observed machine motion was the critical part.

100% there. Despite doing this now for years I can still bamboozle myself and set something up the wrong way.

I have often, with beginners, used a printed diagram on the bed of the machine to indicate the directions....it can help with the confusion.

Craig
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: thephridge on August 07, 2022, 10:10:42 PM
It turns out that we needed to add some "mirroring" code to the Initialization fields in the "default" section of Mach 4. G51 I believe.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: joeaverage on August 07, 2022, 11:50:57 PM
Hi,
yes that solves the problem but does not describe why it happened in the first place.

The real test is when you come to generate Gcode from a CAM program like Fusion. It assumes that you have a right hand machine, and if you don't it will be glaringly
obvious in short order.

Craig
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: thephridge on August 08, 2022, 08:43:57 AM
You got that right. Drew a new file. Simple pocket cut and now it wants to attack it from the wrong end. I can't believe this. It worked Saturday on a different file? I removed the mirroring code and it just went back to reversed initialization. Its like irs amking things up as it goes. And I just don't have the experience to correct it.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: thephridge on August 08, 2022, 09:46:39 AM
So Steve, I see where in other parts of the forum here that you suggest the ESS may not be so compatible with Mach 4. Should be try a different route? We are back to square one again and its still an axis direction issue.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: Steve Stallings on August 08, 2022, 09:51:17 AM
My only issue with the ESS is that their plugin configuration takes over many functions that are normally done in the standard Mach configuration screens. This is, for me, confusing. Overall the ESS is an excellent product and I do not think it is the cause of your problems.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: Bill_O on August 08, 2022, 10:09:47 AM
thephridge,

Does the motor reverse direction when you check Reverse?
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: thephridge on August 08, 2022, 10:34:30 AM
This is our router at home zero.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: Bill_O on August 08, 2022, 10:56:50 AM
Does the direction change when you check and uncheck the Reverse box for the motor?
I am not sure if it needs a restart so make sure you exit the software and start it again.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: thephridge on August 08, 2022, 11:20:32 AM
It does reverse but in the final analysis, we need to add the mirror code for all 3 axis. Maybe our whole machine is just set up backwards but it never use to do this kind of thing.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: joeaverage on August 08, 2022, 05:56:59 PM
Hi,
the most likely explanation is that your original machine/controller had one axis reversed by comparison to the industrial standard, and you became used to it.
I did the same many years ago with Mach3 and a parallel port. It was not until I started using CAM (MasterCAM in particular) did I discover that I had one axis back to front
relative to the standard. I changed my machine. It did mean that some of the Gcode that had previously worked no longer did, at least without manipulation, but it meant that
any standard Gcode would work on my machine.

Use the little diagram I posted earlier to determine the 'right hand' directions and stick with it.

That may mean that you have to prepend a single line of code to your existing Gcode files, namely a g51 line to have them work with your new control combination.
Another alternative is to use a Lua program the re-write your Gcode files by reversing the sign of all the Y coordinates. That starts to look complex if you have g3 and/or
g4 moves in your files. Do you?


If you need to change the direction of an axis use the ESS Pin Config tab to do so.

Craig
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: thephridge on August 08, 2022, 06:29:02 PM
So this set up is wrong? See attached.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: joeaverage on August 08, 2022, 06:49:47 PM
Hi,

Quote
So this set up is wrong? See attached.

By my reckoning what you have nominated as  -Y should be +Y.

Craig
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: thephridge on August 08, 2022, 06:58:58 PM
Forgive me but I just don't understand your diagrams. When I move the spindle out away from home, the Digital Read Out in Mach 4 counts into the minus numbers for x an y. You're saying it should be positive? Is our "Home" in the typical spot?
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: joeaverage on August 08, 2022, 07:52:43 PM
Hi,

Quote
he Digital Read Out in Mach 4 counts into the minus numbers for x an y. You're saying it should be positive? Is our "Home" in the typical spot?

I would say no, the typical spot for home is the bottom left corner ie first quadrant, however anywhere is acceptable. In your case you have drawn your table in the second quadrant.
You may remember drawing graphs at school, the first quadrant is normal, but the second is OK to.

Still that means that the Y axis should count up, ie positive, from your home, the X axis would count negative from your home.

Craig
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: joeaverage on August 08, 2022, 08:01:30 PM
Hi,

the attached pic is of the right hand rule and is in the Mach4 Mill Programming Guide in Help Docs.

Craig
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: thephridge on August 08, 2022, 09:19:47 PM
Are you sure that its not just because you're in New Zealand and everything is upside down? Just kidding. I just got off the phone with a local fellow and he basically explained all of this to me. Who new? The whole machine is backwards. But that's the way we bought it and had no way of knowing the difference. And its been running fine for several years. The man we bought it from used Linux and spoke G Code like it was his first language but I didn't have the time to learn programming and G Code so I went with VCarve and M4. Why not let the software do the work for you right? Now I know why the tech support people blow me off so quickly. They all think I've been drinking heavily. At any rate, once we get past this next week or so, we're going to spin that puppy around, re-locate the home switches and this local fellow will help us get on the standard track. Thank you so much for all the valuable info. It does make more sense now.
Title: Re: Mach 4 and/or ESS has my Y AXIS running backward.
Post by: joeaverage on August 08, 2022, 09:40:47 PM
Hi,

Quote
re-locate the home switches and this local fellow will help us get on the standard track. Thank you so much for all the valuable info. It does make more sense now.

Kool. You do not not have to change the Home switches though, they can stay where they are.

Lets say you leave the switches alone and you retain the fact that the machine drives to the lower right hand corner of its travel. When it gets there you'd normally
say 'You are Home', ie the machine coordinates would be set to 0,0,0. But if you want to call the lower left hand corner Home then you'd say 'You are at 0,450,0' and
the machine would set the machine coordinates to 0,450,0. (I am assuming 450mm is the Y axis extent) So if you now said <GoTo Work Zero> it would drive 450mm
to the left and stop at your nominal Home location, ie the lower left hand corner despite it being homed to the lower righthand corner.

The Home switches define one particular location in your machines envelope, and so long as that location is precisely and repeatably defined it does not matter where it is.
You can declare home to be so many mm in that direction and so many mm in that direction from that unique location, and call that Home. The settings to make it so are
the Homing Offsets on the Homing tab of the Control Plugin.

Craig