Processors
You have two fundamental options for the processor you use to control your security system. Commercial alarm manufacturers use dedicated processors, but you don’t have to:
Dedicated — A dedicated processor generally runs either no operating system or a realtime operating system designed for fast boots and without the complexity of Windows or Linux. The reduced complexity, combined with the ability to run nothing but your security software, makes them easier to make highly reliable, a valuable characteristic for a security system. The very simplicity of dedicated processors causes many of them to lack facilities useful in a security system, such as built-in Internet connectivity.
Dedicated processors often have electrical interfaces designed for reading and writing digital and analog ports, reducing the cost of the overall system, and typically have software built in to manage those ports.
PC, Linux or Windows — PCs are far more complex than dedicated processors, but in return offer far more capabilities and resources. Foremost among those are more sophisticated options for software development, including software libraries, and built-in Internet access. The more sophisticated hardware and software architecture comes at a price, though, in that it’s harder to directly attach digital or analog devices, and harder to write software to work with those devices.
Despite the disadvantages, we chose to use a PC for the security system largely because it simplifies the job of issuing the alerts we thought appropriate for a remote building (see the next section). Given that decision, the key architectural question becomes how to interface the switches in the alarm sensors to the PC. Again, there are two fundamental options:
Take over existing signals — You can adapt signals in the serial or parallel ports on a PC for digital inputs without an intervening processor. The parallel port can run in several modes, including a bidirectional mode that lets you input eight signals as a byte. You could use each of the eight signal lines to input a zone of switches; use a pull up resistor in each line and let the switches pull the line to ground.
You can use a serial port in much the same way, but (assuming you want to read asynchronous digital lines without an interface processor) the receive data line itself isn’t useful for that purpose because the PC electronics expect to see framed characters on the line at specific data rates. The input control lines — Data Set Ready, Data Carrier Detect, and Clear to Send in particular — will input an asynchronous level, but because serial port signals are nominally at ±12 volts, with a dead zone between ±3 volts, you can’t just use the switches and pull up resistors directly. Instead, you’d need RS-232 receivers at the interface.When you consider how few signals you get, the difficulties of writing appropriate software, and the need to create an interface board to host the level shifter chips, it’s more pain than it’s worth.
Use an interface board — The easier, and more flexible, alternative for interfacing sensors is to use a board with enough electronics to interface to the digital and (perhaps) analog sensors you’re using on one side, and to a standard PC interface (USB or serial port, for example) on the other. This approach has the advantage of not being inherently limited in the number of signals you can tie to, and if you use an existing commercial product, you’re likely to have a software interface library available.We like USB interfaces when there’s a choice between that and serial ports, because USB is faster with lower latency, and because serial ports are more prone to configuration problems.