Author Topic: Long distance serial communication  (Read 15367 times)

0 Members and 1 Guest are viewing this topic.

Offline grimmjawTopic starter

  • Regular Contributor
  • *
  • Posts: 80
Long distance serial communication
« on: April 16, 2015, 05:21:59 am »
Hi  guys,

I have two microcontroller that need to send data to each other.The distance between this two micros is 100meter.
Has anyone has suggestion for the best communication protocol and type of cabel for long distance communication.

The communication need to be very reliable and doestn't need to be fast

Thanks
 

Offline BradC

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
Re: Long distance serial communication
« Reply #1 on: April 16, 2015, 05:30:12 am »
Hi  guys,

I have two microcontroller that need to send data to each other.The distance between this two micros is 100meter.
Has anyone has suggestion for the best communication protocol and type of cabel for long distance communication.

The communication need to be very reliable and doestn't need to be fast

Thanks

I've done nearly that far on a pair of salty wet strings. It wasn't fast, but it was reliable and won me a bet.

I'd just use RS422/485 and be done with it. 8 pin transceivers are cheap these days and you'll push a lot of bits over only 100 meters
If it was _really_ slow you could use a hacked up one wire style protocol. Again cheap and reliable, but RS485 buys you speed and noise immunity.
 

Offline LabSpokane

  • Super Contributor
  • ***
  • Posts: 1899
  • Country: us
Re: Long distance serial communication
« Reply #2 on: April 16, 2015, 05:43:19 am »
422/485 is your huckleberry.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9954
  • Country: nz
Re: Long distance serial communication
« Reply #3 on: April 16, 2015, 06:05:14 am »
Yep 422/485.
Ideally at a low voltage like 2V.

The faster you switch the worse the problem gets and the lower the voltage you need.

Unless its super slow, like 100baud, a 12V digital signal down 100m of cable will get high voltage ringing from the cable inductance and something will blow.
 When I tried 24V I got 160V !!!
« Last Edit: April 16, 2015, 06:08:16 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4228
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Long distance serial communication
« Reply #4 on: April 16, 2015, 07:11:15 am »
The baud rate won't make the slightest difference to the voltage generated by inductive ringing. If it's an issue at all - and in 10 years' designing serial equipment professionally I never once saw a problem - then the edge speed (dV/dt) is the governing factor, not the number of edges per second.

Terminate the signal properly at the receiver and you won't have a problem.

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Long distance serial communication
« Reply #5 on: April 16, 2015, 07:25:36 am »
Make very sure that there is electrical isolation between the two ends.

You can get very large voltages where you don't expect them for a wide range of reasons, ranging from nearby lightning strikes, to different mains phases, to generated or environmental noise.

Fibre optic cables can have a very long range and are inherently isolated. Seriously consider using them in preference to copper.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19536
  • Country: gb
  • 0999
Re: Long distance serial communication
« Reply #6 on: April 16, 2015, 07:52:06 am »
Yep 422/485.
Ideally at a low voltage like 2V.
The disadvantage with low voltages is susceptibility to noise.

Quote
The faster you switch the worse the problem gets and the lower the voltage you need.

Unless its super slow, like 100baud, a 12V digital signal down 100m of cable will get high voltage ringing from the cable inductance and something will blow.
 When I tried 24V I got 160V !!!
That's because you didn't properly terminate the cable. If you'd terminated the cable properly you could've gone much faster and not had any problems with ringing or high voltages.
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4228
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Long distance serial communication
« Reply #7 on: April 16, 2015, 07:56:44 am »
Does the cable between the two micros ever leave the building, or are the two units both inside the same building and connected to the same electrical distribution system?

Offline electr_peter

  • Supporter
  • ****
  • Posts: 1305
  • Country: lt
Re: Long distance serial communication
« Reply #8 on: April 16, 2015, 08:10:18 am »
RS485 - differential pair, good serial speed, robust, 100-300m or longer lines (termination and impedance matching of cables is needed), can provide small power as well. Isolators on each end can be added if that is deemed necessary.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9954
  • Country: nz
