Netcat: Send TCP binarry files for control KMtronic RS485 Relay

 

 

Netcat (often abbreviated to nc) is a computer networking utility for reading from and writing to network connections using TCP or UDP.

 

BAT file for generate BIN files

@echo off
echo FF0101>on.txt
certutil -decodehex on.txt on.bin@echo off
echo FF0100>off.txt
certutil -decodehex off.txt off.bin

 

D:\Rabotna\Socat>nc -w 1 192.168.1.199 12345 < on.bin
D:\Rabotna\Socat>nc -w 1 192.168.1.199 12345 < off.bin

 

 

KMtronic LAN TCP/IP to RS485 Serial Converter

 

 

 

 

 

 

Testing Heatmiser EDGE ModBus Thermostat with ModbusMAT freeware program

 

Heatmiser EDGE ModBus Thermostat
Heatmiser EDGE ModBus Thermostat

 

Protocol:
EDGE SERIES MODBUS COMMUNICATION PROTOCOL V1.8

Communication protocol:
1. UART Baud Rate: 9600
2. UART Parity: None
3. Communications ID Rang:0-32 ,255

Heatmiser EDGE
The Heatmiser EDGE is 230v powered Thermostat that is compatible with the Heatmiser wireless air sensor and wireless door/window switch. The wireless air sensor function is perfect for those looking to measure the temperature in another location and for those with larger open plan properties, multiple air sensors can be used to create an average temperature.

The Heatmiser EDGE can be set to work as a non programmable, 5/2 day, 7 day or 24 hour programmable thermostat.

230V Powered
Wireless Air Sensor Function
Modbus Network Function

 

Testing Heatmiser EDGE ModBus Thermostat with ModbusMAT freeware program and KMtronic USB<>RS485 adapter
Testing Heatmiser EDGE ModBus Thermostat with ModbusMAT freeware program and KMtronic USB<>RS485 adapter

 

Testing Heatmiser EDGE ModBus Thermostat with ModbusMAT freeware program and KMtronic USB<>RS485 adapter
Testing Heatmiser EDGE ModBus Thermostat with ModbusMAT freeware program and KMtronic USB<>RS485 adapter

 

Testing Heatmiser EDGE ModBus Thermostat with ModbusMAT freeware program and KMtronic USB<>RS485 adapter
Testing Heatmiser EDGE ModBus Thermostat with ModbusMAT freeware program and KMtronic USB<>RS485 adapter

 

Testing Heatmiser EDGE ModBus Thermostat with ModbusMAT freeware program and KMtronic USB<>RS485 adapter
Testing Heatmiser EDGE ModBus Thermostat with ModbusMAT freeware program and KMtronic USB<>RS485 adapter

 

ModbusMAT freeware ModBus program

 

ESP8266: Yet Another Arduino Wiegand Library

 

Yet Another Arduino Wiegand Library

 

 

#define PIN_D0 D1
#define PIN_D1 D2

// The object that handles the wiegand protocol
Wiegand wiegand;

// Initialize Wiegand reader
void setup() {
Serial.begin(9600);
delay(1);
Serial.println("Start...");

//Install listeners and initialize Wiegand reader
wiegand.onReceive(receivedData, "Card readed: ");
wiegand.onStateChange(stateChanged, "State changed: ");
wiegand.begin(WIEGAND_LENGTH_AUTO);

//initialize pins as INPUT
pinMode(PIN_D0, INPUT);
pinMode(PIN_D1, INPUT);
}

// Continuously checks for pending messages and polls updates from the wiegand inputs
void loop() {
// Checks for pending messages 
//Serial.println("Start2 ..");
wiegand.flush();

// Check for changes on the the wiegand input pins
wiegand.setPin0State(digitalRead(PIN_D0));
wiegand.setPin1State(digitalRead(PIN_D1));
}

// Notifies when a reader has been connected or disconnected.
// Instead of a message, the seconds parameter can be anything you want -- Whatever you specify on `wiegand.onStateChange()`
void stateChanged(bool plugged, const char* message) {
Serial.print(message);
Serial.println(plugged ? "CONNECTED" : "DISCONNECTED");
}

// Notifies when a card was read.
// Instead of a message, the seconds parameter can be anything you want -- Whatever you specify on `wiegand.onReceive()`
void receivedData(uint8_t* data, uint8_t bits, const char* message) {
Serial.print(message);

//Print value in HEX
uint8_t bytes = (bits+7)/8;
for (int i=0; i<bytes; i++) {
Serial.print(data[i] >> 4, 16);
Serial.print(data[i] & 0xF, 16);
}
Serial.println();
}

 

Test KMtronic LAN TCP/IP to RS485 Serial Converter

 

KMtronic LAN TCP/IP to RS485 Serial Converter
KMtronic LAN TCP/IP to RS485 Serial Converter

 

Default:
IP address: 192.168.1.199
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1
Default RS485 Bringe Port – 12345
Username: admin
Password: admin

Ethernet Communication:
TCP/IP
Bringe Port – 12345

RS485 Serial Port Communication:
RS-485 Sugnals –    A(Data+), B(Data-), GND
Baudrate –  1200, 2400, 4800, 9600, 19200,
38400, 57600 and 115200 bits per second.
Parity Check: None, Even, Odd
Data bits: 8
Stop bits: 1, 2

Reset to Default Settings:
Hold Reset button for 10 seconds

 

Testing KMtronic LAN TCP/IP to RS485 Serial Converter
Test KMtronic LAN TCP/IP to RS485 Serial Converter
Testing KMtronic LAN TCP/IP to RS485 Serial Converter
Test KMtronic LAN TCP/IP to RS485 Serial Converter

 

Testing KMtronic LAN TCP/IP to RS485 Serial Converter
Test KMtronic LAN TCP/IP to RS485 Serial Converter

 

NEW Product: LAN TCP/IP to RS485 Serial Converter

 

KMtronic LAN TCP/IP to RS485 Serial Converter

 

Sending “Hello” to RS485 via USB<>RS485 adapter

KMtronic LAN TCP/IP to RS485 Serial Converter
KMtronic LAN TCP/IP to RS485 Serial Converter: Sending “Hello” to RS485 via USB<>RS485 adapter

 

Receiving data using PuTTY Telnet connected to
IP:192.168.1.199
PORT:12345

KMtronic LAN TCP/IP to RS485 Serial Converter
KMtronic LAN TCP/IP to RS485 Serial Converter: Receiving data using PuTTY Telnet

 

KMtronic LAN TCP/IP to RS485 Serial Converter: Receiving data using TCP Client Server software
KMtronic LAN TCP/IP to RS485 Serial Converter: Receiving data using TCP Client Server software

 

PHP test file

<?php

error_reporting(E_ALL);

echo "<h2>TCP/IP Connection</h2>\n";

/* Get the port for the WWW service. */
$service_port = 12345;

/* Get the IP address for the target host. */
$address = '192.168.1.199';

/* Create a TCP/IP socket. */
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket === false) {
echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
} else {
echo "OK.\n";
}

echo "Attempting to connect to '$address' on port '$service_port'...";
$result = socket_connect($socket, $address, $service_port);
if ($result === false) {
echo "socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($socket)) . "\n";
} else {
echo "OK.\n";
}

$in = "Hello from PHP";
$out = '';

echo "Sending HTTP HEAD request...";
socket_write($socket, $in, strlen($in));
echo "OK.\n";

//echo "Reading response:\n\n";
//while ($out = socket_read($socket, 2048)) {
// echo $out;
//}

echo "Closing socket...";
socket_close($socket);
echo "OK.\n\n";

?>