KMtronic USB relays from Mach3 - step by step

 

 

Configure MACH3 CNC software and KMTronic USB relays

 

 

1. Connect USB relay to PC and instal the drivers.

     For 1,2 and 4 channels relay boards:

http://www.info.kmtronic.com/ftdi-virtual-com-port-drivers-installation.html

     For 8 channels relay board:

http://www.info.kmtronic.com/usb-8-relay-box-drivers-instalation.html

 

2. Check COM port number in Device Manager.

 


3. Download DLL and place it in your Mach3 install folder (usually C:\Mach3)

http://www.info.kmtronic.com/software/Mach3/KMtronicDLL.zip

 

 

 

4. Run MACH3 and go to Operator>VB Script Editor

 

 

 

Command's format:
a = Relay(5,1,"ON")  - where "5" is USB COM port, "1" is relay number, "ON" is command, which turns ON the relay number 1 connected to COM5
a = Relay(5,1,"OFF")  - where "5" is USB COM port, "1" is relay number, "OFF" is command, which turns OFF the  relay number 1 connected to COM5

 

Put next script and pres Run Script buttton:

Declare Function Relay Lib "KMSerial.dll" (ByVal comPort As Integer,ByVal numberRelay As Integer,ByVal command As String) As Boolean
e = Relay(5,1,"ON")

Relay must turn ON

 

5. Download M3, M5 and TEST G-Code file from:

http://www.info.kmtronic.com/software/Mach3/KMtronic_Mach3.zip

 

m3.m1s

DoSpinCW()
Declare Function Relay Lib "KMSerial.dll" (ByVal comPort As Integer,ByVal numberRelay As Integer,ByVal command As String) As Boolean     
If(IsMoving () ) Then
e = Relay(5,1,"ON")
End If

 

m5.m1s

DoSpinCW()
Declare Function Relay Lib "KMSerial.dll" (ByVal comPort As Integer,ByVal numberRelay As Integer,ByVal command As String) As Boolean     
If(IsMoving () ) Then
e = Relay(5,1,"OFF")
End If

 

Put m3.m1s and m5.m1s  in "C:\Mach3\macros\Mach3Mill"

 

test.tap

M3
G01 X10
M5
X0

 

Put test.tap  in "C:\Mach3\GCode"

 

 

6. Run "test.tap" file

 

Relay must turn ON, CNC go to X10 position, relay must turn OFF and CNC go back to X0

 

 

 

 

Read 7804 times