The Communication Network

The use of a hardwire communications network allows a transfer of data and control at a relialibility and bandwidth not possible by X-10. I quickly settled on EIA/RS485 because:

Note that the choice of 485 does not specify which protocol to use. Like EIA/RS232, EIA/RS485 is an electrical standard. A line of products called HCSII from Circuit Cellar Ink uses 485 as the communication medium, and since they are marketed to the home and building automation market, I decided to make my protocol compatible with theirs. This would also allow me to purchase their modules if I wanted to.

Messages on the network

The 485 protocol used is quite simple, the PC is the main bus controller, and nodes speak only when spoken to. In addition, I wanted my system to be easy to debug, which meant being able to use a simple terminal to send and receive network messages. In my system, messages have the form: RS_mmmmm[ret], where: These messages are sent by the PC in EIA/RS232, they are passed to Node 0, which converts them to EIA/RS485, and transmits them to the network. Nodes respond with an acknowledge or actual data collected. The acks to commands look like:
SR_[ret] The returned data due to a data request is of the form:


Characters are sent at 9600 baud, eight bits, no parity. I can achieve about 60 complete messages (includes ACKs) per second due to the short message length. This means that the latency from the nodes to the PC is just a few tens of millisecond. I keep track of statistics like timeouts (I wait one second for a node to respond), or errors (I can check if the addresses appear correctly from an addressed node). Normally, I average less than one error and one timeout per hour. In that hour, I would have transferred more than 1.5Mbit, giving the reader an idea of the Bit Error Rate.

I use the Maxim line of chips for all EIA/RS232 and 485 drivers throughout my system. They are low cost (free samples are available) and work very well.

Termination and Bias

A twisted pair carrying data over long lengths can no longer be thought as a simple wire. This transmission line needs to be terminated with the pair's characteristic impedance to prevent reflections. This termination resistor usually has a resistance of about 100-200 ohms, and increases the power dissipation of drivers. If the data rate is low, and the transmission line is short, the reflection may be negligible, and a termination resistor can be eliminated. Since I use 9600 baud, and my longest line length is about 100 feet, I did not see any reflection when viewing the waveform on the network. I decided not to use any resistors to reduce power dissipation and thermal stress on the components.

When no drivers are driving the twisted pair network, the differential voltage can be unpredictable, causing the receivers to interpret the voltage as random bits. This can cause problems with network nodes, so a 485 network should be biased by resistors so that there is always some potential difference on the line. One wire should be tied to +5, and the other to ground such that a logic one (inactive state) is received by all receivers. Typical resistor values are 600 ohms. Note that the addition of termination resistors will reduce your dc bias, and reduce your noise margin when noone is driving the line. Thus it can actually be better in some cases to not have any termination.

Power to network nodes

The network connector on which I have standardized is the RJ11 telephone connector. This has four conductors, two are used for the 485 signal, and the other two are used for power. I distribute +5Volt (regulated), but raw +12 Volts can also be sent over this pair. The advantage of the +5 is that nodes can be simpler, but not many nodes can draw from this power. If a lot of power is needed by a node, it has its own plug in transformer power supply. An example of this latter approach is the voice node, which needs lots of power to drive its speaker.

Related Links

  • The Serial Port FAQ
  • Home Automation Main Page

    Back Home