USB I/O Controller Box Using a U401
I've had this box around for a long time and it's my go-to USB I/O controller for things like switching relays on and off using a PC. For example, I used this to control lava lamps for a build server awhile back. It's based on the USBmicro U401 and it has a ULN2803 transistor array IC to isolate the U401 from what's being switched on and off. This allows me to switch things at a little higher current like relays. Don't try connecting a relay directly to the U401 as it doesn't have support for a lot of current at all. I use an external 6-9 volt power supply for the actual switching power, and the U401 is powered by itself from USB. The U401 has support for more than just simple digital outputs, but that's all I have it used for here.
For software, I use my u401ctl utility. This means, I can just script up controlling up to 8 different outputs with the following examples.
Turn output 0 on and output 1 on.sudo ./u401ctl 0=on 1=onTurn output 0 on and output 1 off.
sudo ./u401ctl 0=on 1=offJust turn output 1 on.
sudo ./u401ctl 1=on
You can set the state of all 8 outputs in one swift run of the u401ctl utility like this, which makes it very versatile for scripting.
The box is all powered up with the first output turned on. LEDs on the top indicate when an output is turned on.
The box has terminals for connecting signals to external things like relays.
Here's what the insides look like. Not pretty, but it's simple.
Here's how the U401 is mounted to the breadboard along with the transistor IC.