Page 1 of 1

Homing procedure

PostPosted: Mon Sep 23, 2024 4:26 pm
by El Ventu
Hello everyone!
I'm converting a small milling machine, I'm in search of the maximum precision possibile to make small plastic injection molds for my Precious Plastic workspace.

Since I'm running the workspace in my spare time, and the milling process can be very long, the machine have to be turned off in between the various procedures.

To achieve the maximum homing precision, I bought three Metrol microswitches (0.01mm repeatability), but they have the downside of having a very little travel, so it's needed to do the homing procedure at a very low speed.

My idea to speed up the procedure is this:
Installing three proximity sensors near the precision ones, to sense when the axis is near them, so the axis is moving fast until it opens the circuit of the proximity, and from that point it moves slowly to the precision one.

All the sensors are normally closed, so this procedure can be made using only two inputs on the AXBB-E I bought.

Is this procedure doable with UCCNC?

Re: Homing procedure

PostPosted: Sat Sep 28, 2024 8:02 pm
by Battwell
no need.
you can set the homing back off speed very low to catch the same position every time.
my machines repeat at <0.005mm which should be "unseeable" (using proximity switches)
just make sure your machine can overun the switches without breaking them.

Re: Homing procedure

PostPosted: Sun Nov 17, 2024 2:02 am
by El Ventu
Battwell wrote:no need.
you can set the homing back off speed very low to catch the same position every time.
my machines repeat at <0.005mm which should be "unseeable" (using proximity switches)
just make sure your machine can overun the switches without breaking them.

I don't asked if there's need.
I asked if it's possible.
Proximity have drift related to temperature, mechanical ones don't.

However, I want to use the Metrol ones, the question is still valid.

Re: Homing procedure

PostPosted: Sun Nov 17, 2024 6:07 am
by sebba
even your molds will have temperature drift, if you can measure it

regarding "if possible", I think you can make a macro which will move your machine to the proximity sensors position and then do homing at slow speed
something like: disable soft limit // goto X0 // detect Xsensor // stop Xaxis // goto Y0 // detect Ysensor // stop Yaxis // start homing // enable softlimit
need testing, of course

Re: Homing procedure

PostPosted: Mon Nov 18, 2024 10:24 pm
by El Ventu
sebba wrote:even your molds will have temperature drift, if you can measure it

regarding "if possible", I think you can make a macro which will move your machine to the proximity sensors position and then do homing at slow speed
something like: disable soft limit // goto X0 // detect Xsensor // stop Xaxis // goto Y0 // detect Ysensor // stop Yaxis // start homing // enable softlimit
need testing, of course


That's sure.
But, you know...
I'm used to work with professional machinery, so I want to try to have the positioning as precise as I can.

I also already bought the Metrol sensors.

Where the macro has to be inserted?
Thank you!

Re: Homing procedure

PostPosted: Tue Nov 19, 2024 5:44 pm
by RsX
sebba is right and he is describing exactly a homing procedure. So I thought, why not make 2 homings for each axis?
And that's what I did.
This was an interesting exercise, I got to use structs, #events and learn more about macro programming. :mrgreen:

Enough said, here is the code. Right now it works only with X, Y and Z, but it can easily be expanded to include A,B and C axes.
You need at least 2 input pins, one for all the proximity sensors and one for all the precision switches. Fast and slow feedrates, up and down the sensors, are individually set for each axis.
Let me know what you think. :)
Code: Select all
Config_ Config = new Config_{
   //X Axis
   X = new AxisConfig{ AxisName = "X",
                  //Inputs
                  ProximityPin = new Setting{ Value = 1, ScreenField = 5},
                  ProximityPort = new Setting{ Value = 2, ScreenField = 245},
                  MicroPin = new Setting{ Value = 1, ScreenField = 5},
                  MicroPort = new Setting{ Value = 2, ScreenField = 245},
                  //Feedrates
                  FastHomingUp = new Setting{ Value = 1000, ScreenField = 6},
                  FastHomingDown = new Setting{ Value = 250, ScreenField = 15},
                  SlowHomingUp =  new Setting{ Value = 50, ScreenField = 6},
                  SlowHomingDown = new Setting{ Value = 10, ScreenField = 15},
                  //Buttons
                  HomingButton = 107
   },
   //Y Axis
   Y = new AxisConfig{ AxisName = "Y",
                  //Inputs
                  ProximityPin = new Setting{ Value = 2, ScreenField = 20},
                  ProximityPort = new Setting{ Value = 2, ScreenField = 250},
                  MicroPin = new Setting{ Value = 2, ScreenField = 20},
                  MicroPort = new Setting{ Value = 2, ScreenField = 250},
                  //Feedrates
                  FastHomingUp = new Setting{ Value = 1000, ScreenField = 21},
                  FastHomingDown = new Setting{ Value = 250, ScreenField = 30},
                  SlowHomingUp =  new Setting{ Value = 50, ScreenField = 21},
                  SlowHomingDown = new Setting{ Value = 10, ScreenField = 30},
                  //Buttons
                  HomingButton = 108
   },
   //Z Axis
   Z = new AxisConfig{ AxisName = "Z",
                  //Inputs
                  ProximityPin = new Setting{ Value = 3, ScreenField = 35},
                  ProximityPort = new Setting{ Value = 2, ScreenField = 255},
                  MicroPin = new Setting{ Value = 3, ScreenField = 35},
                  MicroPort = new Setting{ Value = 2, ScreenField = 255},
                  //Feedrates
                  FastHomingUp = new Setting{ Value = 500, ScreenField = 36},
                  FastHomingDown = new Setting{ Value = 250, ScreenField = 45},
                  SlowHomingUp =  new Setting{ Value = 50, ScreenField = 36},
                  SlowHomingDown = new Setting{ Value = 10, ScreenField = 45},
                  //Buttons
                  HomingButton = 109
   }
};


