Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 02:45:29 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  General Mach Discussion
| | |-+  External Button for Auto Tool Zero
Pages: 1 2 3 4 »   Go Down
Print
Author Topic: External Button for Auto Tool Zero  (Read 2187 times)
0 Members and 1 Guest are viewing this topic.
ranchak
Active Member

Offline Offline

Posts: 125


View Profile
« on: May 20, 2010, 10: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?
Logged
Hood
Active Member

Online Online

Posts: 17,345


Carnoustie, Scotland


View Profile
« Reply #1 on: May 21, 2010, 01: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
Logged
Greolt
Global Moderator
*
Offline Offline

Posts: 872


View Profile
« Reply #2 on: May 21, 2010, 01: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, 01:54:45 AM by Greolt » Logged
ranchak
Active Member

Offline Offline

Posts: 125


View Profile
« Reply #3 on: May 23, 2010, 11:35:13 PM »

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.
Logged
Greolt
Global Moderator
*
Offline Offline

Posts: 872


View Profile
« Reply #4 on: May 23, 2010, 11:52:00 PM »

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

* ZeroSwitchInfo.zip (0.84 KB - downloaded 101 times.)
« Last Edit: May 23, 2010, 11:54:59 PM by Greolt » Logged
Hood
Active Member

Online Online

Posts: 17,345


Carnoustie, Scotland


View Profile
« Reply #5 on: May 24, 2010, 06: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
Logged
ranchak
Active Member

Offline Offline

Posts: 125


View Profile
« Reply #6 on: May 25, 2010, 10: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
Logged
Greolt
Global Moderator
*
Offline Offline

Posts: 872


View Profile
« Reply #7 on: May 25, 2010, 03: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.
Logged
ranchak
Active Member

Offline Offline

Posts: 125


View Profile
« Reply #8 on: May 25, 2010, 08: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?
Logged
Greolt
Global Moderator
*
Offline Offline

Posts: 872


View Profile
« Reply #9 on: May 25, 2010, 09: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
Logged
Pages: 1 2 3 4 »   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!