How to set up a touch plate for auto-zero of the Z-axis in Mach3
The idea is to use the cutter itself and a soft conductive plate as a switch that triggers the probe input on Mach3. The touch plate is connected to a parallel port input pin that is pulled up to +5V with a 10k resistor (see part of schematic below for an example) and the ground is connected to an alligator clip. The ground is clipped onto the cutter bit and the touch plate is held on the work surface. Clicking the Auto Tool Zero button runs the Visual Basic code that lowers the cutter until it gets a signal from the probe input, sets the Z-axis readout to the thickness of the touch plate (.060" in my case) then raises the cutter to 1 inch above the surface.
For the touch plate, I used .060" thick PCB material. This is inexpensive and can be gotten from many sources. I recommend looking on ebay and searching for copper clad board.
Here is a demonstration of the
setup in action.
First we set up the input pin for the probe. We need to have it configured to the proper pin with an active low input since it is normally pulled up to 5VDC.
Then we need to add the Visual Basic code to the button. We go to the Operator menu then click on Edit Button Script. The configurable buttons will now be flashing and we click on the Auto Tool Zero button. This will bring up an editor that may have a Not Implemented message in it. Copy the code below into this editor replacing any existing code. You will want to modify the .060 value to match the thickness of your touch plate. Save the file (same name) and exit the editor then restart Mach3. You should now be able to press the Auto Tool Zero button and have the Z-axis lower until the touch plate connection is made. I suggest that you try touching the alligator clip and plate together the first few times with the Z-axis nohwere near the table to make sure that this is working.
|Message( "Auto Zeroing..." )
If IsSuchSignal (22) Then
code "G31 Z-3 F20"
Call SetDRO( 2, .060 )
code "G1 Z1"
Additional Electronics Added to my DIY CNC Router
Here is a schematic of the additional circuitry that I added. This started off by wanting to turn the router and vacuum on and off with Mach3. I got that part connected but then realized that the computer puts the printer port into an unpredictable state when Mach3 isn't running. It is quite surprising to have the router and vacuum come on after Mach3 is closed. I then found that Mach3 could output a square wave when it is running that can be used as a safety. The charge pump circuit only activates the relay when the square wave signal is present at the output pin and it doesn't matter what state the pin is changed to as long as it doesn't oscillate rapidly.
Here is the parts list for the above schematic. If you already have 12VDC available, you can eliminate U1 and C4. If you have 5VDC, you can eliminate D4 and D5 then connect R2 and R5 to 5VDC. If you're running a HobbyCNC Pro (like I am), I suggest getting the low-current DC power input from the 24VDC fan connection so you don't risk going over the input voltage range of the 12V regulator.
|IRL510PBF N-Ch Mosfet
|.1uF Capacitor 50V||399-4264-ND|
|.01uF Capacitor 100V||399-4147-ND|
|.001uF Capacitor 100V||399-4144-ND|
|10k Resistor 1/4W||10KQBK-ND|
|1Meg Resistor 1/4W||1.0MQBK-ND|
|BAT41 Schottky Diode||497-2493-1-ND|
|12A DPDT Relay 5V coil
|SL22 5R012 12A Inrush Current Lim.||570-1053-ND|
|Terminal Blocks .2" Spacing||ED2609-ND|
|(These are cheap and fit into .1" perfboard spacing)|
|Alligator Clip for Touch Plate Gnd||314-1034-ND|
|25A @ 480VAC Solid State Relay||17155 RL
|E-stop Switch||17054 SW|