exec.AddStatusmessage( "!!!Double Homing Started!!!" );
DoubleHoming(Config.Z);
DoubleHoming(Config.X);
DoubleHoming(Config.Y);
exec.AddStatusmessage( "!!!Double Homing Finished!!!" );


#Events

int ApplysettingsButton = 168;

struct Setting {
   public double Value;
   public int ScreenField;
}

struct AxisConfig {
   public string AxisName;
   //Proximity Input
   public Setting ProximityPin;
   public Setting ProximityPort;
   //Micro Input
   public Setting MicroPin;
   public Setting MicroPort;
   //Feedrates
   public Setting FastHomingUp;
   public Setting FastHomingDown;
   public Setting SlowHomingUp;
   public Setting SlowHomingDown;
   //Buttons
   public int HomingButton;
}

struct Config_{
   public AxisConfig X;
   public AxisConfig Y;
   public AxisConfig Z;
}

void DoubleHoming(AxisConfig AC)
{
   //Fast homing
   exec.AddStatusmessage( "- Fast Homing " + AC.AxisName + " Axis -");
   //set proximity as home sensor
   setFieldValue(AC.ProximityPin);
   setFieldValue(AC.ProximityPort);
   //set fast feedrates
   setFieldValue(AC.FastHomingUp);
   setFieldValue(AC.FastHomingDown);
   //Applysettings
   exec.Callbutton(ApplysettingsButton);
   //home axis
   exec.Callbutton(AC.HomingButton);
   while(exec.IsMoving()){}
   
   //Slow homing
   exec.AddStatusmessage( "- Slow Homing " + AC.AxisName + " Axis -");
   //set precision switch as home sensor
   setFieldValue(AC.MicroPin);
   setFieldValue(AC.MicroPort);
   //set slow feedrates
   setFieldValue(AC.SlowHomingUp);
   setFieldValue(AC.SlowHomingDown);
   //Applysettings
   exec.Callbutton(ApplysettingsButton);
   //home axis
   exec.Callbutton(AC.HomingButton);
   while(exec.IsMoving()){}
}

void setFieldValue(Setting s){
   AS3.Setfield(s.Value, s.ScreenField);
   AS3.Validatefield(s.ScreenField);
}

Re: Homing procedure

PostPosted: Wed Nov 20, 2024 11:41 pm
by El Ventu
RsX wrote:sebba is right and he is describing exactly a homing procedure. So I thought, why not make 2 homings for each axis?
And that's what I did.
This was an interesting exercise, I got to use structs, #events and learn more about macro programming. :mrgreen:

