Controlling UART 8 Relay board by Raspberry Pi

 
 
 
Needed 
1 RaspberryPI
1 KMTronic UART Board
2 cables for connect to GPIO on Raspberry PI
12 volt power
recommend install Raspbian
 
 
Connect GPIO 14 (TXD) to  RX on Board

Connect GROUND to + on Board

 
 
 
 

 

 

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

 

 

Download UART shell script - DOWNLOAD

 

 

 

 

 

Read 4294 times