Y offset position - set 0 at Y +30

Hey folks

I appear to be very out of practice with Marlin and the documentation is still a bit of a headache.

What I want is to have my Y axis 0 position be 30mm north of the endstops. Any idea how I sent that in firmware ? I want to compile that into firmware if poss.



There are a couple of different approaches. Changing the coordinate system can be done with workspaces, and workspaces, according to the docs, can be saved in the firmware. Be aware that 1) I see very little use of workspaces by the MPCNC users on this forum, so you may not get much support in figuring them out, and 2) you must add a change to the new workspace either as part of your g-code script, or prior to running your script. That change could be done as part of an auto script on an SD card, or it can automatically be added to your generated g-code in either your CAM or your g-code sender.

A simpler approach would be to just do it all in g-code as part of the homing sequence:

G28 X Y
G0 Y30 F500
G92 Y0 

This leaves the router at the new origin, which is 30mm from the end stop. You should be able to do the same thing without moving the router.

G28 X Y
G92 Y-30

This would leave the router at the end stops, but the Y=0 position would be 30mm north.

Jut putting it out there that you can also re-compile the firmware with the Y endstop position defined as -30mm. Also, since your CAM will probably try to go into negative X territory (The edge of the actual piece is usually defined as 0, and the CAM will try to move the tool one tool width into negative) it is probably also a good idea to define the X stop as at least one tool width negative at the same time.

Or, with Gcode as above:

G28 X Y
G92 X-3.18 Y-30.00

Assuming a 1/8" endmill.

1 Like

Thanks. I learned a few new things there.

Oh, how does this relate to bed size ? I.e. if I set the Y to -30, if my bed is a total of 630mm on the Y, should the max Y in firmware be 600mm or 630mm ?

This is a bit tricky. The short answer is that increasing the size solves nothing, and personally I suggest you don’t worry about the issue.

Long answer:
There are only two situations where the bed size matters. First, if you attempt to home your machine from a distance that is further away than what is set in the firmware for bed size, your machine will stop and emit a non-recoverable error. Your setting the y origin to 30mm from the end stop has no impact on this issue. It calculates the travel distance from the point where you initiated the homing sequence.

The second place where bed size matters is using soft stops. When your machine is in a homed state, the firmware will prevent it from going past the maximum distance you specified in your bed size (soft stops). The problem is that when you execute the G92 to reset the ‘Y’ position as I’ve done in the g-code posted above, you reset the machine coordinates and machine *no longer considers itself homed," and therefore the firmware will ignore soft stops.

If you go with a workspace solution, then soft stops will still be honored, but I think workspaces add an unnecessary level of complexity to your work for what I think you are trying to achieve, plus my personal experience is that my lack of using soft stops has never hurt me.

I’d have to read the Marlin docs to be sure, but I think that you’d define the bed size to be the maximum coordinate that you want to allow. That is how my Repeat printer is defined, with the stops at -33mm X and -63mm Y for the stops.

Marlin is perfectly happy to allow negative coordinates, many people put the origin at the center of the bed to allow gcode to be portable between different printers with different bed sizes, and still print in the middle of the build plate. We don’t really want that for CNC though.

I agree that the defined bed size is not really important for what we do. Most of the time, himing is going to be done from near the origin anyway, and if you get used to doing it that way, it’s not a problem. Soft stops make things more complicated, but I find them useful, so I do go into the extra trouble of workspace coordinates. It is extra trouble though, and I’d recommend that you don’t go there until you have a problem that you need to do that in order to solve it. Or at least until you have a firm grasp of all of the basic tasks with setting coordinates.

I dont have a fixed position that I want my origin to be, but if you have a fence or marked position on your spoilboard, or are doing many similar jobs, it could be good to have your endstips defined as specific coordinates relative to your origin, I think.


Thanks. The changes are really for 2 reasons. The bed size is all about safety really. If the soft end stops are set I can’t do something stupid and have the machine try and rattle itself to pieces.

As for the homing offset, it’s kinda just down to the way my mind works… if X=0 and Y=0 at “that point right there” then I know my home point is within the boundaries of my spoilboard and I’ve got 600mm by 600mm to work with from that point.

At some point down the road I may realise there’s a better way of doing it for for right now and learning that’s what makes the most sense to me.

For now I’m going to set a custom menu to G28 on the X and Y, then move to the relevant point and call that zero. I’m only testing with a pen anyway at the moment so the worst that can happen is I ruin a piece of paper.

Thanks for the detailed answers, super helpful.

Reiterating, when you execute a G92, you lose your soft stops. If you want your soft stops to work, and you are going to mount your work at a position other than the machine 0,0 (where the end stops home to), you will need to use workspaces.

1 Like

Trying to edumacate myself… reading the relevant info, Marlin docs for G92 say physical boundaries are maintained. Guess I’ll try it and find out.

Don’t wish to contradict. I’m all good with Marlin on a Cartesian 3D printer but this is a bit out of my wheelhouse….

Edit… nevermind, that’s when using workspaces. Sorry !

Stop blocks are a nice thing to have, I just suggest you kick the can down the road on getting them working and enjoy using your machine. You are unlikely to regret not getting them working now.

On my first MPCNC (previous Burly version), I remember being very nervous about doing something that would damage my machine. And the first time my gantry was stopped (I hit a clamp), my machine made this ugly noise, and feared I’d ground the timing belt up. But, there was no damage. It’s rare that I exceed the working area of my machine (i.e. where a soft stop would trigger), but the worst thing that has ever happened when I did hit the bounds (minimum side) is that I broke a stop block. A quick reprint of the $0.10 part, and the machine was fixed. These steppers are not that strong, and holding them up, while ugly sounding, does not damage them, and exceeding the bounds of your machine is highly unlikely to cause any serious damage. In a variety of ways, the MPCNC is very forgiving of our mistakes.

1 Like