Shop OBEX P1 Docs P2 Docs Learn Events
cable length question — Parallax Forums

cable length question

guydbguydb Posts: 29
edited 2005-12-23 08:35 in BASIC Stamp
hi,
I am wondering what the maximum cable length is to connect to the stamp I/O to send serout commands, and how long the cable can be to connect to the RS232 of a computer. I guess it depends opn the capacitance of the cable.
my experience with midi is for instance that I shouldn't go beyond 15 meters (50ft) unless I use a midi line driver. I guess I could I use a midi line driver to drive any stamp output? or am I mistaken?
thanks,
guy

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-12-22 15:02
    Guy -

    Unfortunately, I'm not familiar with midi or midi line drivers, so I can't pass on that. As far as RS-232 is concerned, much depends on the local environment, and the type of cable you use, as well as whether you use an RS-232 line driver (ex. Maxim MAX-232).

    In a fairly "clean" environment with no equipment or environmental conditions causing any EMI, RFI, static, or similar "noise" your chances for long length transmission are far greater. The use of CAT-5 or decent quality, shielded cable (preferably random-lay, twisted pair) is also highly recommended under these circumstances. Ground ONLY one side of any shield within the cable. This will reduce, but not eliminate some of your stated transmission line capacitance concerns.

    Next, the use of an RS-232 line driver is HIGHLY recommended. Without such a driver, your distance will be severly limited, by voltage drop, if for no other reason. Any Stamp pin port (other than pin port 16) will only be producing RS-232 signals with +5 volts DC, and 0 volts, rather than the more ordinary +12 VDC and -12 VDC. The RS-232 line driver will boost the +5 VDC to +12 VDC, and drop the 0 volts to -12 VDC for you.

    Lastly, the line SPEED (baud rate) will have a large impact on how far you can transmit. Although some may find it couter-intuitive, the SLOWER the line speed, the better chance you have at successful transmission over longer distances.

    When faced with this type of problem in the past, what I have generally done is to start with a very low baud rate (300 - 1200 baud) but a full length of cable, and check for errors at that point. Once that is stable, jump up to the next logical level (2400 - 9600 baud) and test the system there. If that is stable, just keep boosting the baud rate UNTIL you see errors. At that point, back off one step and consider that your maximum baud rate.

    Ostensibly, the maximum cable length for RS-232 (based on the specifications) is stated as 50 feet, but I've never found that to be any sort of a barrier except at extremely high speed (115 KBPS and up). My own experience would indicate that at reasonable baud rates (19.2 KBPS and below), and with decent components, you should be able to achieve 250-500 feet consistantly. I have gone well over 500 feet without a line driver (but WITH an original +12 VDC and -12 VDC signal). With a line driver and optimal conditions, I've seen 9600 baud go 1500+ feet, but data error detection and a re-transmision scheme is a MUST at such distances as that.

    Lastly, you can use a differential method (ex. RS-422) and regularly achieve distances well in excess of 4000 feet, with less than pristine conditions, if neeed be. Many companies (Maxim, TI, National Semi, etc) all make RS-232 <--> RS-422 conversion/driver chips.

    Regards,

    Bruce Bates
  • guydbguydb Posts: 29
    edited 2005-12-22 19:26
    thank you for this detailed explanation.
    I will check the rs232 line drivers.
    midi is serial communication (using serout), so my guess is it is the same.
    guy
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-12-22 20:51
    Im not sure if sticking a RS-232 driver in will work, RS-232 is voltage based (+12/-12), whereas midi is current based (5mA current loop), sticking a cable being driven by RS-232 voltages could damage any midi equipment the cable is plugged into. The transport layer (communication protocol)·and physical layer (hardware)·are two seperable issues, the physical layer cannot be deduced from the transport layer (in lay terms: knowing the communication protocol doesn't provide any information on how the physical signaling is done).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 12/22/2005 8:55:47 PM GMT
  • guydbguydb Posts: 29
    edited 2005-12-23 08:35
    thanks...I'm still at the theoretical stage of the project, so no damage done so far, but I will need to drive both rs 232, midi and regular pin out long distances. I do have a midi merger which can function as a line driver and zhich I will try for other serouts.
    guy
Sign In or Register to comment.