603,379 active members*
3,873 visitors online*
Register for free
Login
Page 18 of 29 8161718192028
Results 341 to 360 of 563
  1. #341
    Join Date
    Feb 2007
    Posts
    138
    I've got one wire going to Pin 11 (and the Mach3 set-up is mapped accordingly)... the other wire goes to ground.

    When I short the two wires together, the "LED" on the screen shows that the circuit is closed.... when I added the printed circuit board touchpad to the end of one wire, and the alligator clip for the router bit to the other wire... it still works, but only when I close the circuit by touching the alligator clip to the touchpad.

    If I clip the alligator clip onto the router bit, and let the machine close the circuit.... it just twitches a bit, and then tells me that the machine is zeroed.

    This makes NO sense... but it is what is happening...

    -Taylor

  2. #342
    Join Date
    Mar 2008
    Posts
    41
    PM me with your phone number and I'll call you. It might be quicker that way.

  3. #343
    Join Date
    Feb 2007
    Posts
    138

    Success!

    I put a small capacitor (50v.... labeled 103K, which makes no sense either) across the Pin 11 and Ground terminals... and VOILA! It works perfectly.

    Apparently, it was picking up some noise... or needed my body capacitance to work fine "hand held" but not work clipped to the router bit.

    I'm a VERY happy camper. No more guessing with pieces of cash register paper under the bits, etc....

    THANKS for a great, informative thread!

    -Taylor

  4. #344
    Join Date
    Mar 2006
    Posts
    65
    Works great for me. thanks to my friend from down under...:wave:

  5. #345
    Join Date
    Feb 2008
    Posts
    106
    I did not need any capacitor or resistor on my setup.. works just with the wire on pin 15.

    I am having issues with auto z axis zero though... tried a couple versions of the code... works find with tool #0 active, but with tool #1 active or tool #2, etc... the movements are very much exaggerated... I swear it's moving the z axis in feet instead of inches. Go back to tool 0 and all is good.

  6. #346
    Join Date
    Feb 2009
    Posts
    19

    A slightly more complete macro

    I modified the macro that's been updated a few times in this thread to be a little more robust.

    It does a few more checks like "Is the spindle running" and forces the probe to be touched to the tool before it will start (to verify the probe is working). I like this better because I can take my time getting to the table (up to a set amount) after I hit the button and the probe starts shortly after I verify it.

    I hope someone finds this useful.

    Code:
    ' Program to automatically zero the Z-axis using a contact plate of known thickness positioned
    ' on top of the X-Y plane at the Z zero position. Cutting tool acts as a probe.
    
    ' Operation steps:
    '	1. Get current state (Feedrate, G90/G91, G0/G1, Plate Thickness, and Starting Point)
    '	2. Check if probe is grounded. Restore state and exit if it is.
    '	3. Check if spindle is running. Give option to abort if it is.
    '	4. Wait for probe to be manually touched to the tool. 
    '		This verifies the probe connection and the tool moves after the number of seconds set in "DelayTime".
    '		If the probe is not activated within the number of seconds set in "VerifyTimeout" the program restores the state and exits.
    '	5. Move probe down at a rate of "ProbeFeed" until "ProbeDist" is reached, set Z-DRO and retract the distance set in "Retract"
    '		If "ProbeDist" is reached before the probe is contacted, the state is restored and the Z-DRO is left unset
    
    ' Last updated: 12/20/09
    ' Author: Christopher Esser (Smokingman). Based on the work done by Greolt
    
    ' Define fixed parameters (Currently in Inches. Set to Metric if needed)
    
    ProbeDist     = "-1.0" 'Set the maximum distance to move the Z-axis before probe touches contact plate.
    ProbeFeed     = "10"   'Set the plunge speed for the probe
    DelayTime     = "1"    'Set the delay time in seconds from probe verify to start of Z-motion
    VerifyTimeout = "10"   'Set timeout to wait for probe verify in seconds
    Retract       = "1"    'Set distance to retract after probe
    
    ' Declare Global Variables
    Dim CurrentFeed
    Dim CurrentAbsInc
    Dim CurrentGmode
    Dim PlateThickness
    Dim StartingPoint
    
    ' Begin the Program
    Call GetState
    Call doProbe
    Call RestoreState
    
    ' Get the Starting states
    Sub GetState()
      CurrentFeed	= GetOemDRO(818)    ' Get the current feedrate to return to later
      CurrentAbsInc	= GetOemLED(48)     ' Get the current G90/G91 state (Abs Coordinate Mode)
      CurrentGmode	= GetOemDRO(819)    ' Get the current G0/G1 state
      PlateThickness = GetUserDRO(1151) ' Read contact plate thickness DRO
      StartingPoint = GetOemDRO(85) - GetOemDRO(832) ' Get starting Z position in work coordinates (Z Machine Coord DRO - Z Fixture Orig Off DRO)
    End Sub
    
    ' Restore the states
    Sub RestoreState()
      Code "F" &CurrentFeed									' Returns to prior feed rate
      If CurrentAbsInc = 0 Then Code "G91" ' If G91 was in effect before then return to it
      If CurrentGMode = 0 Then Code "G0"   ' If G0 was in effect before then return to it
    End Sub
    
    ' Probe routine
    Sub doProbe()
      ' Check to see if the probe is already grounded or faulty
      If isActive(DIGITIZE) Then 	
        MsgBox "Ground fault in probe detected. Fix probe and try again. "
        Exit Sub
      End If
    
      ' Check to see if the spindle is running
      If GetOemLED(11) Then 
        Begin Dialog SindleOn 16,32,180,96,"Spindle Running!"
          OKButton 132,8,40,14
          CancelButton 132,28,40,14
          Text 12,8,120,40,"It appears the spindle is running! Select 'OK' to continue anyway or 'Cancel' to exit."
        End Dialog
        Dim Dlg1 As SindleOn
        Button = Dialog (Dlg1)
        If Button=0 Then
          Code "(Auto Tool Zero Aborted!)"
          Exit Sub
        End If
      End If
      
      ' Verify probe connection and signal start of Z-Motion
      StartTime=Timer
      ProbeVerified=0
      Code "(Touch probe to tool to verify connection)"
      Do Until (Timer-StartTime >= Val(VerifyTimeout))
        If isActive(DIGITIZE) Then 	
          ProbeVerified=1
          Beep ' Signal probe verify
          Exit Do
        End If
      Loop
      
      If (ProbeVerified=0) Then
        Code "(Probe Timeout)"
        MsgBox "Probe verify timed out. Fix Probe and try again"
        Exit Sub
      End If
      
      'Start the actual probe
      Code "G4 P" &DelayTime     ' This delay gives me time to get from computer to hold probe in place
      Code "F" &ProbeFeed        ' Set the probe plunge speed
      Beep                       ' Signal start of Z movement
      Code "G91 G31Z" &ProbeDist ' Probing move using incremental move mode.
      While IsMoving()           ' Wait while it happens
      Wend
    
      ZProbePos = GetVar(2002)   ' Get the axact point the probe was hit
      If (ProbeDist+StartingPoint = ZProbePos) Then ' No contact was made during plunge
        Code "(Probe failed!)"
        Exit Sub
      End If
      Code "G90 G0 Z" &ZProbePos ' Go back to that point. Always a very small amount of overrun.
      While IsMoving ()
      Wend
    
      Call SetOEMDRO (802, PlateThickness) ' Set the Z axis DRO to whatever is set as plate thickness
      Code "G0 Z" & Retract	     ' Retract
      While IsMoving ()
      Wend
      Code "(Z axis is now zeroed)" ' Success!
    End Sub

  7. #347
    Join Date
    Sep 2005
    Posts
    371

    Along that note (sic) - Need a beep code

    I'm not sure where to put Smokingman's code, but I like the idea. I'm struggling with the same type of issue and need something in place to help me when I get "Focus Challenged"! LOL!

    I've been working on the Auto-zeroing Probe with great success. Well, that is, as long as I remember to connect the wire to the touch plate/Center Finder.

    I've failed to connect the wire twice and on both occasions I've ripped the pipe right off the touch plate. Both instances have been due to distractions (kids) right at the integral moment.

    What I need is a snippet of code to put in the *.m1s that forces the computer to Beep. Not the external speakers, but the computer's speaker.


    What I'm trying to do here is have the code stop you from performing a centering function until you have touched the spindle at least once. (This is to let Mach know that you may not have connected the wire to the plate just yet). Once I touch the spindle with the wire/alligator clip, I want the code to resume in ~5 seconds. This will give me enough time to connect the wire to the touch plate and know that it's ready for use.


    I can work on the delay factor later. For now here are the attempts I've made in the probe code to just get some sound:

    If GetOemLed (825) <> 1 Then 'Forces you to make certain the TPGW is connected
    Code "(Touch Probe Ground Wire is not connected)"
    Beep
    End If
    ------Only works on External Speakers - Need the PC's internal Speaker to work ----


    If GetOemLed (825) <> 1 Then 'Forces you to make certain the TPGW is connected
    Code "(Touch Probe Ground Wire is not connected)"
    Beep (500, 1000)
    End If
    ------Only works on External Speakers - Need the PC's internal Speaker to work ----



    I turned on the "Allow Speak" function in General Configuration and tried this:

    If GetOemLed (825) <> 1 Then 'Forces you to make certain the TPGW is connected
    Code "(Touch Probe Ground Wire is not connected)"
    Speak ("Connect the touch probe ground wire")
    End If
    ------Doesn't work/ Don't hear anything ----



    I know that the code "If GetOemLed (825) <> 1 " is to look to see if the LED is not lit, and "<> 0" is to check and see if you're already grounded. That's why I put this in front of the "If GetOemLed (825) <> 0 " portion of the code.

    BTW, This is a cross post on the Mach3 Support Forum. Sorry, need it rather quickly and got the next week off for the holiday's.


    Any help would be appreciated and Merry Christmas to all,

    Vogavt

  8. #348
    Join Date
    Jan 2008
    Posts
    932
    Nice update, I need to change out the code I'm currently using with it (I think it's the blue something screen set it came from). When I switched screensets the new one had that code, and it seems every other time you use the z auto zero it goes down, touches the plate then tries to drive the bit through the plate.... quite annoying.

    I know when I used this base of code before it worked great.

  9. #349
    Join Date
    Feb 2009
    Posts
    19
    Vogavt,
    The code is meant as a button script. If you are using the default mill screen, just select Operator -> Edit button script. This will make all the buttons that can take a script flash. Select the "Auto Tool Zero" button and paste the script into it.

    The delay you are talking about is built into the code I posted. The probe *Must* be touched within 10 seconds (modifiable) after pushing the button. Then it delays 1 second (also modifiable) until the probe moves. This is done with this snippet of code:

    Code:
      ' Verify probe connection and signal start of Z-Motion
      StartTime=Timer ' This gets the current number of seconds since midnight
      ProbeVerified=0
      Code "(Touch probe to tool to verify connection)"
      Do Until (Timer-StartTime >= Val(VerifyTimeout)) 
        If isActive(DIGITIZE) Then 	
          ProbeVerified=1
          Beep ' Signal probe verify
          Exit Do
        End If
      Loop
      
      If (ProbeVerified=0) Then
        Code "(Probe Timeout)"
        MsgBox "Probe verify timed out. Fix Probe and try again"
        Exit Sub
      End If
    As far as beeping the internal speaker goes, I don't think you can. It's a Windows thing. The Beep command tells Windows to do the default beep which will go to your audio device. The only 2 ways I can think of to do it different are:
    1. Get an internal speaker driver for Windows.
    2. Set a buzzer on a relay to an output pin on yout parallel port.


    Both of these are generally bad ideas. The first one is bad because even if you can find an internal speaker driver, it locks the CPU while it's making the sound. Very bad with Mach 3 because of the tightly coupled event timings. The second is bad because it's a lot more work then simply connecting a cheap speaker to a cheap sound card.

    Hope this helps,
    Smokingman

  10. #350
    Join Date
    Feb 2009
    Posts
    19
    Arbo,
    The macro is stored with the screen in the .set file, so if you change screens you also change the macro. I found this the hard way and drove a bit into my table.

    -Smokingman

  11. #351
    Join Date
    Sep 2005
    Posts
    371
    Quote Originally Posted by Smokingman View Post
    I found this the hard way and drove a bit into my table.

    -Smokingman

    Ouch!


    Thanks, I knew how to add/make changes to the button script, but didn't really think about it staying with the particular set. Especially since the *.m1s file that appears to be tied to the probe is the "hiddenscript.m1s". I was assuming that particular file was not related to any one set. Thanks for pointing that out and sorry for the school of hardknocks. Been there, done that.


    Regarding your script above, would I simply paste the snippet at the front of the current script? I guess "prepend" is the correct term.

    I had talked to Arturo Duncan about the relay-buzzer combination some months back. Looks like I'm going to have to get that implemented sooner than I thought. Originally my intent was to use it to tell me when the job was finished.

    I just had another thought. What if the probe circuitry was always connected and showing such during the milling process and if the tool was NOT touching the material, then after a predetermined amount of time the buzzer beeped ? This might be annoying, but if an end mill broke, the buzzer would stay on continuously, signaling that something was wrong. Hmmm....

    Thanks for the quick response!


    Merry Christmas!
    Vogavt

  12. #352
    Join Date
    Feb 2009
    Posts
    19
    Vogavt,
    The piece of code I posted yesterday can't really just be dropped in. It's just an example of how to wait for an event for a specified amount of time. I probably should have written it as a function to make it more portable.
    Like This:
    Code:
    Sub Main()
      If isVerified(5) Then
        MsgBox "The Probe was verified"
      Else
        MsgBox "Probe verify timed out." 
      End If
    End Sub
        
    
    Sub isVerified(ByVal s As Integer) 
      ' This function takes the number of seconds as the argument
      ' and returns a boolean as the result
      Dim StartTime As Double
      Dim ProbeVerified As Boolean
      
      StartTime=Timer 
      ProbeVerified=false
      Do Until (Timer-StartTime >= s) 
        If isActive(DIGITIZE) Then 	
          ProbeVerified=true
           Exit Do
        End If
      Loop
      isVerified = ProbeVerified  
    End Sub
    As far as your idea about detecting when the tool has stopped touching the material for too long. I don't see how that would work. Mainly because your stock and your tool are both grounded (assuming we are talking about milling metal). So there is no electrical potential you can detect.

    I suppose you could read the current draw off your VFD and detect when it's spinning without any load.

    If you want to be notified when a job is done I suppose you could always put a macro on M30 that would energize an output to turn on a buzzer.

    Or better yet, send a message to your phone. I think I might actually do that one.

    -Smokingman

  13. #353
    Join Date
    Sep 2005
    Posts
    371
    Quote Originally Posted by Smokingman View Post
    Mainly because your stock and your tool are both grounded (assuming we are talking about milling metal).
    -Smokingman
    Well, duh.. didn't think that far ahead. LOL!

    Also, regarding your latest post of code, does that simply go at the beginning fo the HiddenScript.m1s?

    Please excuse my ignorance!

    Vogavt

  14. #354
    Join Date
    Feb 2009
    Posts
    19
    Vogavt,
    The code I posted is not complete. It's just an example of how to make a function called "isVerified" that you can place in your macro and call it from your "Main()" sub-routine in order to verify the probe with a settable timeout.

    The easiest way to show you how to use it would be for you to send me what you have and explain exactly what you want it to do. Then I'll send you back the completed macro. Hopefully that will make it clear for you.

    To make good macros requires a bit of programming experience and at least a passing knowledge of Visual Basic. I've been writing computer programs since I was 12 (I'm nearly 40 now). This gives me an advantage when writing macros. I'm really new to CNC and this forum has helped me greatly in that respect, so if I can give something back by helping people write macros; I'm glad to do it.

    -Smokingman

  15. #355
    Join Date
    Dec 2004
    Posts
    1137
    Just a note. I use the original simplier version of this macro and ran into issues with the system ignoring the pause command after the Z DRO gets updates with the probe offset. The syste was jumping right to the retract. To fix this, I had to add the
    While IsMoving() ' Wait while it happens
    Wend
    After the SetOEMDRO call

    FWIW,
    Jay

  16. #356
    Join Date
    Feb 2009
    Posts
    19
    That's interesting because after I switched the original code from using "SetDRO()" to use "SetOEMDRO()" I was able to completely take out the pause and it works perfectly.

    I wonder if computer speed has anything to do with it. I'm using a 2.8GHz Intel Core 2 Duo.

    -Smokingman

  17. #357
    Join Date
    Dec 2004
    Posts
    1137
    I'm using an old P4 Gateway 1.4GHz laptop.

  18. #358
    Join Date
    Feb 2007
    Posts
    138
    Smokingman,

    THANKS for the new, updated code. I thought I had everything working properly... and just now had the Zero function drive a brand new .031 router bit right through my printed circuit board touch pad.....(The same experience as Arbo reports)

    I was going to inquire here on the forum about what to try... but I will swap out your code instead. I'll cross my fingers that this will do the trick. I'd really like to start cutting parts, and quit fiddling around with code......

    -Taylor

  19. #359
    Join Date
    Feb 2007
    Posts
    138
    One Hour Later....

    I entered the new code and SUCCESS!

    The Z Axis and X/Y Centering on a Point now works as it should!

    THANKS for getting me over this hump!

    -Taylor

  20. #360
    Join Date
    Feb 2007
    Posts
    138
    Three days later... I guess I am dumb as a stump... or at least REALLY not understanding how this script is supposed to work.

    It was working perfectly two days ago. I shut down Mach3, and shut down the computer, and it sat unused for two days. Today, I fired everything back up..... and attempted to use the "Auto Zero Axis" setting. I clicked the button... the computer beeped and asked me to touch the pad to the tool. I did.... the Z axis came down and touched the pad, hesitated, and then drove the Z axis DOWNWARD about a quarter of inch. Fortunately, a little voice in my head told me to test the thing with the touch pad held up in the air. If it had been sitting on top of a piece of material, I would have broken another tiny router bit.

    Is there somewhere that I should be SAVING the settings,etc.? I thought when I opened up my "Taylor's Mach 3 Mill" settings that everything should be good to go. I checked the script (Operators > Edit Button.... I'm working from memory but you get the idea...) and the new script was still in place.

    What's going on?

    Thanks!

    -Taylor

Page 18 of 29 8161718192028

Similar Threads

  1. Replies: 1
    Last Post: 03-04-2014, 01:08 AM
  2. Auto tool setter / touch plate ?
    By chrisnis in forum Machines running Mach Software
    Replies: 2
    Last Post: 04-06-2013, 12:24 AM
  3. Tool Setter Macro for M-V60C and Metrol Setter
    By mitshack in forum Mazak, Mitsubishi, Mazatrol
    Replies: 1
    Last Post: 02-02-2013, 12:08 PM
  4. Auto Tool Setter Button IH taylored !
    By Cruiser in forum Charter Oak Automation Support Forum
    Replies: 7
    Last Post: 08-06-2009, 03:25 PM
  5. Tool setter macro for M-V60C and Metrol setter
    By mitshack in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 0
    Last Post: 10-06-2008, 02:38 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •