Universal Gcode Sender: Crashed in middle of carve

I see. I’ll check-out your grbl upgrade. I share the desire to learn new things. X-carve was new to me year before last. I retired a few years ago from university teaching/research in horticulture that involved me learning/using BASIC programming and simple electronics to make devices for research. This forum is an amazing resource for those of us with minimal knowledge/experience to get help from others who have much more. I appreciate the time and effort you took to give me a hand. If not for a brief lapse of concentration, my carve might have been saved. I still might be able to salvage the piece by finishing it by hand.

1 Like

Because I’m so stubborn, I decided to shutdown UGCS and start it back up like before. When I entered the $G and $# commands I received the exact same numbers as the first time. Is it possible, by some stroke of dumb luck, I didn’t actually move the spindle when I previously, mistakenly hit the arrow key??? UGCS shows my machine position to be 0,0,0.

When you close the serial port and re-open it that is effectively a reset to grbl. Since grbl has no idea where your spindle is when it initializes it’s internal state, it defines the current position to be Machine Zero.

There are only two ways to change Machine Zero. One is to restart grbl and the other is to home your machine.

So, no dumb luck.

I think I get why the machine position came back as 0,0,0. What surprised me was that the work position came back with the same numbers as the previous restart.

I should have focused on the work position numbers in my recent posts instead of machine position.
They were the same after both restarts: -125.051,136.286,-3.996

Maybe it still doesn’t make a difference. Can you point me to a good reference that explains work versus machine positions in general and/or when using UGCS? If I understand how they related I might understand what’s going on better.

If you look at the $G output, that shows you the state of the modal settings. Modal settings are ones that once set they are in effect until another command changes them.

If you issue a G21 (units in mm) then all commands after that are considered to be mm unless you then issue a G20 (units in inches). Then all commands after that are considered to be inches until you change it again. The values in your output above are the defaults because you did the $G command before anything else was issued (unless you have something in the macro locations).

Take note that in the $G (parser state) output you have G54 in effect.

Now look at the output from the $# command. In it you will find the co-ordinates (machine co-ordinates) that are Work Zero for the G54 state. These values are stored in non-volatile memory on the ATmega328P (Arduino and X-controller processor) so when you start grbl up they are still there even after a power cycle operation.

G54 through G59 are different co-ordinate systems that you can use for complex jobs.

Also displayed in the $# output is the location set for G28 moves and G30 moves.

Machine Zero is a reference point for the hardware.

Work Zero is a reference point for your design software. When you draw up a design you need to have a reference point so that you can tell the machine where to start when executing the G-code toolpath that comes from your software design.

When you set Work Zero when setting up for a job you are telling grbl where Work Zero is relative to the hardware Machine Zero.

It’s easier to picture if you home your machine. When you home the machine it moves to the left extent of X and the front extent of Y. Then that becomes your Machine Zero. If you were to place the point of your work material that you designed to be Work Zero in the spot just under the mill/bit then Machine Zero and Work Zero would be the same.

If you move that point of the work material 20 mm to the right and 30 mm toward the back of the machine, Machine Zero doesn’t change, but Work Zero is moved relative to Machine Zero.

So, if you jog your machine to X20 Y30 then the Machine Position changes to 20,30,? Then you would zero X and Y which would put the work position at 0,0,? and the machine position would be 20,30,?

At this point you run the G-code and it puts things in the correct position because you now have Work Zero positioned above the corner of your material.

Hope this improves rather than confuses the issue.

OK…that’s some pretty dense reading and it will take me some time to work through it carefully. But, let me test my understanding with this statement:

Since I didn’t home my machine I don’t know what the relationship was between my machine position and work position in the run before the error. Therefore, I can’t return to that state.

Does that statement illustrate some clear understanding on my part? I’m intrigued by all this and would like to learn more. Is there a reference or two that you can point me to or is your knowledge the result of a dedicated effort on your part to assemble this information from a variety of sources?

Close. We did know the relationship between machine position and work position, but we didn’t know where either one of them was relative to the material or space.

[Edit] don’t know the answer to a where to find a good reference. I learned through time, reading and mistakes and I’m still learning.

