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

rs232 cable length

mizemize Posts: 15
edited 2005-11-18 15:21 in BASIC Stamp
·i set· up a bs2 based environmental monitor in my greenhouse to measure temperature, humidity and light levels.· i connected·a 100 foot rs232 cable to the programming port and ran the other side to my pc in the house where i accessed the data into stampdaq.· so far i get flawless data transfer.· My question is, how long a cable can you use?

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-18 12:49
    The standard says 16 meters (or 50 feet) at 19200 baud.
    The program port operates at 9600 baud which is half 19200 baud.
    So you can have the double distance (100 feet).
    Your 100 feet is pretty much it, but it also depends on environment noise and cable quality.
    regards peter
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2005-11-18 14:20
    A few of us had an exchange on this in another forum:

    http://forums.parallax.com/showthread.php?p=556409
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-11-18 14:51
    I have quite a bit of confusion about this at first.· I had·read somewhere that 50 feet was the limit.· I started looking at other standards [noparse][[/noparse]like RS-422 and RS-485]

    But then,·it was pointed out to me that the RS-232 is a standard which can be stretched or abused.

    As far as stretching the standard, you can go farther if you can go slower baud.· You may be able to get 1000' at 300 baud if you are not abusing the standard.

    Abuse? How does it get abused?· Well the standard was designed for +12 and -12 output, but pretty well accepted at +9 and -9 upon arrival.· Then laptops just jumped in and supplied only +3.3 and -3.3 because of their power supply limitations [noparse][[/noparse]before Maxim created the MAX232].

    As you can see we have gotten lower and lower voltages driving the cable.

    Finally allong comes the flash microprocessor and units like the BS2 with serial boot programing which·seem to only provide the +5V and not the minus due to the further compact size.··This works fine with programming reception, but transmission of any distance is questionable. You can drive an adjacent serial LCD, but long wires and higher speeds might fail. After all half the standard's output·is missing.

    If you want to transmit longer distances and at higher speeds, it is best to restore the standard through the use of a MAX232 with a BasicStamp or A laptop.· In both cases you can build a little RS-232 repeater for about $10 or you can buy a premade one for about $50.

    The $10 repeater will only provide Rx and Tx as a true repeater, if you want two additional hardware control lines you can do that with The MAX232 when using a BasicStamp's TTL outputs.· But, it may be cheaper just to buy a good repeater that has all the control lines for a laptop and general all purpose use.

    Much depends on how you choose to use your RS-232 and what kind of handshaking is required to avoid data loss.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When all think alike, no one is thinking very much.' - Walter Lippmann (1889-1974)

    ······································································ Warm regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 11/18/2005 2:57:41 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-11-18 15:21
    What happens with long cables is the capacitance of the cable rises with length.

    The practical effect of this is to 'low-pass filter' your signal. It turns out a 'nice' square wave looks square because of lots of high frequency components. A 'pure sine' wave only has the 'fundamental' frequency. So, when you filter out those high-frequency components in a long cable, your signal 'rounds-over', looking more and more like a sine-wave pulse.

    Now, RS232 deals with this pretty well. So, if you're using a Max232 chip, which provides a +- 10 volt signal, and you're driving at relatively low baud rates (like 9600), and you use a good-quality controlled impedance cable (like CAT-5e) you should be able to get reliable communication out to 150 feet. Note the RS485 standard is good to 4000 feet, if you need that.

    You can tell if you're trying to go too far when your data starts becoming 'garbled'. When that happens, the capacitance in the cable has become so high (and the rise-time of the cable so slow) that your 'bits' never reach full value before the reciever samples the signal. Thus it gets the 'wrong' value.

    Also note that as an Engineer, when I apply an industry standard, I want absolute reliability.· As a hobbyist, I can 'tweak' each solution until it works.· So, as an Engineer, I wouldn't design a system that used RS232 for more than 50 feet.· As a hobbyiest, I would try it and see what worked.


    Post Edited (allanlane5) : 11/18/2005 3:24:32 PM GMT
Sign In or Register to comment.