Spindel Warm-Up Macro

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Spindel Warm-Up Macro

Postby BigAl » Wed May 03, 2017 8:32 am

Hi there,

has anyone implemented a spindle warm-up macro in UCCNC. I know that it is a basic macro (M3 S### G4 P### and so on). My question is where and when to start this macro. My idea is to place a button on the start screen to invoke the warm-up sequence. But how ca I run the sequence and - if possible - stop the sequence while it's running. The warm-up sequence is also dependent on the actual temperature (spindle, surrounding).

I'm interested how other people have solved this in UCCNC.

Alex
BigAl
 
Posts: 10
Joined: Thu Feb 16, 2017 2:58 pm

Re: Spindel Warm-Up Macro

Postby dezsoe » Wed May 03, 2017 9:54 am

Alex,

In Configuration/Axis setup/Spindle you can configure delays for spin up and spin down. When M3 or M5 is executed in g-code, this delay will be inserted. When g-code is not running, you just press spindle start/stop on the Run screen, there will be no delay. Is this what you need?
dezsoe
 
Posts: 107
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Spindel Warm-Up Macro

Postby Vmax549 » Wed May 03, 2017 1:58 pm

The easiest way is to create a Gcode program that does as you want . Then you can treat it as any other program and start or stop it as you wish. No macro needed that way.

Just a thought(;-) TP
Vmax549
 
Posts: 499
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Spindel Warm-Up Macro

Postby BigAl » Fri May 05, 2017 6:20 am

Hi together,

with spindle warm-up I mean a program that perform e.g. the following sequence:

1. Run spindle with 6000 RPM for 5 minutes
2. Run spindle with 12000 RPM for 5 minutes
3. Run spindle with 18000 RPM for 5 minutes
4. Run spindle with (again) 6000 RPM for 1 minute

It's easy to make a macro that performs this steps. My problem is, that I get no status information about the running macro. The current step I can see by checking the actual speed. But the remaining time is also interesting. I think about writing the value for the remaining time to a variable and show that on the screen. I thought there is eventualy already a solution for this purpose because spindle warm-up is an essential thing for high speed spindles...

Alex
BigAl
 
Posts: 10
Joined: Thu Feb 16, 2017 2:58 pm

Re: Spindel Warm-Up Macro

Postby A_Camera » Fri May 05, 2017 7:48 am

Do you really think it is necessary? I mean if you feel you have a need to warm up the spindle you can just click and start the spindle and stop when you think it is done and ready. I think there is no point in creating a complicated warm-up sequence, but if you feel you need it why not just write a simple G-code manually and run that every time you want to warm it up. You can save that in a macro file and use a button to call that as macro code if you want, or run it directly with the M command from the MDI.
A_Camera
 
Posts: 376
Joined: Tue Sep 20, 2016 11:37 am

Re: Spindel Warm-Up Macro

Postby BigAl » Fri May 05, 2017 9:15 am

Ok, I've done it.

And YES, it's necessary, because I don't like to damage my 1400 Euro spindle.

I added a button to the screen (ID=20000) and a textfield (ID=20000). With the button I can start or interrupt the warm-up procedure. While the warm-up procedure is running the button for warm-up blinks and show me the remaining seconds of the current stage. Now I can leave my workshop while the spindle is warming up and drink a coffee :-)

The screen looks like this:

WarmUp.png
UCCNC-Screen with running warm-up


And the macro looks like this:

Code: Select all
//  Spindle Heat-Up

// stages for warm-up
const int Stages = 4;

double[] Speed = new double[Stages];
int[] Time = new int[Stages];

Speed[0] = 6000;
Time[0] = 300;

Speed[1] = 12000;
Time[1] = 300;

Speed[2] = 18000;
Time[2] = 240;

Speed[3] = 6000;
Time[3] = 60;

// Position for the warm-up procedure
double PosX = 0;
double PosY = 620;
double PosZ = 140;

if (AS3.Getbuttonstate(20000)) // if the warm-up is running already stop it
{
  // switch the state to "off"
  AS3.Switchbutton(false, 20000);
}
else // start heat-up
{
  // machine must be homed
  if(!exec.GetLED(56)||!exec.GetLED(57)||!exec.GetLED(58))
  {
    MessageBox.Show("The machine was not yet homed, home the machine before warm-up!");
    AS3.Setfieldtext("ERROR", 20000);

    // leave the macro
    exec.Stop();
    return;
  }

  // show init info
  AS3.Setfieldtext("INIT", 20000);

  // switch the state to "on"
  AS3.Switchbutton(true, 20000);

  // store the current distance mode
  int DistanceMode = exec.actualmodal;

  // wait until everything is stopped
  while(exec.IsMoving()){}

  // move the Z axis to the warm-up position
  exec.Code("G00 G53 Z"+ PosZ);
  while(exec.IsMoving()){}
  exec.Wait(200);

  // move the X and Y axis to the warm-up position
  exec.Code("G00 G53 X" + PosX +" Y" + PosY);
  while(exec.IsMoving()){}
  exec.Wait(200);

  // restore the original distance mode
  exec.Code("G" + DistanceMode);

  // perform the stages
  int Stage = 0;
  while (Stage < Stages)
  {
    // set the spindle speed
    exec.Code("S" + Speed[Stage]);

    // turn the spindle on
    exec.DospinCW();

    // wait
    int Secs = 0;
    while (Secs < Time[Stage])
    {
      exec.Wait(1000);
      Secs++;
      AS3.Setfieldtext((Time[Stage] - Secs).ToString(), 20000);

      // interrupt the warm-up?
      if (!AS3.Getbuttonstate(20000))
      {
        // stop the spindle
        exec.Stopspin();
        // show interrupt
        AS3.Setfieldtext("", 20000);
        // leave the macro
        exec.Stop();
        return;
      }
    }

    // next Stage
    Stage++;
  }

  // stop the spindle
  exec.Stopspin();

  // switch the state to "off"
  AS3.Switchbutton(false, 20000);
  AS3.Setfieldtext("OK", 20000);
}
BigAl
 
