USB Relay

From BitWizard WIKI
Revision as of 12:15, 11 November 2015 by Cartridge1987 (talk | contribs) (additional considerations)

Jump to: navigation, search


The USB relay board has two relays that can easily be controlled from a computer.

This allows your computer to switch the mains for other devices or signals or lower voltage DC power signals.

You can buy the USB Relay in the BitWizard shop.

Assembly instructions

None: the board comes fully assembled.

External resources


Additional software

In the zipfile at [[1]] you'll find usbr and usbr.bat that allow you to activate and deactivate relays from the commandline under Unix/Windows respectively.

For fun there is also the ticktock program that will excercise the relays causing a ticktock sound. This has not been converted to a BAT file for windows yet.

For Windows users, there is an INF file in the zipfile. Tell windows that this is the driver for your device, and it will use the builtin driver to create a virtual comport. The "usbr.bat" script assumes this has become "COM3", but it could be a higher number. If so, you can adjust the script and change the default to whatever your comport has become, or use an environment variable. IIRC, you can add something like "set relayport=COM5" to your c:\autoexec.bat . It has been a long time since I worked with Windows. Please let me know if this works.

Related projects


pin function remark
1 NO 1 Normally open contact for relay 1
2 C 1 center connection for relay 1
3 NC 1 normally closed contact for relay 1
4 NO 2 Normally open contact for relay 2
5 C 2 center connection for relay 2
6 NC 2 normally closed contact for relay 2


There is one power led.

On the board are two LEDs near each of the relays indicating the state of the relays.

Jumper settings

There are no jumpers.


The button causes a reset. The CPU on the board will then reboot and start up in usb Bootloader mode. This is necessary for firmware upgrades. Not useful for normal situations.


The usbrelay will come up as a virtual serial port. (i.e. /dev/ttyACMx under Linux). Windwos users will get a new COM port.

To set an output bit and thus activate a relay, you send "set <relaynumber>\n" to the virtual serial port. i.e. send "set 0" to activate the first relay.

To clear an output bit send "clr <relaynumber>".

the relaynumbers 0 and 1 are the relays. There is one extra led that can be used for indication purposes that has number 2.

Some more commands are available. They are not very relevant for the usbrelay. Connect to the device using your favorite serial communications program and type "help".

Additional considerations

Each relay draws about 70mA. Thus the module will draw about 150mA if both relays are active. Most computers will be able to supply this current, but the rasbperry pi might not. The Revision 1 raspberry pi has a polyfuse that prevents the board from drawing this much power. The Revision 2 Raspberry pi does not have the polyfuse, so it will work, provided your powersupply is powerful enough to provide current for the Pi + 150mA.

Default operation

By default the relays will start out in the "off" position. (i.e. a connection between the common and the "normally closed" will be present).

power consumption

Each relay typically consumes about 55mA. Max 70mA.

Future hardware enhancements

Future software enhancements



  • Initial public release