Controlling USB 2 Relay board by Raspberry Pi

 

 
Needed 
1 RaspberryPI
1 KMTronic 2 Relay Board
1 USB cable 
recommend install Raspbian

 

 

 

 

To see ttyusb use do the following:

cat /dev/tty and press TAB twice

 

 

Here we see that ttyUSB0

 

Set speed USB port

 

stty -F /dev/ttyUSB0 9600

 

 

Shell script to control relays

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

 

echo -e "\xFF\x02\x01" > /dev/ttyUSB0
echo -e "\xFF\x02\x00" > /dev/ttyUSB0
 

 

 

 

Read 2012 times