During the precessing of getting the RS-232 communication working with the lightning detector and my Linux box, I learned the advantages of RS-485. RS-232 sends over its signals as a single ended voltage. RS-485 uses a differential signal. This has many advantages and at least one draw back.The prime advantage and the reason I plan to convert is you can have a fast signal over large distance without signal degradation. Till such time as I try out a wireless communication system like Xbee, my detector and computer may be at a fair distance from each other. One in the attic for a long view of the environment and the computer it is protecting is on the first floor. The specification for RS-232 is only for 50 feet or so in a benign environment. Snaking an RS-232 cable through walls and around power lines does not sound very benign.
RS-485 only requires three signals. Ground and the differential A and B signals. That makes the cable smaller in diameter that the standard 9 signal RS-232 cable. Another benefit.
Another interesting thing about RS-485 is that it is not just a point to point communication channel. It supports multiple stations on one set of AB wires. Any station can transmit whenever it want by enabling its transmitter and clocking out bytes. When not transmitting, the other stations are in receive mode and can read in the bytes. The problem comes when two stations decide to transmit at the same time. You have contention on the bus and both stations data gets garbled.
So how do you take care of this issue? Even with the best software protocols, there will still come the day you have contention. And the solution is that the transmitting station also enables its receiver. Therefore it should receive the exact same bytes it sends. If it does not, then there must have been contention. At this point, the normal solution is for the transmitting station to wait a random amount of time, check the bus for incoming bytes and if none seen to start to transmit again.
So I placed an order for two Sparkfun parts. The first is a USB to RS-485 device that will plug into my Linux box and will receive data from the detector. The second part is a logic level to RS-485 transceiver for the detector.
Unfortunately after I ordered the parts I found a problem with their design. Unlike the normal implementation where the receivers are always enabled and the user can selectively turn on the transmitters, the Spartfun design enables on or the other. That makes the parts useless for multidrop RS-485 as sold. I have just received the parts tonight, and will look to see if they can be modified to simply pull the receive_not enable pin low at all times. Grumble. Grumble. This is the second Sparkfun disappointment I have had in the last week.