Enough said, here is the code. Right now it works only with X, Y and Z, but it can easily be expanded to include A,B and C axes.
You need at least 2 input pins, one for all the proximity sensors and one for all the precision switches. Fast and slow feedrates, up and down the sensors, are individually set for each axis.
Let me know what you think. :)
Code: Select all
Config_ Config = new Config_{
   //X Axis
   X = new AxisConfig{ AxisName = "X",
                  //Inputs
                  ProximityPin = new Setting{ Value = 1, ScreenField = 5},
                  ProximityPort = new Setting{ Value = 2, ScreenField = 245},
                  MicroPin = new Setting{ Value = 1, ScreenField = 5},
                  MicroPort = new Setting{ Value = 2, ScreenField = 245},
                  //Feedrates
                  FastHomingUp = new Setting{ Value = 1000, ScreenField = 6},
                  FastHomingDown = new Setting{ Value = 250, ScreenField = 15},
                  SlowHomingUp =  new Setting{ Value = 50, ScreenField = 6},
                  SlowHomingDown = new Setting{ Value = 10, ScreenField = 15},
                  //Buttons
                  HomingButton = 107
   },
   //Y Axis
   Y = new AxisConfig{ AxisName = "Y",
                  //Inputs
                  ProximityPin = new Setting{ Value = 2, ScreenField = 20},
                  ProximityPort = new Setting{ Value = 2, ScreenField = 250},
                  MicroPin = new Setting{ Value = 2, ScreenField = 20},
                  MicroPort = new Setting{ Value = 2, ScreenField = 250},
                  //Feedrates
                  FastHomingUp = new Setting{ Value = 1000, ScreenField = 21},
                  FastHomingDown = new Setting{ Value = 250, ScreenField = 30},
                  SlowHomingUp =  new Setting{ Value = 50, ScreenField = 21},
                  SlowHomingDown = new Setting{ Value = 10, ScreenField = 30},
                  //Buttons
                  HomingButton = 108
   },
   //Z Axis
   Z = new AxisConfig{ AxisName = "Z",
                  //Inputs
                  ProximityPin = new Setting{ Value = 3, ScreenField = 35},
                  ProximityPort = new Setting{ Value = 2, ScreenField = 255},
                  MicroPin = new Setting{ Value = 3, ScreenField = 35},
                  MicroPort = new Setting{ Value = 2, ScreenField = 255},
                  //Feedrates
                  FastHomingUp = new Setting{ Value = 500, ScreenField = 36},
                  FastHomingDown = new Setting{ Value = 250, ScreenField = 45},
                  SlowHomingUp =  new Setting{ Value = 50, ScreenField = 36},
                  SlowHomingDown = new Setting{ Value = 10, ScreenField = 45},
                  //Buttons
                  HomingButton = 109
   }
};


exec.AddStatusmessage( "!!!Double Homing Started!!!" );
DoubleHoming(Config.Z);
DoubleHoming(Config.X);
DoubleHoming(Config.Y);
exec.AddStatusmessage( "!!!Double Homing Finished!!!" );


#Events

int ApplysettingsButton = 168;

struct Setting {
   public double Value;
   public int ScreenField;
}

struct AxisConfig {
   public string AxisName;
   //Proximity Input
   public Setting ProximityPin;
   public Setting ProximityPort;
   //Micro Input
   public Setting MicroPin;
   public Setting MicroPort;
   //Feedrates
   public Setting FastHomingUp;
   public Setting FastHomingDown;
   public Setting SlowHomingUp;
   public Setting SlowHomingDown;
   //Buttons
   public int HomingButton;
}

struct Config_{
   public AxisConfig X;
   public AxisConfig Y;
   public AxisConfig Z;
}

void DoubleHoming(AxisConfig AC)
{
   //Fast homing
   exec.AddStatusmessage( "- Fast Homing " + AC.AxisName + " Axis -");
   //set proximity as home sensor
   setFieldValue(AC.ProximityPin);
   setFieldValue(AC.ProximityPort);
   //set fast feedrates
   setFieldValue(AC.FastHomingUp);
   setFieldValue(AC.FastHomingDown);
   //Applysettings
   exec.Callbutton(ApplysettingsButton);
   //home axis
   exec.Callbutton(AC.HomingButton);
   while(exec.IsMoving()){}
   
   //Slow homing
   exec.AddStatusmessage( "- Slow Homing " + AC.AxisName + " Axis -");
   //set precision switch as home sensor
   setFieldValue(AC.MicroPin);
   setFieldValue(AC.MicroPort);
   //set slow feedrates
   setFieldValue(AC.SlowHomingUp);
   setFieldValue(AC.SlowHomingDown);
   //Applysettings
   exec.Callbutton(ApplysettingsButton);
   //home axis
   exec.Callbutton(AC.HomingButton);
   while(exec.IsMoving()){}
}

void setFieldValue(Setting s){
   AS3.Setfield(s.Value, s.ScreenField);
   AS3.Validatefield(s.ScreenField);
}


Wow, thank you!
At the moment the machine is in the developing stage, but be sure that your help is truly appreciated and I'm going to test it!

This is my first machine, so I have lots of questions and doubts.

In the meantime I made the sensors holder....