Posts: 10
Joined: Thu Feb 16, 2017 2:58 pm

Re: Spindel Warm-Up Macro

Postby ger21 » Fri May 05, 2017 10:44 am

You could just run this?

S6000
M3
G4 P300000
S12000
G4 P300000
S18000
G4 P300000
S6000
G4 P60000
M5


Personally, I think that 1-2 minutes at 6000-8000 rpm is more than enough, unless the temperature is near freezing.

For 20 years, I've never warmed up our $10,000 spindles, and have not had any issues. Eben if I did warm them up, they'd be cooled back off within 5 minutes.
Do you run this once a day, or every time you use the machine?
Gerry
UCCNC 2017 Screenset - http://www.thecncwoodworker.com/2017.html
ger21
 
Posts: 585
Joined: Sat Sep 03, 2016 2:17 am

Re: Spindel Warm-Up Macro

Postby BigAl » Fri May 05, 2017 7:34 pm

Hi Gerry,

this is an inital thing I will do before I use the machine. The machine is in an unheated area. If outside temperatures are above 20°C I think it's not necessary to run a full warm-up. But when it's cold I think it's better to warm-up the drive prior routing. You don't think so?

Alex
BigAl
 
Posts: 10
Joined: Thu Feb 16, 2017 2:58 pm

Re: Spindel Warm-Up Macro

Postby ger21 » Fri May 05, 2017 9:25 pm

You certainly don't need 16 minutes of warm up time. As I said, 1-2 minutes should be fine. But it's your spindle, and your money.
Gerry
UCCNC 2017 Screenset - http://www.thecncwoodworker.com/2017.html
ger21
 
Posts: 585
Joined: Sat Sep 03, 2016 2:17 am

Re: Spindel Warm-Up Macro

Postby Dan911 » Sat May 06, 2017 2:06 am

BigAl wrote:Ok, I've done it.

And YES, it's necessary, because I don't like to damage my 1400 Euro spindle.

I added a button to the screen (ID=20000) and a textfield (ID=20000). With the button I can start or interrupt the warm-up procedure. While the warm-up procedure is running the button for warm-up blinks and show me the remaining seconds of the current stage. Now I can leave my workshop while the spindle is warming up and drink a coffee :-)

The screen looks like this:

WarmUp.png


And the macro looks like this:

Code: Select all
//  Spindle Heat-Up

// stages for warm-up
const int Stages = 4;

double[] Speed = new double[Stages];
int[] Time = new int[Stages];

Speed[0] = 6000;
Time[0] = 300;

Speed[1] = 12000;
Time[1] = 300;

Speed[2] = 18000;
Time[2] = 240;

Speed[3] = 6000;
Time[3] = 60;

// Position for the warm-up procedure
double PosX = 0;
double PosY = 620;
double PosZ = 140;

if (AS3.Getbuttonstate(20000)) // if the warm-up is running already stop it
{
  // switch the state to "off"
  AS3.Switchbutton(false, 20000);
}
else // start heat-up
{
  // machine must be homed
  if(!exec.GetLED(56)||!exec.GetLED(57)||!exec.GetLED(58))
  {
    MessageBox.Show("The machine was not yet homed, home the machine before warm-up!");
    AS3.Setfieldtext("ERROR", 20000);

    // leave the macro
    exec.Stop();
    return;
  }

  // show init info
  AS3.Setfieldtext("INIT", 20000);

  // switch the state to "on"
  AS3.Switchbutton(true, 20000);

  // store the current distance mode
  int DistanceMode = exec.actualmodal;

  // wait until everything is stopped
  while(exec.IsMoving()){}

  // move the Z axis to the warm-up position
  exec.Code("G00 G53 Z"+ PosZ);
  while(exec.IsMoving()){}
  exec.Wait(200);

  // move the X and Y axis to the warm-up position
  exec.Code("G00 G53 X" + PosX +" Y" + PosY);
  while(exec.IsMoving()){}
  exec.Wait(200);

  // restore the original distance mode
  exec.Code("G" + DistanceMode);

  // perform the stages
  int Stage = 0;
  while (Stage < Stages)
  {
    // set the spindle speed
    exec.Code("S" + Speed[Stage]);

    // turn the spindle on
    exec.DospinCW();

    // wait
    int Secs = 0;
    while (Secs < Time[Stage])
    {
      exec.Wait(1000);
      Secs++;
      AS3.Setfieldtext((Time[Stage] - Secs).ToString(), 20000);

      // interrupt the warm-up?
      if (!AS3.Getbuttonstate(20000))
      {
        // stop the spindle
        exec.Stopspin();
        // show interrupt
        AS3.Setfieldtext("", 20000);
        // leave the macro
        exec.Stop();
        return;
      }
    }

    // next Stage
    Stage++;
  }

  // stop the spindle
  exec.Stopspin();

  // switch the state to "off"
  AS3.Switchbutton(false, 20000);
  AS3.Setfieldtext("OK", 20000);
}



My old AXYZ cnc came with a spindle warm up and I followed with a similar setup you did with Mach3 and now UCCNC. I think AXYZ spindle warm up was 10 min, I did mine setup with 8 min.

Dan
Dan911
 
Posts: 79
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Next

Return to Macros

Who is online

Users browsing this forum: No registered users and 1 guest