USB Relay Modules

2 Channel USB Relay Module with Digital Inputs

0 views April 2, 2025 monisha-d 0

Introduction

Numato Lab’s 2 Channel USB Relay Module with Digital Inputs is a great product for controlling electrical and electronic devices remotely from a PC or Mobile Device over a USB link. Ease of use and wider operating system compatibility are the primary goals behind this product’s design. Built-in USB to serial conversion allows the module to be used without any USB specific knowledge. This simplicity allows the use of off-the-shelf Terminal Emulation programs such as Hyper Terminal and PUTTY for controlling the module with a simple set of human-readable commands. For power users, this module can be controlled by writing programs in various programming languages.

Features

  • 2 SPDT Relays: Maximum switching current 7A
  • 8 Digital inputs : That supports maximum 24V input voltage
  • USB Interface with CDC Support: Operates like a standard serial port, requiring no specialized USB knowledge.
  • Accessible Relay Contacts: Relay contacts are available via convenient screw terminals for easy integration.
  • USB-Powered Digital Circuitry: The module’s digital circuitry is powered directly from the USB connection, simplifying power management.
  • Versatile Control Options: Can be controlled using standard serial console applications or through custom applications, with no need for vendor-specific libraries or APIs.

Some of the possible uses of this module include

  • Home Automation
  • Industrial Automation
  • Lighting Control
  • Garden Equipment Control
  • Test Fixtures
  • DIY and Hobby

This product is compatible with the following operating systems:

  • Windows XP and later versions (Windows 7, 8/8.1, 10 and future versions)
  • Windows 7 Embedded and later
  • Linux
  • Mac OS X
  • Android
  • Or any other operating system that supports USB CDC devices.

And these are some of the languages that can be used for programming:

  • C/C++
  • Visual Basic (VB6, VB2008, VB2010 express and other editions)
  • Visual Basic for Applications (Microsoft Office VBA)
  • Perl
  • Python
  • JAVA
  • Android
  • Javascript (Node.js)
  • And many more…

This product has 2 onboard SPDT relays and associated drivers capable of controlling a variety of devices including lamps, motors, locks etc… (Please see recommendations for using this product with inductive loads elsewhere in this document). This module also includes digital inputs that can be accessed over USB interface for extended functionality. The module communicates with host PC over full-speed USB link. When connected to PC, the module will appear as a serial port in Windows Device Manager (or a serial tty device in Linux and Mac).

How to Use 2 Channel USB Relay Module with Digital Inputs

Using this product is very easy,  thanks to the human-readable and easy to use command set and the USB CDC interface that allows the device to be used with most readily available serial terminal software such as Tera Term or HyperTerminal.  This document has more information about using this device with the following Serial terminal software. But in no way limited to this software though.

  • Windows
    • HyperTerminal
    • Tera Term
  • Linux
    • GNU Screen
    • PuTTY
  • Mac OS X
    • Screen Command
    • CoolTerm
    • goSerial

Components/Tools Required

Along with the module, you may need the items in the list below for easy and fast installation.
1. USB C cable.
2. Medium size Philips screw driver.

USB Interface

The on board full speed USB controller helps a PC/Linux/computer to communicate and control this module seamlessly. Use a USB C cable to connect with a PC. Please visit http://www.numato.com to buy cables and accessories for this product. By default, the logic section of the module is powered from USB so make sure not to overcrowd unpowered USB hubs.

Relay Contacts

This module has two mechanical relays that can switch up to 7A of current. All contacts on the relay are available externally on screw terminals for easy user access. The relays are rated for AC and DC supply voltages. Please see the technical specification table for more details. Each relay has 3 contacts (COM, NO, and NC). COM is the common terminal and is used in both normally open and normally closed positions. The contacts NC and COM will be connected when the relay is turned off and will be disconnected when the relay is turned on. And vice versa, the contacts COM and NO will be disconnected when the relay is turned off and will be connected when the relay is turned on. The table below summarizes possible relay contact positions.

Relay StateConnection between NC and COM Connection between NO and COM
OFFCloseOpen
ON Open
Close

Digital Inputs

The module features 8 Digital Input pins designed for robust performance in industrial and custom applications. Each input pin supports a wide voltage range, capable of handling up to 24V DC. These capabilities make the module suitable for high-power tasks.

The table below summarizes the Input and input positions on the header J1.

InputDigital Inputs
I0Digital Input 0
I1Digital Input 1
I2Digital Input 2
I3Digital Input 3
I4Digital Input 4
I5Digital Input 5
I6Digital Input 6
I7Digital Input 7
GNDGND
GNDGND

 

DC Power Supply

This module uses +5V power supply to function properly. By default the board is configured to use +5V supply from USB. So an external +5V power is not required. In most cases USB ports are capable of providing enough current for the module. Please refer to the marking on the board for more details.

Driver Installation