Re: Long distance serial communication
« Reply #9 on: April 16, 2015, 09:18:00 am »
Yep 422/485.
Ideally at a low voltage like 2V.
The disadvantage with low voltages is susceptibility to noise.

True, but 2V is good enough for ethernet 100Megbit at 100Meters
So it's good enough for some serial coms over 100Meters without noise issues
And you can get +/- 2V easy enough from 5V
« Last Edit: April 16, 2015, 09:20:03 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline Cliff Matthews

  • Supporter
  • ****
  • Posts: 1910
  • Country: ca
    • General Repair and Support
Re: Long distance serial communication
« Reply #10 on: April 16, 2015, 10:24:41 am »
Grimmjaw, you given no application specifics.
There's a bucket-load of Linear devices here - http://www.linear.com/parametric/rs485|422_transceivers and TI has more.
Also, Jameco has ~160 devices under $5 and many have ESD protection to 10kv:
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Long distance serial communication
« Reply #11 on: April 16, 2015, 11:14:37 am »
Be aware that ESD protection may be insufficient for you, since ESD implies short duration and low current.

You may encounter long durations and high currents. Seriously consider electrical isolation.
« Last Edit: April 16, 2015, 12:56:38 pm by tggzzz »
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5319
  • Country: gb
Re: Long distance serial communication
« Reply #12 on: April 16, 2015, 11:27:28 am »
About 15 years ago I ran 300bps simplex serial comms over a single coax run that was 180' between my flat in the basement of a block up to the roof where I had my antennas and preamps etc. The comms allowed me to change antennas and switch the preamps on and off remotely. The coax also ran RF from HF up to 1.3GHz, and 24V DC.

The signalling was a simple UART stream, with largish inductors at each end to pass the serial stream and DC power but reject the RF that was sniffed off with a 10nF cap. That was up there for about ten years.

I wrote it up too. http://www.g6lvb.com/remote_control_of_mast_mounted_e.htm

I guess you'd call it a one-wire solution, but it's much simpler than the Dallas/Maxim 1-wire protocol.
 

Offline Quark-elec

  • Contributor
  • !
  • Posts: 12
Re: Long distance serial communication
« Reply #13 on: April 16, 2015, 12:28:25 pm »
do you need something remote controller that control the switch?
 

Offline Cliff Matthews

  • Supporter
  • ****
  • Posts: 1910
  • Country: ca
    • General Repair and Support
Re: Long distance serial communication
« Reply #14 on: April 16, 2015, 01:49:44 pm »
I vote for the diminutive, 39-cent, 8-pin TI SN75176  Info: http://www.ti.com/product/sn75176a

Applicable serial comms page: http://www.siongboon.com/projects/2006-03-06_serial_communication/
and a project on daisy chaining the Arduino: http://geodesicsphere.blogspot.ca/2012/12/daisy-chaining-serial-connections.html

It sounds like I should break-the-bank and buy a few... - I like the comment Andres G. on December 3, 2012 posts:

Go with RS485 at a normal 9600 baud rate: no daisy chain but parallel connected slave nodes on a single line is the way to go (DMX anyone?). Still you would need to address them but c'mon it's a lot easier and faster to program "snif for your address" than "repeat the whole stream of data while you search for your part."  Burning the address on the eeprom is not that hard and doesn't require IO pins, just the usb programming in case of arduinos. Also that way you make sure that the remote controlled flame thrower doesn't shoot because you connected the terminal cables in the wrong order.

As a bonus everything works directly from +5V, can connect everything with the cheapest ugliest twisted pair you can find and still get range, also the RS485 converter chip (SN75176) cost something like ten cents each.
 

Offline TimFox

  • Super Contributor
  • ***
  • Posts: 7957
  • Country: us
  • Retired, now restoring antique test equipment
Re: Long distance serial communication
« Reply #15 on: April 16, 2015, 02:36:38 pm »
For unidirectional signals, an RS-422 differential output, being current limited, can drive an opto-isolator LED directly (add a PN diode across the LED for reverse voltage).
 


