USB Relay

From BitWizard Wiki
Revision as of 14:51, 16 April 2014 by Tom (talk | contribs) (→‎Protocol)
Jump to navigation Jump to search

intro

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.

Assembly instructions

None: the board comes fully assembled.

External resources

Datasheets

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.

Related projects

Pinout

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

LEDs

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.

button

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.

Protocol

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

Changelog

1.0

  • Initial public release