Control KMtronic USB relays using Command Prompt BIN files
Written by Super User
Example file for COM Port 1 (COM1)
@echo off
cls
echo "--------------------------------------"
echo " KMtronic USB One Relay "
echo " example "
echo " "
echo " "
echo " "
echo " ON Command : 0xFF, 0x01, 0x01 "
echo " "
echo " OFF Command : 0xFF, 0x01, 0x00 "
echo " "
echo "--------------------------------------"
echo FF0100>off.txt
echo FF0101>on.txt
certutil -decodehex off.txt off.bin
certutil -decodehex on.txt on.bin
MODE COM1:9600,n,8,1
copy on.bin \\.\com1 /b
echo " Relay is ON"
copy off.bin \\.\com1 /b
echo " Relay is OFF"
del on.bin
del off.bin
del on.txt
del off.txt
Download
www.info.kmtronic.com/software/USB_Relays/KMtronic_USB_Relay_Command_Prompt.zip
RF 433MHz Relays commands
ON Command | OFF Command | ||||||
DEC | HEX | DEC | HEX | ||||
Relay Board ID:01 | Relay 1 | Channel 1 | 255 1 1 | FF 01 01 | 255 1 0 | FF 01 00 | |
Relay 2 | Channel 2 | 255 2 1 | FF 02 01 | 255 2 0 | FF 02 00 | ||
Relay 3 | Channel 3 | 255 3 1 | FF 03 01 | 255 3 0 | FF 03 00 | ||
Relay 4 | Channel 4 | 255 4 1 | FF 04 01 | 255 4 0 | FF 04 00 | ||
Relay 5 | Channel 5 | 255 5 1 | FF 05 01 | 255 5 0 | FF 05 00 | ||
Relay 6 | Channel 6 | 255 6 1 | FF 06 01 | 255 6 0 | FF 06 00 | ||
Relay 7 | Channel 7 | 255 7 1 | FF 07 01 | 255 7 0 | FF 07 00 | ||
Relay 8 | Channel 8 | 255 8 1 | FF 08 01 | 255 8 0 | FF 08 00 | ||
Relay Board ID:02 | Relay 1 | Channel 9 | 255 9 1 | FF 09 01 | 255 9 0 | FF 09 00 | |
Relay 2 | Channel 10 | 255 10 1 | FF 0A 01 | 255 10 0 | FF 0A 00 | ||
Relay 3 | Channel 11 | 255 11 1 | FF 0B 01 | 255 11 0 | FF 0B 00 | ||
Relay 4 | Channel 12 | 255 12 1 | FF 0C 01 | 255 12 0 | FF 0C 00 | ||
Relay 5 | Channel 13 | 255 13 1 | FF 0D 01 | 255 13 0 | FF 0D 00 | ||
Relay 6 | Channel 14 | 255 14 1 | FF 0E 01 | 255 14 0 | FF 0E 00 | ||
Relay 7 | Channel 15 | 255 15 1 | FF 0F 01 | 255 15 0 | FF 0F 00 | ||
Relay 8 | Channel 16 | 255 16 1 | FF 10 01 | 255 16 0 | FF 10 00 | ||
Relay Board ID:03 | Relay 1 | Channel 17 | 255 17 1 | FF 11 01 | 255 17 0 | FF 11 00 | |
Relay 2 | Channel 18 | 255 18 1 | FF 12 01 | 255 18 0 | FF 12 00 | ||
Relay 3 | Channel 19 | 255 19 1 | FF 13 01 | 255 19 0 | FF 13 00 | ||
Relay 4 | Channel 20 | 255 20 1 | FF 14 01 | 255 20 0 | FF 14 00 | ||
Relay 5 | Channel 21 | 255 21 1 | FF 15 01 | 255 21 0 | FF 15 00 | ||
Relay 6 | Channel 22 | 255 22 1 | FF 16 01 | 255 22 0 | FF 16 00 | ||
Relay 7 | Channel 23 | 255 23 1 | FF 17 01 | 255 23 0 | FF 17 00 | ||
Relay 8 | Channel 24 | 255 24 1 | FF 18 01 | 255 24 0 | FF 18 00 | ||
Relay Board ID:04 | Relay 1 | Channel 25 | 255 25 1 | FF 19 01 | 255 25 0 | FF 19 00 | |
Relay 2 | Channel 26 | 255 26 1 | FF 1A 01 | 255 26 0 | FF 1A 00 | ||
Relay 3 | Channel 27 | 255 27 1 | FF 1B 01 | 255 27 0 | FF 1B 00 | ||
Relay 4 | Channel 28 | 255 28 1 | FF 1C 01 | 255 28 0 | FF 1C 00 | ||
Relay 5 | Channel 29 | 255 29 1 | FF 1D 01 | 255 29 0 | FF 1D 00 | ||
Relay 6 | Channel 30 | 255 30 1 | FF 1E 01 | 255 30 0 | FF 1E 00 | ||
Relay 7 | Channel 31 | 255 31 1 | FF 1F 01 | 255 31 0 | FF 1F 00 | ||
Relay 8 | Channel 32 | 255 32 1 | FF 20 01 | 255 32 0 | FF 20 00 | ||
Relay Board ID:05 | Relay 1 | Channel 33 | 255 33 1 | FF 21 01 | 255 33 0 | FF 21 00 | |
Relay 2 | Channel 34 | 255 34 1 | FF 22 01 | 255 34 0 | FF 22 00 | ||
Relay 3 | Channel 35 | 255 35 1 | FF 23 01 | 255 35 0 | FF 23 00 | ||
Relay 4 | Channel 36 | 255 36 1 | FF 24 01 | 255 36 0 | FF 24 00 | ||
Relay 5 | Channel 37 | 255 37 1 | FF 25 01 | 255 37 0 | FF 25 00 | ||
Relay 6 | Channel 38 | 255 38 1 | FF 26 01 | 255 38 0 | FF 26 00 | ||
Relay 7 | Channel 39 | 255 39 1 | FF 27 01 | 255 39 0 | FF 27 00 | ||
Relay Board ID:06 | Relay 8 | Channel 40 | 255 40 1 | FF 28 01 | 255 40 0 | FF 28 00 | |
Relay 1 | Channel 41 | 255 41 1 | FF 29 01 | 255 41 0 | FF 29 00 | ||
Relay 2 | Channel 42 | 255 42 1 | FF 2A 01 | 255 42 0 | FF 2A 00 | ||
Relay 3 | Channel 43 | 255 43 1 | FF 2B 01 | 255 43 0 | FF 2B 00 | ||
Relay 4 | Channel 44 | 255 44 1 | FF 2C 01 | 255 44 0 | FF 2C 00 | ||
Relay 5 | Channel 45 | 255 45 1 | FF 2D 01 | 255 45 0 | FF 2D 00 | ||
Relay 6 | Channel 46 | 255 46 1 | FF 2E 01 | 255 46 0 | FF 2E 00 | ||
Relay 7 | Channel 47 | 255 47 1 | FF 2F 01 | 255 47 0 | FF 2F 00 | ||
Relay 8 | Channel 48 | 255 48 1 | FF 30 01 | 255 48 0 | FF 30 00 |
Binary Commands
Relay Board ID:01 FF B1 xx
FF B1 xx - Set the status of the relays in HEX format where (xx) is the last byte corresponding for each relay.
For example:
FF B1 FF – All relay ON
FF B1 00 – All relay OFF
FF B1 10 – only (5) relay ON all others OFF and so on….
> FF B1 xx xx xx xx xx xx xx xx - Reply from relay where xx is status: 01 - Relay is ON, 00 - Relay is OFF
First byte is status first relay, Eight byte is status eight relay..
Relay Board ID:02 FF B2 xx
Relay Board ID:03 FF B3 xx
Relay Board ID:04 FF B4 xx
Relay Board ID:05 FF B5 xx
Relay Board ID:06 FF B6 xx
Status read commands
Relay Board ID:01
FF A1 00 - Status request command
> FF A1 xx xx xx xx xx xx xx xx - Reply from relay where xx is status: 01 - Relay is ON, 00 - Relay is OFF
First byte is status first relay, Eight byte is status eight relay
Relay Board ID:02
FF A2 00 - Status request command
> FF A2 xx xx xx xx xx xx xx xx - Reply from relay where xx is status: 01 - Relay is ON, 00 - Relay is OFF
First byte is status first relay, Eight byte is status eight relay
Relay Board ID:03
FF A3 00 - Status request command
> FF A3 xx xx xx xx xx xx xx xx - Reply from relay where xx is status: 01 - Relay is ON, 00 - Relay is OFF
First byte is status first relay, Eight byte is status eight relay
Relay Board ID:04
FF A4 00 - Status request command
> FF A4 xx xx xx xx xx xx xx xx - Reply from relay where xx is status: 01 - Relay is ON, 00 - Relay is OFF
First byte is status first relay, Eight byte is status eight relay
Relay Board ID:05
FF A5 00 - Status request command
> FF A5 xx xx xx xx xx xx xx xx - Reply from relay where xx is status: 01 - Relay is ON, 00 - Relay is OFF
First byte is status first relay, Eight byte is status eight relay
Relay Board ID:06
FF A6 00 - Status request command
> FF A6 xx xx xx xx xx xx xx xx - Reply from relay where xx is status: 01 - Relay is ON, 00 - Relay is OFF
First byte is status first relay, Eight byte is status eight relay
Dip Switch (Address) Calculators
http://www.sabretechnology.co.uk/downloads/dipcalc.swf
http://www.chauvetlighting.com/chauvet-dip-switch-calculator/
http://www.thedmxwiki.com/dmx_definitions/dip_switches
http://www.xledlighting.co.uk/led-technology/dmx-dip-switch-calculator/
Modbus RS485 RTU Serial to Modbus LAN TCP/IP Module Converter
Written by Super User
Manufacturer:
KMtronic LTD
Features:
- Converts Modbus RS485 RTU into Modbus TCP/IP over Ethernet
- Connect up to 32 Modbus RS485 devices to an Ethernet network
Applications:
- Monitoring (logging) photovoltaic systems and wind power turbines
- Monitoring (logging) of energy consumption
Supply:
Requires external 12 volt DC / 600mA power supply
Operation Range:
Industrial (0°C to +80°C)
Dimensions:
110 mm / 55 mm / 25 mm (connectors mounted)
Ethernet Communication:
Protocol - MODBUS TCP
TCP Port - 502
Serial RS485 Communication:
Protocol - MODBUS RTU
RS-485 Sugnals - A(Data+), B(Data-), GND
Baudrate - 1200 bps to 115.2 Kbps
Default:
IP address: 192.168.1.199
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1
Username: admin
Password: admin
Reset to Default Settings:
Hold Reset button for 10 seconds
Manufacturer:
KMTronic LTD
Features:
- Each relay has an LED to indicate when it is operated.
- Relay outputs can be used to turn ON/OFF lights, motors and other devices.
Specifications:
Relays have Normally Open (NO) and
Normally Closed (NC) Contacts each capable of switching max:
- 12VDC/15A
- 24VDC/15A
- 125VAC/15A
- 250VAC/10A
Supply:
Requires external 12 volt DC / 500mA power supply
Operation Range:
Industrial (0°C to +80°C)
Dimensions:
110 mm / 55 mm / 25 mm(connectors mounted)
Default:
IP address: 192.168.1.199
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1
UDP Port: 12345
UDP Commands:
FF0000 - Status Read command
FF0100 - Relay 1 OFF command
FF0101 - Relay 1 ON command
FF0200 - Relay 2 OFF command
FF0201 - Relay 2 ON command
FFE000 - All relays OFF command
FFE003 - All relays ON command
UDP Test Software example including source code (C#):
KMTronic UDP Test Software.zip
KMTronic UDP Test Software Source Code.zip
Opto Isolated USB to RS485 FTDI Interface Converter
Written by kmtronic
This opto/galvanic isolated auto transmit converter, features bi-directional serial conversion from USB to RS485 in 2 wire half duplex mode using Virtual Serial COM Port.
The USB-RS485 is a complete, self powered, USB to RS485 Interface working at any baud rate up to 250k baud. It features automatic bus turn-around - any time your not transmitting the module is listening.
Uses the SN75176 tranceiver, so you can have up to 32 devices on the bus.
Manufacturer:
KMtronic LTD
Features:
- Self-powered from USB
- POWER, TX and RX LED indicators
- Automatic Bus Turnaround
USB to serial interface:
FTDI FT232RL Chip
www.ftdichip.com/Products/ICs/FT232R.htm
Power:
Fully powered from USB
Operation Range:
0°C to +80°C
Dimensions:
97 x 54 x 25 mm
Complete includes:
- One USB to RS485 module
RS485 Information:
TX−/RX− or D− as an alternative for A (low for MARK i.e. idle)
TX+/RX+ or D+ as an alternative for B (high for MARK i.e. idle)
Drivers are available to work with the following operating systems:
Windows ALL SYSTEMS,
Linux,
Mac OS X, Mac OS 9, Mac OS 8,
Windows CE.NET (Version 4.2 and greater)
Raspberry PI
Arduino ADK
The drivers listed above are all available to download for free from the FTDI website. Various 3rd Party Drivers are also available for various other operating systems - see the FTDI website for details.
Private Sub CommandButton1_Click()
Dim strTargetFile As String
Dim wb As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
strTargetFile = Cells(2, 1)
Set wb = Workbooks.OpenXML(Filename:=strTargetFile, LoadOption:=xlXmlLoadImportToList)
Application.DisplayAlerts = True
wb.Sheets(1).UsedRange.Copy ThisWorkbook.Sheets("Sheet1").Range("A5")
wb.Close False
Application.ScreenUpdating = True
End Sub
www.KMtronic.com/Software/Temperature/KMtronic-LAN-Temperature-Excel-Example-01.zip
LAN Temperature Monitor Visual Basic XML read example code
Written by kmtronic
Private Sub CommandButton1_Click()
Dim strTargetFile As String
Dim wb As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
strTargetFile = "http://192.168.1.199/status.xml"
Set wb = Workbooks.OpenXML(Filename:=strTargetFile, LoadOption:=xlXmlLoadImportToList)
Application.DisplayAlerts = True
wb.Sheets(1).UsedRange.Copy ThisWorkbook.Sheets("Sheet1").Range("A5")
wb.Close False
Application.ScreenUpdating = True
End Sub
All temperatures
PHP code
<?php
// Loading the XML file
$xml = simplexml_load_file("http://88.87.29.196:8002/status.xml");
echo "<h1>";
foreach($xml->children() as $sensor)
{
echo $sensor->name." <br />";
echo "Temperature : ".$sensor->temp." <br />";
echo "<hr/>";
}
echo "</h1>";
?>
One temperature
PHP code
<?php
// Loading the XML file
$xml = simplexml_load_file("http://88.87.29.196:8002/status.xml");
echo "<h1>";
foreach($xml->children() as $sensor)
{
if ($sensor->name == "Office inside" )
{
echo $sensor->name." <br />";
echo $sensor->temp." <br />";
}
}
echo "</h1>";
?>