Installing Numato Lab CDC Driver - Windows Desktop and Server Editions

The driver package for Numato Lab’s products can be downloaded from the product page at ttp://numato.com. To install the driver, unzip the contents of the downloaded driver package to a folder. Attach USB cable to the PC and when asked by Windows device installation wizard, point to the folder where driver files are present. When driver installation is complete, the module should appear in Windows Device Manager as a serial port. The picture below shows a 1 Channel USB Relay Module visible in Windows Device Manager. For other devices (USB GPIO and USB Relay modules), the name will be different but how the device is displayed and used is exactly same.

Note down the name of the serial port (COM1, COM2 etc..). This information is required to control the module from the PC.

You may notice that the driver package does not come with a .sys or .exe file as most driver packages do and is expected to be that way. The driver binary necessary in this case is shipped with all copies of windows Desktop/Server editions and gets installed automatically while Windows is installed for the first time. The .inf and .cat files present in the driver package downloaded from http://numato.com merely associate this pre-existing driver with the attached Numato Lab device .

The following video demonstrates how to install the driver on Windows 10.

Installing on Windows Embedded Editions

Windows Embedded editions do not install the infrastructure necessary for USB CDC by default in favor of a smaller footprint. This will cause the driver install to fail unless the necessary files are manually installed prior to installing the driver. Please follow the steps below to install the prerequisites and driver correctly. These steps are tested on Windows 7 Embedded Edition.

  1. Locate winemb-inf-mdmcpq.cab on Win 7 Embedded DVD/ISO image
  2. Copy winemb-inf-mdmcpq.cab to a folder Ex: C:Temp
  3. Run command DISM.exe /online /Add-Package /PackagePath:C:Temp
  4. Wait for Windows to restart (Restart machine manually if DISM does not restart the machine automatically)
  5. After reboot is complete, plug the device to a USB port and install driver normally (Driver is available for download at the product page)

Installing on Linux

To use any device that uses USB CDC protocol with Linux, USB CDC driver needs to be compiled in to the kernel. Fortunately, most Linux distributions (Ubuntu, Redhat, Debian etc..) has this driver pre-installed. The chances of you requiring to rebuild the kernel to include the USB CDC driver is very slim. When connected to a Linux machine, this product should appear as a serial port under /dev directory. Usually the name of the device will be ttyACMx or similar. The name may be different depending on the Linux distribution you have. The image below shows the result of ls /dev command on a Linux Mint system with a USB GPIO/Relay device attached.

Device Listing on Linux

In this particular case, the device shows up as ttyACM0 (highlighted in orange color) but it could be ttyACM1 or ttyACM2  etc… depending on the specific system and other connected devices. Once the device is visible under /dev directory, it can be treated just like any other serial device. Commands can be sent to the device using any mechanism that is valid for regular serial ports such as screen command or Serial Terminal Emulation applications. If there are more than one devices connected to the same host computer, each device will be displayed as separate serial devices with unique names. These separate serial devices can be used to control individual devices attached.

Installing on Mac OSX

