Hello Guest it is March 09, 2021, 02:11:29 AM

Author Topic: External Button for Auto Tool Zero  (Read 18155 times)

0 Members and 1 Guest are viewing this topic.

External Button for Auto Tool Zero
« on: May 20, 2010, 11:21:45 PM »
I finally got my Auto tool zero function for the z axis working. I used the file posted by Hoss machine, which works great. What I would like to do is have a push button installed on the head of my mill that I can push that would trigger the Auto tool zero function. Can this be done?

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: External Button for Auto Tool Zero
« Reply #1 on: May 21, 2010, 02:25:58 AM »
Yes but at this point in time you will really need to use the MachMad plugin from ScottSchaefer, in Rev 4 of Mach it will hopefully  be natively supported.
Hood

Offline Greolt

*
  •  956 956
    • View Profile
Re: External Button for Auto Tool Zero
« Reply #2 on: May 21, 2010, 02:34:46 AM »
I did this for someone who wanted the Z zero macro triggered by an external switch.

It was a while ago and there may be easier ways to do it by now.

I used a combination of a macro pump and a brain.

The macro pump polled the switch to see when it was pressed.

The brain did some safety interlocks and a time delay to avoid accidental activation.

Greg

EDIT:  Sorry I was going by memory and got it wrong.  (it was a couple of years ago)

The brain polls the input (switch) and does the safety interlocks and delay.  Then sets a user LED.

The macro pump just calls the macro when the user LED is active. Because a brain can not directly call the macro.
« Last Edit: May 21, 2010, 02:54:45 AM by Greolt »
Re: External Button for Auto Tool Zero
« Reply #3 on: May 24, 2010, 12:35:13 AM »
Thanks for the replies. Hood, why should I use the plugin from Scott Shaefer? I guess I'll wait until someone else figures out a better way to do this.

Offline Greolt

*
  •  956 956
    • View Profile
Re: External Button for Auto Tool Zero
« Reply #4 on: May 24, 2010, 12:52:00 AM »
Have a look at these two files if interested.

One is a brain that is triggered by making input 4 active (press a momentary switch)

If, the switch is held for two seconds and the spindle is inactive and no axis movement is happening, then a user LED is activated.

Have a look at the brain in the brain editor.

The other is a macropump.  This will call your auto tool zero script from the macro folder when the user LED is activated.

You can check this macropump script out in any text editor.

The reason there are the two parts to make this work is,

The brain takes care of the two second safety delay and the other interlocks but can not call a macro.

So the macropump is used to monitor the user LED and call the macro.

As I said there may be more elegant ways to do this but it works.   Having a look at it may give you some ideas.

Greg
« Last Edit: May 24, 2010, 12:54:59 AM by Greolt »

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: External Button for Auto Tool Zero
« Reply #5 on: May 24, 2010, 07:43:09 AM »
Hood, why should I use the plugin from Scott Shaefer?

Not saying you should, it is the route I have taken and it works very well and for $10 its well worth it in my opinion. You can however do it the way Greg has said which is very similar to using the plugin in its method,  or wait until Rev 4 comes out as hopefully it will support a less clunky method of doing this.

Hood
Re: External Button for Auto Tool Zero
« Reply #6 on: May 25, 2010, 11:02:31 AM »
Hi Greg, I tried to open your files, but the Quicktime file will not open. I did open the BRN file, but I couldn't make anything of it. This is exactly what I would like to be able to do with my machine. How do I go about setting this up? Do I install your file in my Mach 3 folder? What does "LED" stand for? Thanks, Ron

Offline Greolt

*
  •  956 956
    • View Profile
Re: External Button for Auto Tool Zero
« Reply #7 on: May 25, 2010, 04:47:54 PM »
I hunted down an old post and it is copied below,

Greg


There are two components in the attached zip folder.

Macropump.m1s and ZeroSwitch.brn

For an external switch to trigger the zero routine, I also place the "Macropump.m1s" in the macro folder, and the "ZeroSwitch.brn" goes in the brain folder.

The zero script also needs to be in the macro folder.  I called it M615

Macropump is then enabled on the "General Config" page. Brain is enabled via Operator / Brain Control. A Mach restart is needed for both of these to work.

Then you can open, Operator / Brain Control / View Brain, and see the brain operate.

My external switch is connected to a spare input pin and assigned to "Input#4" in "Ports and Pins". Set to become active when switch is pressed.

The brain contains a switch delay as a safety feature. I have it set so the switch must be pressed for two seconds before it triggers.

For this reason I have removed a delay that was previously coded into the zero routine. Two delays built in was confusing for an operator.

Also the brain locks out if the spindle is running or machine is moving.

The macropump simply sets the M615.m1s going. It has a lock out thingy built in to stop Mach trying to run the script multiple times.

Now you will ask "Why both a brain and a macropump?"... "Either one or the other should do it"

A brain can not trigger a macro, so a brain alone won't do what I need.

Mach does not like delays coded into a macropump because of timing issues. It can be done but is much more complex.

The brain makes the switch delay a no brainer. Pun intended.

Also the other safety lock outs are really easy to do in a brain.
Re: External Button for Auto Tool Zero
« Reply #8 on: May 25, 2010, 09:02:17 PM »
I got my push button wired to input pin #11 on my BOB.

I assigned Input #4 to pin #11.

 I copied the file Macropump.m1s in the macro folder.

I enabled "macropump" in the General Config screen.

I installed the ZeroSwitch.brn file in the brain folder.

I enabled  the loaded brains.

I also copied this file to the macro folder.

I renamed it M615.m1s.

I restarted Mach3.

My problem is when I push the external button I get an error message "Scripter Compile Error. In:M615.mis. Where did I go wrong?

Offline Greolt

*
  •  956 956
    • View Profile
Re: External Button for Auto Tool Zero
« Reply #9 on: May 25, 2010, 10:10:07 PM »

I also copied this file to the macro folder.

I renamed it M615.m1s.


I presume you mean your zero script. That is what is now in the macro folder and named M615.  Right?   Must be a problem with it.

Post it and I will take a look.

Greg