
USB HOST Relay board (4)

Example control relays using USB Keyboard.
For project you need USB Host Relay board, 12VDC power and USB Keyboard.
Select from Tools -> Arduino AVR Boards -> Arduino Mega ADK
Then select com port.
After upload sketch when you press key '8' first relay turn ON, when press key '2' turn OFF.
Using keyboard you can control all relays using one key, or using combinations.
Some ideas:
- When you type "1234" and ENTER this to turn ON relay 1. Using this you can make simple Door Opener.
- When you press "1" board execute combination for simple automation. Turn ON relay 1, after 10 sec turn OFF and turns ON relays 2 and 3… When you press button "2" this run other combination.
- Build universal relay timer. When you type "45" and ENTER relay 1 turn ON and turn OFF after 45 seconds
- and many more
Example code

Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 (64)
idVendor: 0x1BBB
idProduct: 0xF000
bcdDevice: 0x0000
iManufacturer: 0x03
0x0409: "USBModem"
iProduct: 0x02
0x0409: "HSPA Data Card"
iSerialNumber: 0x04
0x0409: "1234567890ABCDEF"
bNumConfigurations: 0x01
ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: High
Device Address: 0x01
Open Pipes: 2
Endpoint Descriptor:
bEndpointAddress: 0x01 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00
Configuration Descriptor:
wTotalLength: 0x0020
bNumInterfaces: 0x01
bConfigurationValue: 0x01
iConfiguration: 0x01
0x0409: "USBModem Configuration"
bmAttributes: 0xA0 (Bus Powered Remote Wakeup)
MaxPower: 0xFA (500 Ma)
Interface Descriptor:
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x08
bInterfaceSubClass: 0x06
bInterfaceProtocol: 0x50
iInterface: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x01 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00
=======================================================
SetupPacket |
0x80 0x06 0x00 0x01 0x00 0x00 0x12 0x00 |
RequestType |
0x80 (Direction: Device-to-host, Type: Standard, Recipient: Device) |
Request |
0x06 (GET_DESCRIPTOR) |
Value |
0x0100 (USB_DEVICE_DESCRIPTOR_TYPE) |
Index |
0x00 |
Length |
0x12 |
12 01 00 02 00 00 00 40 BB 1B 00 F0 00 00 03 02 04 01
bLength |
0x12 |
bcdUSB |
0x0200 (USB 2.0) |
bDeviceClass |
0x0 |
bDeviceSubClass |
0x0 |
bDeviceProtocol |
0x0 |
bMaxPacketSize0 |
0x40 |
idVendor |
0x1BBB (T & A Mobile Phones) |
idProduct |
0xF000 |
bcdDevice |
0x0 |
iManufacturer |
0x3 |
iProduct |
0x2 |
iSerialNumber |
0x4 |
bNumConfigurations |
0x1 |
SetupPacket |
0x80 0x6 0x0 0x2 0x0 0x0 0x20 0x0 |
RequestType |
0x80 (Direction: Device-to-host, Type: Standard, Recipient: Device) |
Request |
0x6 (GET_DESCRIPTOR) |
Value |
0x200 (USB_CONFIGURATION_DESCRIPTOR_TYPE) |
Index |
0x0 |
Length |
0x20 |
09 02 20 00 01 01 01 A0 FA 09 04 00 00 02 08 06 50 00 07 05 01 02 00 02 00 07 05 81 02 00 02 00
bLength |
0x9 |
bDescriptorType |
USB_CONFIGURATION_DESCRIPTOR_TYPE |
wTotalLength |
0x20 |
bNumInterfaces |
0x1 |
iConfiguration |
0x1 |
bmAttributes |
0xA0 ( Bus_Powered Remote_Wakeup ) |
MaxPower |
0xFA |
Interface Descriptor |
|
bLength |
0x9 |
bInterfaceNumber |
0x0 |
bAlternateSetting |
0x0 |
bNumEndpoints |
0x2 |
bInterfaceClass |
0x8 (Mass Storage) |
bInterfaceSubClass |
0x6 (SCSI Transparent Command Set) |
bInterfaceProtocol |
0x50 (Bulk-Only Transport) |
iInterface |
0x0 |
Endpoint Descriptor |
|
bLength |
0x7 |
bEndpointAddress |
0x1 [OUT] |
bmAttributes |
0x2 (USB_ENDPOINT_TYPE_BULK) |
wMaxPacketSize |
0x200 |
bInterval |
0x0 |
Endpoint Descriptor |
|
bLength |
0x7 |
bEndpointAddress |
0x81 [IN] |
bmAttributes |
0x2 (USB_ENDPOINT_TYPE_BULK) |
wMaxPacketSize |
0x200 |
bInterval |
0x0 |
URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
Urb Field |
Value |
---|---|
Length |
0x80 |
USBD Status |
USBD_STATUS_SUCCESS (0x0) |
EndpointAddress |
0x1 |
PipeHandle |
0xFFFFFA80055E8208 |
TransferFlags |
0x0 ( USBD_TRANSFER_DIRECTION_OUT ) |
TransferBufferLength |
0x1F |
TransferBuffer |
0xFFFFFA800870AB98 |
TransferBufferMDL |
0x0 |
UrbLink |
0x0 |
55 53 42 43 10 90 A7 07 24 00 00 00 80 00 06 12
00 00 00 24 00 00 00 00 00 00 00 00 00 00 00
==================================== 2222222222 =================================================
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0200
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40
Vendor ID: 1BBB
Product ID: 0017
Revision ID: 0000
Mfg.string index: 03
Prod.string index: 02
Serial number index: 04
Number of conf.: 01
Configuration descriptor:
Total length: 009A
Num.intf: 06
Conf.value: 01
Conf.string: 01
Attr.: A0
Max.pwr: FA
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 81
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 01
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 01
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 82
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 02
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 02
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 83
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 03
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 03
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 84
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 04
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 04
Alt.: 00
Endpoints: 02
Intf. Class: 08
Intf. Subclass: 06
Intf. Protocol: 50
Intf.string: 00
Endpoint descriptor:
Endpoint address: 05
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 85
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Interface descriptor:
Intf.number: 05
Alt.: 00
Endpoints: 03
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 86
Attr.: 03
Max.pkt size: 0040
Polling interval: 05
Endpoint descriptor:
Endpoint address: 87
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 06
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
UDP
Multifunctional 8 Relay board with USB Host interface. USB Host allo to connect to board and control relays using any ready USB Device like Bluetooth, Joystick, Keyboard, Remote control, Mouse, RFID Reader, HID devices or custom developed modules.
What is idea?
Build open source universal relay board with possibilities control using any ready or custom made USB device.
Technical Details
- Arduino MEGA ADK compatible
- ATmega2560 microcontroller
- Flash Memory: 256 KB of which 8 KB used by bootloader
- SRAM: 8 KB
- EEPROM: 4 KB
- Clock Speed: 16 MHz
- USB Host Chip: MAX3421E
- Required power: 12VDC/1500 mA
- Outputs: 8 relays each capable of switching 12VDC/10A or 240VAC/7A. Each relay has an LED to indicate when it is operated.
- Two collors functional LED (Green + Red)
Dimensions:
KMTronic_8Relay_Dimension.pdf
Relays specifications:
Relays has Normally Open (NO) and Normally Closed (NC) Contacts rated for voltages:
- 12VDC/10A
- 24VDC/10A
- 125VAC/10A
- 250VAC/7A
After test examples "USB Host Library for Arduino" Lauszus (TKJElectronics) and Oleg Mazurov we just successfully control relays using:
USB Keyboard
http://www.info.kmtronic.com/usb-host-relay-board-keyboard-example.html
USB Mouse
USB Joystick
USB Bluetooth
USB Remote control
USB RFID Reader
Now try to expand examples with many more USB devices like:
USB WIFI module
USB 3G Module
Android USB Control
USB DS1820 Temperature reader
Custom USB Modules