Mac OSX is usually shipped with USB CDC driver pre-installed. When connected to a Mac computer, this product should appear as a serial port under /dev directory. Usually the name of the device will be tty.usbserialportx or similar. The name may be different depending on the Mac OSX version you have. The image below shows the result of ls /dev/*usb* command on a Mac OSX Yosemite system with a USB GPIO/Relay device attached.Listing USB GPIO Devices on Mac OSX

In this particular case, the device shows up as tty.usbmodem141141 (highlighted on orange color) but it could be any name starting tty.usbmodem  or even a completely different name depending on the exact version of operating system and other connected devices. Once the device is visible under /dev directory, it can be treated just like any other serial device. Commands can be sent to the device using any mechanism that is valid for regular serial ports such as screen command or Serial Terminal Emulation applications. If there are more than one devices connected to the same host computer, each device will be displayed as separate serial devices with unique names. These separate serial devices can be used to control individual devices attached.

Installing CDC Devices On Android

Most Android versions has built in driver that supports external USB Devices. Due to the presence of built-in driver any external USB device including Numato Lab’s USB GPIO/Relay products connected to Android based gadget will be enumerated by Android OS. Such enumerated devices can be listed/viewed by using apps such as USB Device Info. The image below shows info about a Numato Lab USB device printed by USB Device Info app. All Numato Lab’s USB GPIO and USB Relay modules will be displayed the same way.

Numato Lab USB Device Listed In Android

Devices detected by Android can be controlled by using any off the shelf Serial Terminal App such as USB Serial Terminal Lite.

Sending Commands

One of the most powerful features of this module is the simple easy to use command set it supports. This command set hides the complex USB protocol and gives a very simple interface to access the features of the module. The following sections give details of the command set and how to use the command set.

The sections below talks in detail about how to send commands to the device using different tools on different operating systems. Since GPIOs are a common feature on all devices including relay modules, most sections here will use them to explain and demonstrate the process of sending commands. The process of sending other commands such as id get/set or relay on/off/read are exactly same, in fact in most cases simply replacing the existing command in the example code with the new one should work right away.

The Command Set

No.CommandParametersExampleDescription
1vernoneverReturns firmware Version.
2idget/set xxxxxxxxid get, id set 12345678Reads/Writes ID of the module
3relayon/off/read, relay number
readall/writeall/poweron
relay on 000, relay off 000,
relay read 000, relay readall/ relay writeall 03, relay poweron 03
Control the relays
4resetnone resetresets all the relays to the off condition
5gpioread, gpio numbergpio read 000Reads the Digital Input values
7infononeinfoReturns Relay Power-On status

The table below has more detailed information about available commands.

No.CommandExampleDescription
1ververReturns current firmware version.
2idid get
id set xxxxxxxx
Id get reads the module ID. Id set will assign a new ID to the module. “x” stands for alphanumeric characters including symbols. The new ID must be exactly 8 characters in length.
3relayrelay on xxxTurns a particular relay on. The parameter “xxx“ stands for the relay number. The relay number starts from 000. See some examples below.

relay on 000 – Turns on relay 0
relay on 001 – Turns on relay 1
This command accepts RELAY number from 000 – 001, total 2 values for 2 Channel USB Relay Modules with Digital Inputs.
relay off xxxTurns a particular relay off. The parameter “xxx“ stands for the relay number. The relay number starts from zero. See some examples below.

relay off 000 – Turns off relay 0
relay off 001 - Turns off relay 1
This command accepts RELAY number from 000 – 001, total 2 values for 2 Channel USB Relay Modules with Digital Inputs.
relay read xxxReturns the status of a particular relay. The parameter “xxx“ stands for the relay number. The relay number starts from zero. See some examples below.

relay read 000 - Returns status of relay 0
relay read 001- Returns the status of relay 1
The data returned in response to this command will be either “on” or “off” depending on the current status of the relay. This command accepts RELAY number from 000 – 001, total 2 values for 2 Channel USB Relay Modules with Digital Inputs.
relay readallReads the status of all relays in a single operation. The return value will be a hexadecimal number with binary value 1 at bit positions for relays in ON state and 0 for relays in OFF state. Eg: a return value 00 (binary 0000 0000) means all relays are OFF. A value 03 (binary 0000 0011) means all relays are ON.
relay readall – Returns status of all relays
Refer Understanding readall/writeall commands for Relay Modules to know more.
relay writeall 0xControl all relays in a single operation. A hexadecimal value must be specified with desired bit positions set to 0 or 1. A value 0 at a bit position will turn off the corresponding relay. A value 1 at a bit position will turn on the corresponding relay.
relay writeall 03 – Turns on all relays
Refer Understanding readall/writeall commands for Relay Modules to know more.
relay poweron 0xThis command is to control the relay status in a single operation.
Eg. relay poweron 01
Relays 1 is in off state and relays 0 is in on state after the poweron.
4resetresets all the relays to the off condition
5gpiogpio read xxxReads the digital status present at the input mentioned. Here “xxx” stands for the number of GPIO. This command accepts GPIO number from 000 - 007, total 8 values. The response will be either “0” or “1” depending on the current digital state of the GPIO. Please see examples below.
gpio read 000 – Reads GPIO 0 status
gpio read 001 – Reads GPIO 1 status
6infoReturns Relays Power-On Status.

Accessing the module

2 Channel USB Relay Module with digital inputs allows to communicate through any of the Serial Terminal Emulator Software using simple easy to use commands mentioned in the command set above.

Refer documentation “Sending Commands to the Numato Lab USB Modules” to know more.

Technical Specifications

ParameterValueUnit
Number of relays 2
Number of Digital Inputs8
Digital circuit power supply voltage (USB)5V
Temperature Range-10 to 70°C
Digital Inputs Specifications
Minimum DI sink current2.05mA
Maximum DI sink current44mA
Recommended sink current10mA
Maximum Low Voltage (VIL) 10.2V
Minimum High Voltage (VIH) 10.5V
Maximum High Voltage24V
Relay Specifications
Nominal relay coil voltage 5V
Nominal coil power consumption (per relay)360mW
Relay contact material AgSnO₂ (Silver-Tin(IV) Oxide)
Contact rating 10A/ 277V AC
7A/ 28V DC
Maximum switching voltage 277V AC/ 28V DC
Maximum switching current7A
Maximum switching power2770VA/ 196W
Contact resistance (initial)100 Max at 6VDC 1A mΩ
Life expectancy (Electrical) 50,000Operations
Life expectancy (Mechanical) 10,000,000Operations
Nominal insulation resistance 100 Min at 500VDCMΩ
Operating time10mS
Release time 5mS
Recommended Switching Load28V, 5A with 5s ON & 5s OFF at room temperature
Other Information
USB Vendor ID0x2A19
USB Product ID0x0C15

Additional Information

Using relay modules with inductive loads

Snubber Diode

Diode As Snubber

It is important to take additional care when using relays with inductive loads. An inductive load can be pretty much anything that has a coil and works based on magnetic principles like Motors, Solenoids, and transformers. But in practice, even a wire longer than a few feet can display substantial inductance. Inductive loads produce back emf when the magnitude of the load current changes. The back emf can be in the order of tens or even hundreds of voltage (See this Wikipedia article http://en.wikipedia.org/wiki/Counter-electromotive_force). This effect is most severe when power is disconnected from the inductive load because the rate of change of current is maximum at that point. Even though the back emf lives only for a very short time (a few milliseconds) it can cause sparks between the relay contacts and can deteriorate the contact quality over time and reduce the life span for the relays considerably.

So it is important to take countermeasures to suppress the back emf to acceptable levels to protect relay contacts. Usually, this requires connecting electronic devices in parallel with the load such that they absorb the high voltage components generated by the load. For solenoids, connecting a diode (fast switching diode is recommended) in parallel to the load (in reverse direction to the load current) is very effective. A diode used for this purpose is usually called a freewheeling diode. Please see the diagram on the right for connection details.

Capacitive Snubber

Capacitor As Snubber

A capacitor with a proper rating is recommended for protecting the relay contacts when a motor is used as a load. The capacitor should be rated enough to withstand the back emf that is generated by the motor. Please see the diagram below for connection details.

Please note that the relay modules are NOT shipped with back emf suppression devices pre-installed. The exact kind of suppression device and the parameters of the selected device can vary depending on the load itself. Some of the parameters that affect the suppression device selection are the inductance of the load, power supply voltage, load current, physical size/structure of the load, etc.. It is obvious that it is impossible for us to predict these parameters and design required back emf suppression device and incorporate that on the board. So we believe this is a task best left to the module user. There is an excellent article on designing back emf suppression on Wikipedia at http://en.wikipedia.org/wiki/Flyback_diode

Mechanical Dimensions

NL-USBR-C-001 Physical Measurements

Frequently Asked Questions (FAQs)

Q. What are the serial parameters I need to use when communicating with this board?
A. Since this module uses USB as the underlying transport mechanism, most of the serial parameters do not affect the communication. You can leave all parameters to any legal value (Eg: 2400, 4800, 9600 etc… for baud rate) except Flow control. Flow control needs to be set to “None”.

Q. Where do I find driver for this product?
A. Visit http://numato.com and navigate to the product page. There will be a link to download windows driver. Linux does not require driver installation since in most cases they are shipped with the driver pre-installed.

Q. Why there is no .sys or .exe file in the Windows driver package I downloaded?
A. This product uses USB CDC driver binary which is already present on Windows. All Windows versions (with the exception of Embedded Editions) has this driver binary installed by default. The .inf and .cat files present in the zip file helps Windows identify the device properly and associate appropriate driver (.sys) to the device

Q. Does this product work with Linux?
A. Yes, this product works with Linux. Please see more details on how to use this product with Linux elsewhere in this document.

Q. Does this product work with Mac OSX?
A. Yes, this product works with Mac OSX. Please see more details on how to use this product with Mac elsewhere in this document.

Q. What are the serial terminal software that this product work with?
A. This product works with a lot of different Serial Terminal software. Some examples can be found elsewhere in this document. Different Serial Terminal software are written by different developers with different purposes in mind. So you may encounter some software that may not work with this product. But usually alternatives are available in most if not all cases.

Q. The GPIO looses its previously set value when trying to read the status. Why it is so?
A. When a gpio is to output a value (high/low), that particular GPIO is put to output mode. When you are trying to read the GPIO, it needs to be put in input mode. In input mode, the GPIO will go to high impedance state and thus looses the previously set value.

Q. I’m using x language for programming. How do I find out if this language can be used to program and control the GPIO module?
A. Find out if the language of interest supports some kind of APIs/Functions/Components for serial communication. If it does, most likely you should be able to use that language with this module.

Q. What is the connector marked as ICSP on this module?
A. This connector is used to program the on-board microcontroller. This connector is primarily intended for factory use.

Q. I need a customized version of this product, can Numato do the customization for me?
A. Yes, we can definitely do customization but there may be minimum order requirements depending on the level of customization required. Please write to [email protected] for a quote.

Q. Where can I buy this product?
A. All Numato products can be ordered directly from our web store http://www.numato.com. We accept major credit cards and Paypal and ship to almost all countries with a few exceptions. We do have distributors in many countries where you can place your order. Please find the current list of distributors at http://numato.com/distrib.

Suggest Edit