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:
- Communication lengths of thousands of feet possible
- Nodes can be multidrop (not require interrupting the line)
- Drivers and software are easily obtained/designed
- Already in use by other hardware mgfrs.
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:- R - is the receiver's address
- S - is the sender's address
- _ - is a delimiter
- mmm - are the message bytes
- [ret] - is the message terminator
SR_[ret]
- S - is the receiver's address
- R - is the sender's address
- [ret] - is the message terminator
SR_mmmm[ret]
- S - is the receiver's address
- R - is the sender's address
- mmmm - is the sampled data
- [ret] - is the message terminator
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.