SKR V1.3 with Marlin 2.7 TMC2209 with sensorless homing on XYZ.controlled by CNCjs on a PI3B+.
Home is left rear corner with Z moving up.
Sensorless homing works fine and all endstop are in the correct position.
Jogging the control buttons in CNCjs moves X+ to the right, Y+ to the front and Z+ downwards.
In KiriMoto I create a G-code file and start this in CNCjs.
When Z is moving for what I can see in DRY TESTING it is moving in opposite direction.
What I mean is Z should move up to clear the first spot to cut but it does not.
When moving to a new spot it should go up again, but what I see it is the other way around. Cutting is Z up. Free move is Z down.
When I check the G-code Z values in CNCjs they are opposite of what is needed (+ and - ) so this confirms the movement in the wrong Z direction.
I tried all settings I could think off but I cant succeed.to correct it in KM.
BTW swell program for CNC. Thanks for all efforts sofar.
Hi @Paco_Raap and welcome.
Just to be clear, you’re talking about a cnc mill running Marlin? Z values in all setup’s I’ve seen, positive values move the spindle up and negative values move it down. The issue then is whether your origin (0,0,0) is at the top of the part or at the bottom. And control over that is under
Can you tell me a little more about your hardware? Is it DIY, kit, or a commercial product? What other software have you used to generate gcode for it in the past?
My hardware is DIY.
I am also using 3D printers with same controller equipped with Marlin.
With my 3D DIY printers home is front left…
For generating Gcode for 3D I use Ideamaker.
For CNC I have not used other toolpath generators as these are not so simple as KM!
I am new to CNC so I might do it all wrong. I appologize for that.
So is it a general rule to have home front left with CNC?
X uses X-min and Y using Y-min. If homing of Z ( Z-min) is to the top and homing works this means in Marlin the motor direction is correct. I am not aware of other settings in Marlin to make the positive direction reversed.!
If I select “dept first” and “origin top” my dry testing shows it starts at the bottom of the stock moving upwards so the whole milling is in the opposite direction.
Marlin is configured as Cartisian configuration.
BTW the foam stock piece in the picture is not milled on this machine.
It is what it should do when all is working…
@Paco_Raap if you are using the same controller for the mill as the 3D printers, then it’s likely one or more of the axes will be inverted. The cause is the mechanical setup inherent to the machine. Usually you would re-compile Marlin after making adjustments to the firmware settings. It’s not something that can be done in GCode. One caveat to that, if you are not using endstops, then you can fake it with a properly crafted
M92 command where you set the
Z steps to the a negative value. If it’s, say,
100 then set it to
Getting familiar with building your own Marlin is a good idea. It can be a real pain the first time to figure it all out (build tools, settings), but only takes a few minutes after that.
Thanks for your reaction Stewart.
I use DIY CoreXY 3D printers.
For the CNC I use the Cartasian configuration.
I can build,alter and upload Marlin…no problem to that.
Just tried to compile with negative Z value but Marlin sanity check say not allowed to use negative values for M92 steps.
there is a setting to invert the z axis. don’t use negative steps. that’s a hack you may be able to use after firmware is compiled with a serial command.
Configuration.h look for (and change Z DIR)
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
#define INVERT_X_DIR false
#define INVERT_Y_DIR false
#define INVERT_Z_DIR false
OK Z is reversed in Marlin.
Controlling Z from the CNCjs controlboard moves Z down with Z- and up with Z+.
OK that is step1
Original homing G28.2 as expected moves Z in the negative direction due to Z reverse so is incorrect as it has to move up.
So I thought leave the Program Home button unused.
I programmed a macro for the new homing sequence.
XY homes correct and Z moves in the correct positive direction but sensoless homing fails now in Z , resulting in overrun endpoint.
Configuration.h has a solution for that as well: homing endstop direction. Just invert Z again.
// Direction of endstops when homing; 1=MAX, -1=MIN
#define X_HOME_DIR -1
#define Y_HOME_DIR -1
#define Z_HOME_DIR -1
OK deactivate Z- endstop in Marlin and activate Z-mxa for endstop.
#defie Z_HOME_DIR 1
If I do that step homing is correct.
Jogging Z is correct.
But when I select the Z 0 button the head move down away from the home position as it use the Zmax as reference which in my case is set to 75 mm.
After homing this 75 mm is the new base value.
I also checked if I could reverse the Z- and Z coordinates as a batch in the G-code with Notepad++ but that is not possible due to the notation.
I’ve never used Z homing on a cnc mill since I’m always referencing (setting Z = 0) my cuts to the top of the stock I’m going to cut. In fact, I reference X and Y to the stock as well. Usually the bottom left corner or the center. I think expecting the mill to act like a 3D printer with a fixed coordinate space in this respect is wrong and will end up confusing you.
I my case the EVA foam stock is always the same 30 mm heigth and size 290x360mm and I always use the same bit for milling. So my ultimate goal to reference from 0mm value from the Z homing with a fixed value from the tip of the router bit to the top of the stock can not be delivered.
So this is what I have to accept in the current situation with this machine setup.
I reversed the Z-driver only in the end of all testing…
Made a macro in CNCjs for XY homing G28.2 XY and left Z out of it.
Do not home Z anymore but use the jog buttons to move the tool to any required Z height.
Made a macro to shift to G54 (second workplane) with X0Y0Z0.
This is needed as Marlin still does not respect the G10 L20 P1 Z0 command from the CNCjs console Z workspace reset button…
Start the required G-code.
Machine this way runs in the correct Z direction to mill the object.
Not the way I had in mind it should work.
Thanks for thinking with me.
@Paco_Raap I’m not sure I’ve internalized all you’ve done, but my gut is that you should be able to setup a proper homing situation with your mill. I run Marlin on my mill (without endstops), but know I could if I wanted to. I think maybe one of your settings is either inverted improperly or missing an opposing setting. You should be able to use Z max + endstop as the Z at its highest point. I think the gcode to do that (and set Z = 0) would be:
Stewart, my initial thought is YES WE CAN. But I already put too much time in this thing
Now with the workaround I can start an intial real mill job to dial in the machine more.
In the end I will sort this reversed thing.
I let you know when I succeed.