RS232 Relay: Difference between revisions

From Leo's Notes
This page was last edited on 15 June 2020, at 00:44.
No edit summary
m Text replacement - "Category:Tinkering" to "{{Navbox Tinkering}}Category:Tinkering"
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
I believe the manual for it is this: https://s3.amazonaws.com/assets.controlanything.com/manuals/R2X.PDF
I believe the manual for it is this: https://s3.amazonaws.com/assets.controlanything.com/manuals/R2X.PDF


On Linux, turning it off and on:
On Linux, to turn the relay off and on via serial:


{{highlight|lang=terminal|code=
{{highlight|lang=terminal|code=
## Ensure serial is at 9600 baud
# stty -F /dev/ttyS0 9600
# stty -F /dev/ttyS0 9600
## Toggle it
# while true ; do echo -e "\xFE\x01" > /dev/ttyS0 ; sleep 1 ; echo -e "\xFE\x00" > /dev/ttyS0 ; sleep 1 ; done
# while true ; do echo -e "\xFE\x01" > /dev/ttyS0 ; sleep 1 ; echo -e "\xFE\x00" > /dev/ttyS0 ; sleep 1 ; done


Line 13: Line 16:
# printf \\$(printf '%03o' 0) > /dev/ttyS0  
# printf \\$(printf '%03o' 0) > /dev/ttyS0  
}}
}}
{{Navbox Tinkering}}[[Category:Tinkering]]

Latest revision as of 00:44, 15 June 2020

There is this RS232 Relay with 'www.iorelay.com' printed on the PCB.

I believe the manual for it is this: https://s3.amazonaws.com/assets.controlanything.com/manuals/R2X.PDF

On Linux, to turn the relay off and on via serial:

## Ensure serial is at 9600 baud
# stty -F /dev/ttyS0 9600

## Toggle it
# while true ; do echo -e "\xFE\x01" > /dev/ttyS0 ; sleep 1 ; echo -e "\xFE\x00" > /dev/ttyS0 ; sleep 1 ; done

## You can also use printf
# printf \\$(printf '%03o' 254) > /dev/ttyS0
# printf \\$(printf '%03o' 0) > /dev/ttyS0