Shop OBEX P1 Docs P2 Docs Learn Events
Baud rate --- Propeller 1200, 2400 , 4800 ??? — Parallax Forums

Baud rate --- Propeller 1200, 2400 , 4800 ???

markustermarkuster Posts: 184
edited 2014-01-06 20:44 in Propeller 1
Hi,
I need to connect a Propeller microcontroller with a long cable to a PC.

I will use 150 feet RJ45 cable CAT 6.
I had some problems using 9600 baud rate. I need to transmit just data
from the Propeller to the PC

I would like to know if I can use lower speed like 1200 baud rate in order
to ensure good connection.

What do you think if this speed will help ?
Is 1200 too slow ?
Is there any real difference between 1200 and 4800 baud rate ?

Thanks,

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-12-31 07:04
    Well, 150 feet is a bit long for RS232 and you are taking the right approach by going slower for better results. But you can go lower.. say 300 baud, 150 baud and so on.

    This is substantially about noise interference. But there is also an problem in that today's RS232 ports may drive just between 0-5 volts instead of adherding to the older standard of -12/+12. A lot of products just don't want to bother with dual voltage and higher voltage power supply for the RS232 communications.

    If that is not to your liking, you can use the same code that RS232 serial uses with a full duplex RS422 chip set. That takes four wires, but will bring the speed back up to as high as 115,200 baud and the distance of 1000 meters being reasoable.

    I have built RS422 full duplex and worked with a RS232 to RS422 adapter from my computer to the Propeller over 100 meters of LAN wire, that CAT5 stuff that has 8 tiwisted pairs.

    It is a bit easier if you don't want to program the Propeller of the wire, but you can also do that if you are wiling to use 3 twisted pairs, instead of the usual 2 twisted pairs.

    I am NOT a supporter of USB to CAT5 to USB as it introduces more layers of format change and can be more buggy.

    I'll try to locate the thread earlier this year where all the debat and designes for RS422 were discussed. That's when I built my current set up.

    http://forums.parallax.com/showthread.php/149387-Your-longest-serial-cable-connection

  • kwinnkwinn Posts: 8,697
    edited 2013-12-31 08:32
    Are you going to try to do this using the USB boosters you posted a link to in an earlier thread? If so, you need to know that the signal over the cat5/6 is not RS422, but the amplified differential USB signal. The typical RS422 connection used to go from a PC to a controller or other circuitry consists of a USB - RS422 converter on the PC end, the cat5/6 cable, and an RS422 - TTL transceiver IC on the other end.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-12-31 09:05
    You can get one of the following for the computer end.

    A. An RS232 to RS422 converter
    B. A USB to RS422 convert (FTDI sells a cable that will even include the RS232 control signals to program the Propeller at a distance.)

    At the Propeller end, you need a RS422 reciever and an RS422 tranmitter for full duplex Rx and Tx. If you want to program the Propeller, another RS422 reciever is required and it will drive the RST line via a transistor.

    ********************
    The above is Not expensive in comparison to the long distance USB - CAT5 - USB setup. And I feel it is easier to work without the USB ports being involved at both ends.

    You also end up with a setup that will go farther distances... up to about 1000 meters without repeaters. But limitless if you use RS422 repeaters.

    http://forums.parallax.com/showthread.php/142386-Simplest-RS485-to-RS232-conversion
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-12-31 09:24
    Below is the best thread on building a full duplex RS422 solution. It was a bit difficult to find.

    I guess you already know all about it as you are the original poster.

    http://forums.parallax.com/showthread.php/149224-I-need-to-know-the-best-cable.?highlight=RS422+loopy
  • markustermarkuster Posts: 184
    edited 2013-12-31 10:15
    Thanks,

    But is it better to use less speeds like 1200 baud instead of 9600 baud to ensure better comunication ?

    You wrotte "300 baud" .

    Is 300 baud an usefull speed to send a simple object detection data from the Propeller
    to a PC ( 50 readings per second ) ?



    Thanks again.
  • MicksterMickster Posts: 2,694
    edited 2013-12-31 10:40
    It is better to simply ensure signal integrity, per Loopy's suggestion.
  • markustermarkuster Posts: 184
    edited 2013-12-31 12:02
    Hi,

    But the problem is how to know the speed.

    I think if the speed is too low , it will be impossible to send the total amount of data.

    For this reason could be usefull to know how I could calculate the better speed
    and for this reason I am asking if the speed is important or not as important than
    other like cable manufacturer , cable lenght or cable CAT 5 or 6., etc

    I don't know if I am explaining my self.
    Thanks.
  • MicksterMickster Posts: 2,694
    edited 2013-12-31 13:43
    Have you tested the "Parallax Serial Terminal" object?

    USAGE:
    • Call Start, or StartRxTx, first.
    • Be sure to set the Parallax Serial Terminal software to the baudrate specified in Start, and the proper COM port.
    • At 80 MHz, this object properly receives/transmits at up to 250 Kbaud, or performs transmit-only at up to 1 Mbaud.
  • Mark_TMark_T Posts: 1,981
    edited 2013-12-31 15:25
    I wonder if anyone's tried using IR protocols (38kHz modulation) directly over a long line - after all IR receivers are designed to pick a weak
    38kHz out of the noise. If the far end is terminated with a 100 ohm resistor this ought to fly for several km as most of the attenuation
    would be tuned out.

    When using CAT5/6 or course its absolutely vital to send signal/ground over the same twisted pair.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-12-31 16:07
    If you are using twisted pair cable then it lacks a shield and will be very prone to being affected by noise as RS232 is unbalanced and has 300 ohm drive limiting built into it's drivers. This is from the old old days and was meant to protect the delicate driver and also limit the slew-rate etc. The funny thing is if you just run 3.3V or 5V instead from a logic gate or I/O then the noise immunity and speed/distance is much better due to the low-impedance of the driver. The +/-12V has been redundant for decades now as modern receivers only detect a positive voltage so that any voltage above 1.8V or below 1.2V or so will work.

    If you must use TP cable then use a simple balanced driver or even just an RS485 chip locked into transmit or receive plus you can easily run high speeds. Taking into account the actual characteristics of RS232 receivers you will be able to run the output of the balanced receiver directly into the PC RS232 port without the messy and redundant RS232 drive levels. Alternatively you can just try a simple 5V logic inverter gate as the driver all the way down the line straight into the PC, I think you will be pleased to see how simple it can be.

    BTW, 1200 baud is very slow and if your present arrangement isn't working then something is wrong but you should double check that your circuit works with a short cable anyway. I gather that you have not connected any other signals other than your transmit from the Prop and a signal ground which should be on the same pair together.

    Also, the 38kHz stuff mentioned only works because the receiver is AC coupled and "tuned" to that carrier as this circuitry is built-into the IR sensors. Duplicating that at the hardware level is too much work and it's better and easier to just use balanced drivers.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-01-01 04:14
    Mickster wrote: »
    It is better to simply ensure signal integrity, per Loopy's suggestion.

    Reducing the baud rate is a trial and error process that is only worth doing if you really have to. At some point, the wire is either going to be too long or the noise environment to high for any reduction in baud rate to gain anything.

    The RS422 is wonderful as the noise goes away, and nothing is lost in speed. It also can be done with 3.3 volt chips or 5 volt chips -- no weird demands of a complex power supply. And finally, the chips are both very cheap and very easy to wire up.. easier than the Max232.

    I really have no idea if 150 feet of RS232 is feasible. I have never bothered to try it (for all the reasons I have mentioned). And as you mention, the comes a point that you don't want the baud rate to be so slow.

    ~~~~~~~~~~~~~
    I did do a lot of shopping around on the internet for the idea RS422 full duplex with control signals to USB and found the Ftdi has a dongle that is likely the absolute best value. There is really no reason to bother with the junk on EBay when the good stuff is so reasonable.

    FTDI is claiming either 3Mbaud, not just 115,200 baud. It doesn't get any faster or cleaner.


    Use the USBRS422 cable if you just want 2 pair (four wire) full duplex serial to and from the Propeller Or it can also be used to set up a 3 pair (six wire) scheme to program the Propeller from afar.. Cost is about 37 British Pounds shipped to Taiwan. If that is too much, a DIY build of RS223 to RS422 is maybe 1/3 of that cost.


    http://www.ftdichip.com/Products/Cables/USBRS422.htm
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-01-01 08:22
    Hi again,
    I reread the original thread of this topic and someone else says you might be able to do 120 feet at 9600 baud. That might mean 150 feet as well. But that seems to be a starting point from someone with experience. You just have to try it and see if you get good results or nonsense.

    If you get occasional nonsense, you go down by half to 4800 baud and try again. When you get stable good data, you quit.

    ~~~~
    You seem to think that twisted pair wires with one a ground and one going high/low is protected from noise. If really is not as protected as the 'differential pair' of the RS422. What happens in differential pair, one line goes high as the other goes low, and vise-versa. There is no one line that holds to ground... but it manages to be very resistant to noise from outside electrical fields. The transmitter and receiver at each end translate the signal to and from ttl high and low over a very short jump that is less prone to picking up noise than a long wire.
  • potatoheadpotatohead Posts: 10,261
    edited 2014-01-01 11:50
    I've ran 9600 baud over 200 feet with shielded, twisted pair cables right at the beginning of the 90's. The system was running Xenix, and it supported about 15 users running various applications on WYSE terminals. Cables were shielded.
    Is 300 baud an usefull speed to send a simple object detection data from the Propeller
    to a PC ( 50 readings per second ) ?

    A rough divide by 10 gives you characters per second. Unless your object data is really small, 300 baud won't be quick enough. 1200 baud might be, assuming two bytes of data per data unit and a few bytes to mark beginning of packet, time stamp on data set, etc...

    I would shoot for the 9600 personally. It's quick enough, and that leaves you room to do things like send the data twice, include header, time stamp, whatever you want.

    If you fail, a downgrade to 4800 is still quick enough, and both should work well at the target distance you've got, assuming good cables. I did it with the old solid wire clunker cables common to that time period, hand soldered end connectors, etc... Longest connection was almost 300 feet and I can't remember whether or not I had to downgrade that one or not. If I did, it was 4800 baud.
  • koehlerkoehler Posts: 598
    edited 2014-01-02 02:26
    If you need the range, just go with RS422.
    Tons of cheap transceivers available:

    Here's 5 for $5 USD shipped.

    http://www.ebay.com/itm/like/330735703560?lpid=82
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-01-02 08:47
    The MAX487 can do the job, but it is a Half-duplex chip and is limited to 250Kbaud.

    1. Half-duplex means you have to use two chips to get Full-duplex

    2. The lesser baud rate is because the chip has more control of the quality of the signals transmitted and received (easier to build with). That is fine with me as I don't need to go to 3Mbaud. I rarely go about 115,200 baud.

    Yes indeed RS422 full duplex is cheaper than RS232 adapters such as the MAX232
    http://www.ebay.com/bhp/maxim-max232-ic

    And easier to wire.

    http://www.maximintegrated.com/datasheet/index.mvp/id/1111
  • localrogerlocalroger Posts: 3,451
    edited 2014-01-03 05:54
    I have done this many times and you can probably make it work with RS232. Here is what you must do: Run TX and RX in separate twisted pairs, each paired with a ground. At one end of the cable connect BOTH ground wires, but at the other only connect ONE of the two. If you do this there is a good chance the circuit will work at 9600 baud.

    By twisting each signal with a ground, you create a canceling effect that limits the effect of electric field interference because it's positive on one half-twist but negative on the next. Twisting the signals around each other in the same pair is very bad, allowing both signals to pick up EM interference along their entire length and causing strong capacitive coupling between the two lines. You need to hook both ground wires up to ground, but you don't want them to form a loop so you only hook both of them up at one end -- which end doesn't matter.

    If you wire it like this I would give you 80% chance of success. If the wire were shielded I would say 99%.
  • prof_brainoprof_braino Posts: 4,313
    edited 2014-01-03 13:22
    How much dta do you have, and how often do you need to send it? Then you can determine the slowest transmission that will work. Anything below 9600 gets annoyingly slow.

    Also establish that it works with a short cable, as suggested.

    Localroger's grounding scheme sounds like one I saw used that worked over a distance that I though should have been too long. Grounding can get interesting.

    Lastly, what kind of cable are you using? Often, when I have a connection problem it turns out the cable itself is a crappy off brand.
  • kwinnkwinn Posts: 8,697
    edited 2014-01-03 14:06
    While RS422/485 is the current method of choice there is an alternative that provides good noise immunity, reasonably high speeds, simple drive circuitry, and the added benefit of isolation between the connected circuits, so no ground loop problems. A current loop connection needs a small signal transistor at the transmitter end and an opto isolator on the receiving end, so for full duplex simultaneous transmitter/receive it would be two transistors and two opto isolator.

    Really surprised it is not used more often.
  • localrogerlocalroger Posts: 3,451
    edited 2014-01-04 16:35
    Kwinn, current loop is my preferred solution too for long runs at what are considered low baud rates today (< 19200). It not only works better, it's much easier to troubleshoot a failure with a voltmeter since logic 0 = 20 mA flowing. However, I have used RS232 in faux 422 mode with the wiring I described previously many times and it works OK.
  • kwinnkwinn Posts: 8,697
    edited 2014-01-04 19:33
    @localroger

    Good to know I'm not alone in sticking with something that works well and lasts a long time.
  • markustermarkuster Posts: 184
    edited 2014-01-06 18:50
    Hi,

    I tested with 237 feet and it was impossible to "see" the Propeller connected using my PC but know I used
    a 150 feet cable and it is working !!!! .

    I have it at 9600 baud.
    I thought to download to 4800 baud rates to ensure good comunication
    but the complete proyect need 8 Propellers working at a time sending data at the same time
    and perhaps the 4800 baudrates coud be not enought speed for all the Propellers.

    This first Propeller will be the Master be cause all the oother seven Propellers will send the data to
    the Master and only this master will be conected to the PC


    I am using CAT 6 cable twisted and at the beggining of the cable I have B configuration socket and at
    the end of the cable I have the B configuration cable too.

    Do you know how add more cable ?
    I think download the Baude rates to 4800 could be a sulution
    But do you know and other idea '

    Thanks
  • potatoheadpotatohead Posts: 10,261
    edited 2014-01-06 20:44
    Since you have a master prop, use it to compress the data stream and or only send changes. At 4800, you get 480 characters per second. Size all your data for best fit in a third of that to get multiple updates per second. Unpack / populate data field changes on the other end.
Sign In or Register to comment.