OK…I see. So it’s key to get the router back to the original 0,0,0 starting point relative to the uncarved block of wood. I chose the starting point pretty casually (except for Z) since I knew there was plenty of wood in the X,Y directions. It’s too bad I can’t trust the current X,Y values that I shared in the photos at the beginning of all this. I don’t care about the depth since I can start a little above what’s already been carved and let the carve proceed from there. Since the X,Y coordinates repeat for every layer, I wonder if I’d be able to spot a definite point (e.g. the far edge where the curve is at its most positive X value) and work back from there to get the original X,Y location on the block???

You’ve been very helpful and patient with me and I don’t want to take advantage of your kindness. So, just tell me if/when you’ve had enough. This is a huge learning experience for me and, before I remove the block to cut it by hand, I’d like to be sure I’ve exhausted all possibilities. Feel free to tell me if I’ve already done that.

I believe that with enough time and effort you could work it out. If this is an exercise in learning and you don’t mind spending several days at it then I think it could be done.

If you are just trying to save your work piece because the material is expensive, then it would need to be insanely expensive to warrant the time involved.

What you would need to do is to home your machine and then jog around the work piece getting machine co-ordinate values of key points in the design. Then go back to the software you designed the project in and start locating those recorded reference points to match up with the design and then you could infer the location of work zero, go back to the machine and set your work zero appropriately.

Then carve it and hope you got it right.

I’m more motivated to work it out for learning’s sake. I’m retired so time is not an issue. I’ve ported the data over to Excel to see if I can spot the min/max X and Y values to, hopefully, find a pattern. I’ll definitely follow your advice homing the machine and finding coordinate values for these key points.

Ok, good luck with it. I’ll be interested in hearing if it works out.

I definitely will… success or no.

Believe it or not, I was able to salvage this carve! I used the original SketchUp file to determine distances of specific locations on the model, the animation in Vcarve to see where/how the endmill was moving on each layer and Excel. I imported the Gcode file into Excel and separated the X and Y data into separate columns. I then used the Min and Max functions to find the X,Y coordinates for specific spots (e.g. right-most X value, upper-most Y value) on the model. Once I did that, I could back calculate to 0,0. The key was to watch the carving animation in Vcarve. Originally I assumed the maximum X distance was on the right-most side of the model which was incorrect. The right-most X value was the outer wall of the channel that’s carved to actually separate the model from the block of wood from which it’s being carved. Once I was comfortable I had re-found the original 0,0, I edited the Gcode file so the carve would start a few steps behind where it froze in the first place. I made sure I knew where the tip of the endmill was all times so I didn’t somehow plunge it into the block of wood too soon on the re-start. What an amazing learning experience this has been. My take-home message??? HOME, HOME, HOME!

4 Likes

Now that I want to starting homing my machine, I can’t find the steps to follow. Can you point me in the right direction to get it done using UGCS?

Read through this, it might help you understand using the switches.

Yes, I purchased and installed the limit-switch kit when I built my X-Carve. I don’t think I’ve ever used them for their intended purpose so I would have to say I haven’t adjusted them.

This will get me started…thanks!

After cleaning up my X-Carve, I set $22=1 and pressed the $H key. As backup, my finger was on the power button in case things didn’t work as expected. It worked fine and my machine went through the steps to zero Z, X and Y. I had adjusted the limit-switch stops a ways from the actual ends so I moved them as far as I could to get the maximum work space (my X-Carve is the 500mm version). So, I guess I’m up and running with homing enabled. I understand that the “Machine Coordinates” are stored in G54 and they always come up the same. Now, when I zero my machine, move the spindle around some and, then, press “Return to Zero” it goes right back to the homing position. I wasn’t able to do that before. The only difference I notice in operation is that when connecting with UGCS the initial status is “Alarm”. I have to press $X to unlock it.

1 Like

This is the correct action when soft limits are enabled. The reason is that you haven’t established the “home” position yet, which is required for soft limits. The normal action at that point is to home the machine $H.

Be careful using the “Return to Zero” button in UGCS as it moves X and Y (version 1.0.9) before raising Z so you could crash into clamps, etc.[quote=“DavidBurger, post:76, topic:33953”]
I understand that the “Machine Coordinates” are stored in G54 and they always come up the same.
[/quote]

Normally, G54 contains the machine co-ordinates of the last Work Zero position that you set.