Online Development Notebook > Index > U4x1 Application Notes > App11: Home Domination> Amp It Up!

Amp It Up!

This app note created in part by StrandControl and those parts are used with permission.


This tutorial shows how you can build a small relay interface board so that you can use the U4x1 devices to control circuits that require more current or a higher voltage than what the U4x1 devices can provide directly. This tutorial is meant to help anyone using the U4x1 devices with custom software, or with Home Domination. The design can be implemented as is, or it can provide a starting point for more complex implementations.

Design Overview

The U4x1 devices have a limited ability to provide current when their i⁄o lines are configured as outputs. The i⁄o lines should not be connected to voltages higher than 5V.

A relay provides a way to control (switch on or off) devices with voltage and current ratings that are greater than the capabilities of the U4x1. The relay in this design can switch a 30V (maximum), 1A (maximum) circuit. The 5V relay coil uses about 40 mA of current provided by the Darlington switch in the 2803.

This application consists of a small circuit card containing screw terminals to interface to a U401 or U421 as well as the controlled circuit, the 2803 driver, relays, and relay state indicating LEDs. The card developed in this application provides four channels of relay control.


The schematic above shows one of the four relay⁄LED channels implemented in this design. The 2803 makes a switched connection to ground. When activated, current flows through the relay and activates the relay contacts. The LED associated with the relay is also turned on.

Project Parts

The relay board can be assembled in many different ways. A specific custom printed circuit board could be designed with a PCB layout program. The PCB could then be ordered from a PCB production house.

For this app note, however, I chose to use point-to-point wiring on a simple prototype PCB board. The board provides a "sea of holes" that are on one tenth inch centers. The components that I chose for this application have leads that have the same spacing.

Pictured above are all of the components for the example prior to assembly. The yellow wire in the photo is a short piece of Wire-Wrap wire that I used for all of the point-to-point connections. I didn't wire wrap the circuit, I just used Wire-Wrap wire to make the point-to-point connections.


