I would like to use serial comms between atmega328p microcontrollers over lines up to about 20 meters long, at speeds of around 9600, with the first choice of cable being cat5. Opto isolating them seems necessary and after looking around for a bit the 6N137 seems like a decent choice and its easily available. I want to keep the cost down since I'll need quite a few of them (a few tens).
I would put both the isolators (for tx and rx) at the same end so one isolator LED would be driven via its own pair in the 20m cable, which I don't see as a problem, and one opto output (an open drain mos) would drive the other wire (the tx data from the opto module NMOS output to the long wire).
So I have a NMOS open drain driving a 20m long cat5 wire.
Cat5 with a capacitance of 100pF / meter @ 20m should only be 2nF total, and the 6n137 NMOS output can sink 50mA, so I am wondering if I can just connect a 330R pullup resistor at the far end of the wire (the minimum pullup resistance recommended for the 6n137) and input that direct to an atmega328 pin.
Or should I insert a line driver buffer, push pull logic etc there to actively drive the line high? My reasoning is, I will be pulling the line down actively with a sink current of 50mA and a capacitance of 2nF which will result in a plenty fast transition. With a 330R resistor pulling a 2nF line up thats a time constant of 660ns if I remember correctly. For the low baud rate I am aiming for surely thats plenty? How fast could I probably push the speed with a setup like this?
EDIT: Don't want to get bogged down in software considerations, but it was suggested that I should put this additional info in the question rather than just a comment: This is a custom synchronous bit banged protocol, not 9N1 serial with UARTs. It has a separate clock wire. Timing wise its designed to be able to 'wait' mid byte, which is a desired trait. Its a one to many on the master transmit line and a one to one on the master rx lines. The peak bit rate is 9600 but it can slow down to a stop at any point during the communication. That said, really the problem (question) I have is the electrical side of things, and how to keep it as simple as possible electrically (while compensating to a degree in software with redundancy and crc). The actual data transfer requirements are very low, maybe 20 bytes per second total at the master shared throughout all the slaves, in bursts every few seconds.