ROS interface to SainSmart USB relay boards for automation

List Devices

rosrun sainsmart_relay_usb list

Relay Node

rosrun sainsmart_relay_usb relay_node


  • serial Explicitly specify device serial number. Default <empty>
  • desc Explicitly specify device description. Default <empty>

Published topics

  • ready, std_msgs/Bool, true when device is connected, otherwise false, (latched topic)
  • serial, std_msgs/String, serial number of the connected device (latched topic)

Subscribed topics

  • relay_cmd, std_msgs/Byte, relay command (one bit per relay channel)


  • Unable to connect to the device (no terminal messages)
    • Can Linux see the USB device?
      • lsusb | grep 0403:6001
    • Only one executable can use a hardware device at a time.
      • Make sure no other running software is using the hardware.
    • By default, Linux USB devices have very limited permissions. Udev rules are used to modify device permissions when connected.
      • When installing with binaries with apt-get, the udev rules are installed automatically.
      • Check if this package's udev rules are installed: ls /etc/udev/rules.d/ | grep 90-SainSmartRelayUsbRules.rules or ls /lib/udev/rules.d/ | grep sainsmart-relay-usb.rules
      • Otherwise, follow the directions in 90-SainSmartRelayUsbRules.rules to perform a manual install.
  • When the board is connected to the PC and the PC is restarted, the relays will be toggled several times. This is because of the structure of the FTDI chip.