Using Comm Operator to Control USB Relays

Comm Operator is a tool used for transmitting and receiving serial and TCP/IP data.  Comm Operator was created by ginkgomo.com, and we have worked directly with the author of this software since 2003.  Comm Operator is capable of communicating to every device we manufacture, this tutorial will show you how easy it is to use Comm Operator to control our devices.  A trial version of Comm Operator is included with Base Station.  If you have not done so, please download Base Station software and run on your Windows 7, 8, or 10 computer:

//ncd.io/start

Controlling a Relay over USB

NCD.io devices use a Virtual COM Port Driver to communicate over USB.  This allows simple serial commands to be sent and received using standard baud rates, making integration very easy.

The following steps will show you how to control a relay using a USB interface.

Step 1: Select a COM Port

Plug in your USB Relay Controller and Choose the Correct COM Port for your USB interface.

Choose File>Open Connection
Choose a COM Port from the list that corresponds to your controller.  The sample shown will be using COM3.
Next, Click the “Open” button.

Hint: Once a COM Port is open, Base Station and other software applications will not have access to the port.  Only one application can speak to a hardware port at a time, but only if it’s not in use by another application.

Step 2: Make Sure API Mode is Selected

API Mode is the process of taking a command, and wrapping it with a header and a checksum, preventing the possibility of errant data reaching the controller.  API mode is also faster, as API also identifies to the controller exactly how many bytes to expect, which allows the controller to process the command immediately instead of waiting for a timeout.  Make sure the API box is checked as shown in the photo below:

Step 3: Sending a Command

Many times in our tutorials, we will show you the complete command, including API encoding.  You will see tables throughout our tutorials that look like this:

TX: FUNCTION: RX:
170 3 254 108 1 24 Turn On Relay 1 in Bank 1 170 1 85 0
170 3 254 109 1 25 Turn On Relay 2 in Bank 1 170 1 85 0
170 3 254 110 1 26 Turn On Relay 3 in Bank 1 170 1 85 0
170 3 254 111 1 27 Turn On Relay 4 in Bank 1 170 1 85 0

The actual command is smaller than the API encoding data.  The table below shows the actual commands, as the API data can be automatically generated.  Highlighted in Blue below, the actual bytes of data sent and received from the controller.

TX: FUNCTION: RX:
170 3 254 108 1 24 Turn On Relay 1 in Bank 1 170 1 85 0
170 3 254 109 1 25 Turn On Relay 2 in Bank 1 170 1 85 0
170 3 254 110 1 26 Turn On Relay 3 in Bank 1 170 1 85 0
170 3 254 111 1 27 Turn On Relay 4 in Bank 1 170 1 85 0

As you can see, it’s pretty easy to strip out API data to look at the command.  Simply omit the first 2 bytes and the last byte on both the send and receive packet.

For this tutorial, we will be activating the first 4 relays on a ProXR series controller:

TX: FUNCTION: RX:
254 108 1 Turn On Relay 1 in Bank 1 85
254 109 1 Turn On Relay 2 in Bank 1 85
254 110 1 Turn On Relay 3 in Bank 1 85
254 111 1 Turn On Relay 4 in Bank 1 85

Start by entering: 254 108 1 as shown in the box below and click the “Send” button.

Step 4: Confirm Data

After sending data to the controller you, should receive a API packet back.  Notice how Comm Operator added the API data for you.  The relay should be on and you should be ready to send any command you want with Comm Operator.