Offline grimmjawTopic starter

  • Regular Contributor
  • *
  • Posts: 80
Re: Long distance serial communication
« Reply #17 on: April 16, 2015, 03:19:41 pm »
seem likes Rs485is the best bet.I'm not sure i understand the need to be insulator tho  :-//.
the cabel is inside the same building
 

Offline Cliff Matthews

  • Supporter
  • ****
  • Posts: 1910
  • Country: ca
    • General Repair and Support
Re: Long distance serial communication
« Reply #18 on: April 16, 2015, 03:40:10 pm »
seem likes Rs485is the best bet.I'm not sure i understand the need to be insulator tho  :-//.
the cabel is inside the same building
You never know who's going to drag your cable over some polyester carpet, or what other ESD lurks around (not trying to spread FUD here though..) but I see 73-cent TVS diode-based line protectors here:

http://www.mouser.com/Texas-Instruments/Circuit-Protection/ESD-Suppressors/TPD2E007-Series/_/N-jy72Z1yyuwnyZ1z0zls6
Could save you a lot of pain later... your choice.

Grimmjaw, You never stated your application (cable length, speed, devices etc..), care to elaborate?
 

Offline LabSpokane

  • Super Contributor
  • ***
  • Posts: 1899
  • Country: us
Re: Long distance serial communication
« Reply #19 on: April 16, 2015, 04:28:56 pm »
seem likes Rs485is the best bet.I'm not sure i understand the need to be insulator tho  :-//.
the cabel is inside the same building

It's all too easy to get a ground loop or induced interference over that distance if each unit is powered separately.
« Last Edit: April 16, 2015, 04:34:46 pm by LabSpokane »
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Long distance serial communication
« Reply #20 on: April 16, 2015, 04:33:15 pm »
seem likes Rs485is the best bet.I'm not sure i understand the need to be insulator tho  :-//.
the cabel is inside the same building

Sometimes you will encounter sockets running on different phases of the mains.

Often you find different neutral leads at different potentials above ground potential, especially if there is heavy machinery or a higher load on one phase than another.

In some circumstances different bits of ground can be at very different potentials (that's why, if you are caught in the open in a thunderstorm, you shouldn't stand with legs apart, or kneel down!). "Ground" and "earth" are a convenient fiction in both RF and mains supplies :(

And then there are the gross wiring/installation faults that have - so far - gone unnoticed.

If you connect a conductor where any of those are present, a current will flow until the magic smoke is emitted from something or someone.

Notice I haven't even bothered to mention interference that might corrupt your signal - that's comparatively trivial.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline grimmjawTopic starter

  • Regular Contributor
  • *
  • Posts: 80
Re: Long distance serial communication
« Reply #21 on: April 17, 2015, 03:11:10 am »
i see..make sense since the devices with be main powered.
I think i will isolate the signal with optocoupler.
BTW  abit information regarding the project, the secondary uCoi will read a few sensors and will send the information back to main uCon (console)
The secondary uCon just need to send data once every hour.

 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16284
  • Country: za
Re: Long distance serial communication
« Reply #22 on: April 17, 2015, 04:28:41 am »
If it is only a low data rate the simplest is just to go and use TOSLINK units, like they use for audio data, and the cabling. The transmitter and receiver units are cheap, as they are in pretty much every DVD player and many PC sound cards, and the cabling itself is cheap as well, though you will have to use real glass fibre for longer distances. That will work for up to 115k data rate, though if you want bidirectional communication you will need 2 cables, which comes as a pair that looks like a thicker speaker figure 8 cable.
 

Offline Laura

  • Contributor
  • Posts: 18
  • Country: us
Re: Long distance serial communication
« Reply #23 on: April 17, 2015, 07:40:28 am »
I think i will isolate the signal with optocoupler.
BTW  abit information regarding the project, the secondary uCoi will read a few sensors and will send the information back to main uCon (console)
The secondary uCon just need to send data once every hour.

Once upon a time, a lot of communicating devices had an option for a 20ma current loop in place of, or in addition to, an RS232 interface. The implementation usually used an optocoupler. The data was as async serial using some suitably low baud rate.
 

Offline BradC

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
Re: Long distance serial communication
« Reply #24 on: April 17, 2015, 07:44:58 am »
Once upon a time, a lot of communicating devices had an option for a 20ma current loop in place of, or in addition to, an RS232 interface. The implementation usually used an optocoupler. The data was as async serial using some suitably low baud rate.

Sounds a lot like MIDI
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Long distance serial communication
« Reply #25 on: April 17, 2015, 08:00:18 am »
i see..make sense since the devices with be main powered.
I think i will isolate the signal with optocoupler.
BTW  abit information regarding the project, the secondary uCoi will read a few sensors and will send the information back to main uCon (console)
The secondary uCon just need to send data once every hour.

Don't forget about grounds, shields and any other bits of wire going between each end. The physics doesn't care what you call the wire :)