Description Part Number Source
PCB 14167-PB Marlin P. Jones (
TQ2-5V Relays 255-1001-5-ND Digikey (
Screw terminals 277-1274-ND Digikey (
ULN2803 ULN2803AP-ND Digikey (
24 pin DIP socket AE8918-ND Digikey (
18-pin DIP sockets AE8924-ND Digikey (
1k resistors unspecified Digikey (
LEDs unspecified Digikey (
Wire-Wrap wire
or suitable 30 gauge wire
unspecified Digikey (


The majority of the parts are components that I keep in stock for general prototype use. The specifics about which DIP sockets, resistors, and LEDs to use do not matter much to this design. A different size or type of PCB board could be used, larger or different color LEDs, and even different types of relays. Consideration should be made for driving the relays with the right voltage and sufficient current. Parts appropriate for this app note can be obtained from a variety of vendors.

The circuit card is from Marlin P. Jones ( It is #14167-PB. MPJA can also provide some of the other components, such as LEDs.

The relays are NAIS TQ series relays. The relays that I chose to implement in this design are TQ2-5V. The screw-terminals in the photo above (green) have .1 inch spacing between the leads. I use a small "precision" screwdriver with these screw terminals, since they are rather small. These relays and terminal blocks are available from Digikey ( The relays are Digikey part number 255-1001-5-ND, the screw terminals are 277-1274-ND. Most of the parts (other than the PCB) for this project can be obtained from Digikey.

Larger screw terminals are also available that have .2 inch lead spacing. They can still be used with the PCB described in this project.

The relays used in this app note switch 30V max 1A max. The coil voltage for the relays is the 5V from the USB supply. The coils use 40mA.

A relay that can switch more current (5 amps) such as the Omron G6DS-1A-DC5 (Z2317-ND at Digikey) could also be used. This relay has a different form-factor, and therefore will not fit into the DIP sockets.

Relays that use a coil voltage higher than the 5V supplied by USB would need to have that voltage supplied by a different power source. Using a relay such as the Panasonic DR-12V would mean adding another screw terminal to the design to provide a source for the coil's 12V.

The coils for the relays are switched by the 2803. The maximum current that the 2803 can switch is in the 2803 data sheet for the manufacturer of the specific 2803. This defines the limits to the current and voltage of the relay's coil.


The PCB needs to be large enough to comfortably hold the components. This PCB has holes in a 24 by 31 pattern, minus nine holes in each corner. The holes are on a .1 inch center spacing pattern.

The corner holes are 1⁄8th inch mounting holes.

I was confident that the board that I selected would have enough room to hold all of the components. I placed the components on the board to play a bit with the orientation. I chose the "portrait" orientation pictured above.


The sockets, terminals, LEDs, and resistors were soldered in place on the board. Each component lead is soldered in place to the copper donut on the back of the PCB. That copper will hold a small amount of solder that makes an electrical connection to the component lead.

The Wire-Wrap wire is cut to length for each particular point-to-point connection. A small amount of the insulation is removed from each end of the wire. The solder on the donut⁄lead is heated with a fine-tip soldering iron and the lead is inserted into the melted solder. Most connections are only a single wire attached to a lead. Care must be made to not lose a previous connection when an additional wire is added to a connection that needs two wires.

Black, red, yellow, and bare Wire-Wrap wire was used for all of the point-to-point connections as can be seen in the photo and graphics above. Bare wire was used for the short connections where convenient.

Final Hardware and Test

Once assembled, 5V and ground were applied to the board. Each relay⁄LED was tested by applying 5V to the input⁄control line of the 2803.

Connnection of the Relay Board to a U4x1

The relay board can be connected to either a U401 or a U421. The top set of screw terminals should be connected to the U4x1, while the side screw terminals connect to the circuit that the relay board controls.

"Ground" and "power" connect to the U4x1 ground and +5V respectively. The relay control lines, A, B, C, and D connect to the data lines of the U4x1. The U4x1 data lines would be set to output.

Home Domination can now control higher voltage⁄current devices.

Controlling the Relay Board in Home Domination

To use the relay board in Home Domination, it's best if you plug in the U4x1 and relay board before you start Home Domination.  Then, when it starts, it will automatically detect all the devices.  Then, you should start Home Domination and click Setup, then click Device Setup.  Click the + sign next to "U401⁄U421 Direct I⁄O" and you should see a listing for each U4x1 device attached.  The following example shows what it will look like if you have 3 devices.

Now click the + sign next to one of the devices you want to configure.  You should see something like the following, where you have two ports, A and B, and each port has 8 data bits.  Initially everything will be set as Input.

To control a relay you will need to change it to Output and add a "Switch" so it will show up in the switch tab on the main dialog, configured so it can be controlled. To change a bit to output or to add a sensor or switch, just double click on a bit, or single click and click Change.  Then select Output.  You can change the On Value and Off Value in case the device you have attached uses inverted logic, and you can change the value that it will default to on startup.

This example shows how to set it up so you can control the relay labeled "doomsday device", which is of course quite necessary if you want to use Home Domination and this relay board to dominate the world.  When you click Add Switch, the following window will appear:

A paddle switch is for devices where one bit is pulsed on and off to turn the device on and another bit is pulsed on and off to turn the device off.  A regular switch uses only one bit and it simply turns it on or off.

When you click Switch and then click Select, the following window appears with the Device Type, Port and Bit already filled in for you, so all you have to do is set the name to what you want and click OK and it will add it for you.

When you click Add Sensor, you will get a similar dialog.  If you're curious what those other fields are for, or wondering how to set up a paddle switch, just click F1 when you're on that window and it will tell you all about it.

If you want to change all 8 bits to output or back to input, you can do it easily by selecting the Port (A or B) and clicking Change.  This will bring up the following window where you can change the Input or Output type, and it will automatically change it for all the bits.  Here you also have the option of treating the port as a single number rather than individual bits.  This may be handy if you want to use the U4x1 to pass in a numeric value, perhaps for analog to digital applications.  The value can be used in macros by using the compare ability in a sensor trigger.

Once you've set up all your sensors and switches in this way, they will appear on the Sensors and Switches tab.  If you have the remote network client set up, then you can detonate your doomsday device from the safety of another country, or you can create a macro to watch one of your sensors and detonate the device when Mr. Bond approaches it without using his fancy gadgets.  Remember, doomsday devices may harm the environment, so you might want to consider taking over the world with annoying noise instead.

Hardware:  U401 USB Interface    U421 USB Interface   U451 USB Interface

Programming:  USBm DLL Programming    Download Files

Application Notes:  U4x1 Application Notes    Misc Applications and Information    FAQ

While every effort has been made to make sure that the information posted on this site is correct, the author can not be held liable for any damages whatsoever for losses as a result of the application of this information. Use this information at your own risk.

USBmicro can design your custom and semi-custom USB product. Email about USB design can be directed to " Robert " at

Copyright © USBmicro, L.L.C., 2002-2010

Previous  |  Next ]     [ Up  |  First  |  Last ]     (Article 105 of 126)

This page is created with TreePad