Arduino Forum

Using Arduino => General Electronics => Topic started by: magnethead794 on Dec 13, 2011, 07:11 am

Title: Serial communication distance
Post by: magnethead794 on Dec 13, 2011, 07:11 am
I'm using a 12db antenna on the end of my bluesmirf RPSMA and get ~600ft of LoS range and 300 ft of non-LoS range to my cell phone. Adding extension cable will reduce gain, so I'd like to take the bluesmirf off the project box, and have it at the end of a ~10 ft cable.

Is this attainable for a 5 volt Serial connection, or am I barking up the wrong tree and Ohm's Law will take over?

What about a 20 ft cable?
Title: Re: Serial communication distance
Post by: pwillard on Dec 13, 2011, 08:00 pm
Serial Communication at TTL signal levels (0 and 5V) is very distance limited.  At 10 Feet or more you are inviting spurious noise and strong ambient signals onto your communications path.  This is why the RS232 driver chips were invented.  

RS232 uses +/- ~12V level signalling with much in the way  of voltage margin for 1's and 0's

Adding RS232/RS485 drivers is what you want to pursue if going more than several feet.  MAX232 would be a good start.

Example: I've been able to run 4800 baud connections at 4500'.
Title: Re: Serial communication distance
Post by: zoomkat on Dec 14, 2011, 02:01 am
Well, you could get some cat3 four conductor telephone wire and give it a try.
Title: Re: Serial communication distance
Post by: goofballtech on Dec 14, 2011, 02:52 am
at work I have run rs232 150+ feet at 38400 baud.

115200 baud rs232 tends to drop out around 50 feet for me.

baud rate and the device you are ouputing frrom make a fair difference for ditances.

if you are looking for long distances 485 or 422 conversion is certainly the way to go as mentioned above.

Title: Re: Serial communication distance
Post by: magnethead794 on Dec 14, 2011, 06:05 am
15 ft is about the absolute max I would be planning to go. 20 would be too long for what I want to do.
Title: Re: Serial communication distance
Post by: magnethead794 on Dec 14, 2011, 10:38 am
So I'm thinking to use a 5M Cat5 cable (cheap, easy to get) with the power/ground on one set of twisted pairs, and the Rx/Tx on another set of twisted pairs. Would this be okay without too much data degradation?

Would I want to leave the other 2 pairs open, or ground them all?

RJ45 breakout with mounting holes -> http://microcontrollershop.com/product_info.php?products_id=3463

I just realized I can use this inplace of a DB9 for the LCD connection as well- it has 7 data/power lines, and I have a switch that pulls an 8th line low. And it will look much cleaner.
Title: Re: Serial communication distance
Post by: pwillard on Dec 14, 2011, 07:51 pm
No, wrapping TX and RX around each other  will accomplish the opposite of what twisted pair is designed to do.  You wrap a TX or RX signal with a wire at ground potential.

If done your way, at each END of the wire run,  TX is wrapped next to RX, soooo  the TX signal has the potential to BLEED into the RX signal at a point where TX is strongest and RX signal is weakest... Make sense?  Wrapping with ground signal helps tp provide some blockage of the stronger signal that wants to interfere.
Title: Re: Serial communication distance
Post by: magnethead794 on Dec 14, 2011, 09:09 pm
So pair Rx and GND, GND and 5V, GND and GND, and Tx and GND?

Or pair 5V with a N/C wire?
Title: Re: Serial communication distance
Post by: magnethead794 on Dec 15, 2011, 06:53 am
Any Answer?
Title: Re: Serial communication distance
Post by: zoomkat on Dec 15, 2011, 06:59 am

Any Answer?


Sure, twisted pair wire may cause more trouble than help. Get 20' of four conductor telephone wire and give it a try using three of the conductors for tx/rx/gnd.
Title: Re: Serial communication distance
Post by: magnethead794 on Dec 15, 2011, 07:19 am


Any Answer?


Sure, twisted pair wire may cause more trouble than help. Get 20' of four conductor telephone wire and give it a try using three of the conductors for tx/rx/gnd.


Phone wire will plug into an RJ45 right? I just have to find the 4 conductor wire? (I'm assuming put Rx and Tx on the ends with ground in the middle?)
Title: Re: Serial communication distance
Post by: zoomkat on Dec 15, 2011, 07:35 am
Quote
Phone wire will plug into an RJ45 right? I just have to find the 4 conductor wire? (I'm assuming put Rx and Tx on the ends with ground in the middle?)


The four conductor telephone wire is available most everywhere, Radio Shack, Lowes, Home depot, even at the DollarTree at times. The RJ45 connector has eight wire slots, so you put the wire ends in the slots you want to use and then crimp them. I use telephone wire to connect some of my computers to my router in a 10baseT configuration.
Title: Re: Serial communication distance
Post by: magnethead794 on Dec 15, 2011, 07:58 am
so instead of using the RJ-14 plug, cut it off and stick an RJ-45 on it?
Title: Re: Serial communication distance
Post by: MarkT on Dec 15, 2011, 09:20 pm
If your signal is relatively low bandwidth you can get away with longer distances - but the receiver circuitry needs a low-pass-filter (R+C) and schmidt-trigger to filter out the high speed noise and reflections and generate a proper logic level again.  If you want to send logic speed signals (10's of MHz) then you have to use the cable as a transmission line with proper line drivers and receivers.

For 10 feet you may get away with it.
Title: Re: Serial communication distance
Post by: magnethead794 on Dec 16, 2011, 03:56 am

If your signal is relatively low bandwidth you can get away with longer distances - but the receiver circuitry needs a low-pass-filter (R+C) and schmidt-trigger to filter out the high speed noise and reflections and generate a proper logic level again.  If you want to send logic speed signals (10's of MHz) then you have to use the cable as a transmission line with proper line drivers and receivers.

For 10 feet you may get away with it.


Right now I have it linked up at 115,200 bps. But after researching, I'm tempted to drop it down to 9600 because of the wire's inductance and capacitance properties.
Title: Re: Serial communication distance
Post by: zoomkat on Dec 16, 2011, 07:18 am
Quote
so instead of using the RJ-14 plug, cut it off and stick an RJ-45 on it?


You usually use a plug that matches what ever jack you are using.
Title: Re: Serial communication distance
Post by: magnethead794 on Dec 16, 2011, 10:35 am

Quote
so instead of using the RJ-14 plug, cut it off and stick an RJ-45 on it?


You usually use a plug that matches what ever jack you are using.


I checked with the distributor, he said he's going to check for me when he gets back to the office. But he agreed with me that 98% of RJ-45 jacks also take RJ-11, RJ-14, and RJ-25 plugs. The only ones that don't are laptop RJ-45's since they have to be of foolproof architecture (since they're side by side with the modem jack)

I already have a 6m 4 conductor RJ-14 phone cord+plug, so why re-terminate if I don't have to.
Title: Re: Serial communication distance
Post by: magnethead794 on Dec 28, 2011, 10:37 am
So just for testing, I took a 2m piece of Cat5 that my cat chewed through, and wired it up with no terminals, just soldered up headers. I took all of the striped wires and solid orange for ground, blue is 5 volts, green is Tx, and brown is Rx. Seems to be working alright.