LAN DS18B20 WEB Temperature Monitor 1 meter Cable
www.WEB-Relays.com
www.Facebook.com/KMtronic

Controlling KMtronic UART 8 Relay board by Raspberry Pi

Spread the love

 

http://info.kmtronic.com/controlling-uart-8-relay-board-by-raspberry-pi.html

 

 

 

Needed 
1 RaspberryPI
1 KMTronic UART Board
2 cables for connect to GPIO on Raspberry PI
12 volt power
recommend install Raspbian

Set speed USB port

stty -F /dev/ttyAMA0 9600

 

Shell script to control relays

echo -e “\xFF\x01\x01″ > /dev/ttyAMA0
echo -e “\xFF\x01\x00″ > /dev/ttyAMA0
echo -e “\xFF\x02\x01″ > /dev/ttyAMA0
echo -e “\xFF\x02\x00″ > /dev/ttyAMA0
echo -e “\xFF\x03\x01″ > /dev/ttyAMA0
echo -e “\xFF\x03\x00″ > /dev/ttyAMA0
echo -e “\xFF\x04\x01″ > /dev/ttyAMA0
echo -e “\xFF\x04\x00″ > /dev/ttyAMA0
echo -e “\xFF\x05\x01″ > /dev/ttyAMA0
echo -e “\xFF\x05\x00″ > /dev/ttyAMA0
echo -e “\xFF\x06\x01″ > /dev/ttyAMA0
echo -e “\xFF\x06\x00″ > /dev/ttyAMA0
echo -e “\xFF\x07\x01″ > /dev/ttyAMA0
echo -e “\xFF\x07\x00″ > /dev/ttyAMA0
echo -e “\xFF\x08\x01″ > /dev/ttyAMA0
echo -e “\xFF\x08\x00″ > /dev/ttyAMA0

file: usbrelayon.sh 
———————————————————–
#!/bin/bash
# sends on signal to the USB relay
echo -e “\xFF\x01\x01” > /dev/ttyAMA0
———————————————————–

file: usbrelayon.php
———————————————————–
<?php
$str=”\xFF\x01\x01″;
include ‘/var/www/html/automations/commands/phpSerial.php’;
$serial = new PhpSerial;
$serial->deviceSet(“/dev/ttyAMA0”);
$serial->confBaudRate(9600);
$serial->confParity(“none”);
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->confFlowControl(“none”);
$serial->deviceOpen();
$serial->sendMessage($str);
$serial->deviceClose();
?>
———————————————————–
Connect a lamp to KMtronic Relay board and control using Domoticz or other automation software.
Connect a lamp to KMtronic Relay board and control using Domoticz or other automation software.
Connect a lamp to KMtronic Relay board and control using Domoticz or other automation software.
KMtronic LAN WEB 8 Channel Relay board