USB I/O Board
This project aims to provide a lot of digital I/O capability on to our Home Control System (HCS) by using some off-the-shelf hardware connected via a USB port to our mini-ITX processor. This is simple, cheap and reliable technology to sense and control stuff with PC-based home automation.
When using a board like this for both input and output, you need to understand the implications on your software architecture. In our real-time multi-process Home Control System (HCS), we don't want the software controller handling both inputs and outputs, as this means it needs to wait for commands from other processes, in order to change outputs. By keeping the board to one that provides inputs only, it can simply query the status of the input ports and report back the state changes via inter-process messages. This means no waiting for control commands and fast response and state change detection.
Input & Output Circuitry
When it comes to outputs, a consideration to bear in mind is that although the outputs can sink 10mA, the combined draw across all output pins must not exceed 100mA on the chosen USB I/O board. The on-board 5V power supply is also taking its power from the USB port and on most PCs this is limited to <500mA.
Like most of our Home Control System (HCS), the software is written in Java and uses socket level inter-process communication. As our 'USBI' process is simply querying the three input ports, via the serial port protocol. It detects input changes and sends these back to the main 'HCS' process. As it is input only, there are no blocking or wait states and the process adds neglible processor loading. We have re-used a serial port library and use SimpleSerial as the native serial port driver. The code is quite simple and simply reports back input state changes as structured messages. We have used this same structure throughout our Home Control System (HCS).
This project is complete and integrated into our Home Control System (HCS). This is the 19" rack shelf with 24 input lines (8 per opto-isolated input board). The one in the middle is an initial prototype and hence slightly smaller.
As you can see, there is some spare shelf space and we have since added Ethernet I/O capability to this shelf.
- The USB I/O board has proved remarkably cheap, easy to use and has been very reliable. There is a lot to be said for simplicity! It is now the main input element of our Home Control System (HCS).
- One down-side of this approach is that it is wired and requires wiring to be run back to a single point, close to our Home Control System (HCS) processor. This is not an issue if you plan ahead or as part of a new build but, it could be an issue in existing properties.
- For fast changing inputs such as PIR sensors and door contact sensors, this is a much more reliable method to sense changes than using a slow polling technology like 1-Wire.
- For the ultimate reliability, you should fuse each input feed so that one short doesn't take out a whole input board or even the entire set of inputs.