I strongly suggest you do some research into how industrial systems are constructed, and why. You are, after all, building an industrial system, not a domestic system. I'll note, again, that a fibre optic link simply, visibly (ho ho), automatically resolves all these issues.

I'm afraid that I don't have a collection of useful references for this topic, since I've never had to design such equipment. The best I can offer as a starting point is Tim William's Circuit Designer's Companion, as on https://entertaininghacks.wordpress.com/library-2/bookshelf/
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19536
  • Country: gb
  • 0999
Re: Long distance serial communication
« Reply #26 on: April 17, 2015, 08:49:41 am »
I vote for the diminutive, 39-cent, 8-pin TI SN75176  Info: http://www.ti.com/product/sn75176a
I agree. The SN75176 is designed for this. Just add the appropriate termination resistors and off you go.
 

Online mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13749
  • Country: gb
    • Mike's Electric Stuff
Re: Long distance serial communication
« Reply #27 on: April 17, 2015, 09:12:45 am »
I vote for the diminutive, 39-cent, 8-pin TI SN75176  Info: http://www.ti.com/product/sn75176a
I agree. The SN75176 is designed for this. Just add the appropriate termination resistors and off you go.
75176 is pretty ancient and power hungry - there are better low-cost devices from ST (ST485 and ST3485) and Intersil (ISL83xxx).
If you need isolation, AD's ADM2582E is nice as it integrates the data isolator and isolated power. A little expensive - Silabs and others have some cheaper isolators but you need a seperate DC/DC.
For a 1-way link, I like the NVE passive input isolators, as they don't need isolated power or a ground connection. 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline andersendr

  • Regular Contributor
  • *
  • Posts: 56
  • Country: us
Re: Long distance serial communication
« Reply #28 on: April 21, 2015, 04:28:05 am »
Instead of rolling your own solution, why not just buy an off the shelf Ethernet module.  They are a serial device and can handle your distance without issue.  If you want a complete standalone solution, drop a RS232 converter on your board and run a simple serial server (http://www.digi.com/products/serialservers/digionesp).  I'm sure you can get other transceivers for other protocols also. 
 

Offline LabSpokane

  • Super Contributor
  • ***
  • Posts: 1899
  • Country: us
Re: Long distance serial communication
« Reply #29 on: April 21, 2015, 06:11:28 am »
Instead of rolling your own solution, why not just buy an off the shelf Ethernet module.  They are a serial device and can handle your distance without issue.  If you want a complete standalone solution, drop a RS232 converter on your board and run a simple serial server (http://www.digi.com/products/serialservers/digionesp).  I'm sure you can get other transceivers for other protocols also.

Lantronix makes many board-level solutions for this as well. And for an air-gapped network it's a great solution. One it hits the interwebs, you become responsible for security and that configuration and testing process can become far more involved - even though the manucturer assures you that the device is "secure."  Serial to IP devices do a lot of wonderful things, but the more a device can do, the dangerous it is in inexperienced hands.

http://www.mouser.com/Search/Refine.aspx?Keyword=Lantronix+xport
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf