Controlling USB 8 Relay board by Raspberry Pi

 
 
Needed 
1 RaspberryPI
1 KMTronic 8 Relay Board
1 USB cable 
12 volt power
recommend install Raspbian
 

 

Raspberrapi automatically recognizes it as ttyACM0

 

 

Set speed USB port

stty -F /dev/ttyACM0 9600

 

 

Shell script to control relays

echo -e "\xFF\x01\x01" > /dev/ttyACM0
echo -e "\xFF\x01\x00" > /dev/ttyACM0

 

echo -e "\xFF\x02\x01" > /dev/ttyACM0
echo -e "\xFF\x02\x00" > /dev/ttyACM0
 
echo -e "\xFF\x03\x01" > /dev/ttyACM0
echo -e "\xFF\x03\x00" > /dev/ttyACM0
 
echo -e "\xFF\x04\x01" > /dev/ttyACM0
echo -e "\xFF\x04\x00" > /dev/ttyACM0
 
echo -e "\xFF\x05\x01" > /dev/ttyACM0
echo -e "\xFF\x05\x00" > /dev/ttyACM0
 
echo -e "\xFF\x06\x01" > /dev/ttyACM0
echo -e "\xFF\x06\x00" > /dev/ttyACM0
 
echo -e "\xFF\x07\x01" > /dev/ttyACM0
echo -e "\xFF\x07\x00" > /dev/ttyACM0
 
echo -e "\xFF\x08\x01" > /dev/ttyACM0
echo -e "\xFF\x08\x00" > /dev/ttyACM0

 

 

Download all files - DOWNLOAD

http://www.info.kmtronic.com/software/Raspberry_PI/USBRelayTest.zip

 

 

 

 

Read 3976 times