Shop OBEX P1 Docs P2 Docs Learn Events
Driving RS-485 network - LTC485 or better? — Parallax Forums

Driving RS-485 network - LTC485 or better?

xanatosxanatos Posts: 1,120
edited 2013-09-16 00:51 in General Discussion
I'm going to be interfacing to an RS-485 network of ICPCON 7017, 4-20ma to RS-485 Data Acquisition Modules. Nice units, 8 channels input and RS-485 out. Addressable, programmable, etc.

I will be talking to these guys with either a BS2px or possibly a Propeller if I can. I'm looking at drivers for the RS-485 protocol - specifically the LTC485. Is that a good choice for use with either of the microcontrollers I may use here, or does anyone have any suggestions/advice for other drivers, etc?

Thanks,

Dave

Datasheets attached for both the LTC485 and the ICPCON 7017 if anyone's interested.
«1

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-09-13 07:19
    I haven't used those particle chips. I have used ST485 as suggested by JonnyMac in his SpinZone article.

    IIRC, Jon used the ST485 because of its low price.
  • stamptrolstamptrol Posts: 1,731
    edited 2013-09-13 07:22
    That chip should work fine for you as its a replacement for the older 75176, which I've used on several large '485 networks with Stamps.

    If I recall, you can tie the two enables together to one Stamp pin to select either "talk" or "listen". Connect DataIn and DataOut together with 1K resistor and tie to a second Stamp pin to either send or receive data.

    I didn't read the whole manual on the modules you're using, but if they have an adjustable "turn around" delay, setting it to 100 mSec or so will assist the Stamp in being ready for the response string after a command is sent.

    Cheers,
  • xanatosxanatos Posts: 1,120
    edited 2013-09-13 07:36
    Good info, thanks. Those modules seem to have every possible configuration available for customization, so hopefully TAD will be among them. Their baud rates are settable from 1200 to 115200 as well. Wish I had found these a few years ago - these would have saved me much PC Board design & building! :-)

    I ordered several of each chip, including the MAX485 (which seems to just be a higher voltage version of the LTC485 on first glance), and I should be able to start playing with everything next week.

    Never worked with RS-485 before. It looks almost like it's just RS-232 with addressing capability :-) Going to read JonnyMac's SpinZone article now, thanks for the link.

    Dave
  • T ChapT Chap Posts: 4,223
    edited 2013-09-13 07:41
    I use the MAX3430 on a a product. Works great.

    http://www.digikey.com/product-search/en?pv7=2&k=MAX3430ESA%2B-nd&mnonly=0&newproducts=0&ColumnSort=0&page=1&quantity=0&ptm=0&fid=0&pageSize=25

    There are clients that talk to this chip from various other systems that I do not have any control over, and never once had a bad communication.
  • xanatosxanatos Posts: 1,120
    edited 2013-09-13 07:49
    Hi T Chap, I just downloaded the MAX3430 datasheet, thanks. So far as I know, I and the 7017s will be the only thing on this 485 network, but who knows what the future holds. I like the failsafe, 80V fault protected features... :-)

    Thanks!

    Dave
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-09-13 07:55
    xanatos wrote: »
    Never worked with RS-485 before. It looks almost like it's just RS-232 with addressing capability

    RS-485 is a balanced line. One wire goes high while the other goes low. By twisting the pair together you insure any noise picked up by one is also picked up by the other so when the signal is recombined the noise cancels out. It actually uses much lower voltages than RS-232 but the RS-485 can use longer wires since there are fewer noise problems.

    Lots of audio equipment use balanced lines as does USB.
  • xanatosxanatos Posts: 1,120
    edited 2013-09-13 08:07
    Good to know, thanks. I've just started looking at data packet and timing diagrams. Looks like I'm going to need a boatload of twisted pair cable as well :-)
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-09-13 08:41
    I started out very passionate about RS-485, but over the years I realized that the two wires mean it is a half-duplex mode of RS-232.

    You modules 115200 baud is at the top end of the range of the generic RS-485 chips. So you need good quality chips that do NOT have slew-rate knocked down. And I suspect that twisted pair should only be ignored for very short distances. (I ignore it all the time with lower baud rates and longer wire.)

    I found that RJ connectors and generic telephone wires worked quite well for distances up to 100 feet for whatever I needed. I didn't try to push the baud rate to anything extreme. I am not even sure the wire had twisted pair, but there is twisted pair phone line wire available. (Sometimes it is informative to use out of spec material that just happens to be lying around.)

    I even purchased the chips you mentioned as they are listed as trancievers, but didn't quite clarify the half-duplex limitation.

    Now I use the RS-422 transcievers which are full-duplex and require 4 wires. They seem a little easier to use in many context as I don't have add an I/O direction pin to switch between recieve and send. One pair is always listening, and the other pair can always talk. You can have RS-422 used as RS-485, but it will echo what it says to itself as well as to the target listener.

    RS-485 is adequate for the BasicStamp2 as the serial was always half-duplex anyway... you can't send and receive at the same time.

    But with PCs and laptops and even the Propeller, full-duplex is available.

    I have to admit I was rather stupid as I thought the 485 indicated a better solution just because it was a higher number than 422. One really has to pay attention to functionality, not labels. It is just a different spec used in a different way.

    Still you should be able to do a lot with RS-485 and it is the chip of choice for a 'party line' configuration where one Master speaks and only the Slave spoken to responds. Just being two wires is handy in many ways.

    You really only need the two pairs (the 4 wire system) if you deisre precise control to interrupt a transmission in progress. And it is not needed in the Master-Slave situation. It just works better if you have a dump terminal that is monitoring a distant activity and you need to assert immediate control.

    There are lots of excellent RS-485 and RS-422 chips out there with various features that increase speed, demand less power, can tolerate bolts of lightning, and so on. So far, I've not needed all the features -- but for the Propeller the 3.3v versions can make your life much simpler if you can solder SMDs.

    I never tried 8 channels of communications to some sort of a hub arrangement. My RS-485 interest was mainly in CANbus which one can daisy-chain. So all the packets and such are entirely different.
  • T ChapT Chap Posts: 4,223
    edited 2013-09-13 08:46
    RS485 is not suited for bi directional full duplex.. It is especially suitable to applications where there are multiple slaves and a single master, where the master submits a query based on an ID included in the query, so that appropriate device will respond.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-09-13 09:13
    Agreed. RS-485 is half-duplex and RS-422 is full-duplex.

    The bugaboo is that RS-232 software can drive both as RS-232 can be coded as half-duplex (like the BasicStamp2) or as full-duplex (like the Propeller and your USB to serial interface).

    This application certainly requires RS-485 as it has 8 independent channels.

    The LTC485 is a good chip for it.
  • xanatosxanatos Posts: 1,120
    edited 2013-09-13 09:37
    The device also only talks RS-485, so that precludes anything else :-)

    Since I'll be doing half-duplex comms on this only anyway - I'll be sending an address and a command, then waiting to hear the data come back, then repeating for the subsequent addresses (there's 10 of the 7017 modules), 485 should be perfect.

    I get to learn something new on every project - that's one of the things that makes this so much fun! :-)
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-09-13 10:05
    I see now, it has only ONE RS-485 port for the support of the 8 channels. (It helps to read the manual). I was thinking it had up to 8 RS-485 ports in that box (a bit stupid of me).

    I got misled when you mentioned you thought you needed a bunch of wire. I suppose most of your wire needs will for the 4-20ma loops side.

    You might find an RS-232 to RS-485 converter and using Teraterm in a regular PC helpful to verify functionality of your sensors.
  • xanatosxanatos Posts: 1,120
    edited 2013-09-13 10:18
    That's the plan - all slaves on a single pair. The master sends the address and command, then listens for the data. It then writes the data locally, and moves to the next address and repeats until all 10 data acquisition modules have been polled, then it starts over again at the beginning. It should be collision free, especially if, as Stamptrol mentioned above, I can put a Turn Around Delay time of 100ms or so in place. Not sure I really need THAT much time - especially with a Propeller or BS2px, but I do like the concept.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2013-09-13 10:23
    I've used the LT1785, which offers more drive capability, and can survive insults in the form of higher voltages ±60V or ESD ±15kV air on the connecting cable. Whether or not that is important depends on the distance and the environment the cable will have to traverse. For example, in one situation I had to connect to an existing twisted pair that disappeared into a conduit and ended up 300 feet away and halfway up a communications relay tower bristling with antennas. Prudence dictated a conservative approach. It is a different situation if the cable only has to cross your desk.

    Both the LTC485 and LT1785 are slew rate limited in order to minimize RFI emissions. Both of those are 5V parts, great for the Stamp, but not for the 3.3V Propeller. As an alternative, the LTC2862 is a new offering from Linear Tech that works from 3V to 5V, fault protected, optionally slew rate limited, and its common mode range for error free operation is widened to ±25V.
  • xanatosxanatos Posts: 1,120
    edited 2013-09-13 10:41
    I like the 60V/15kV protection. Not much local noise (oil tank farm) but long-ish runs, up to 100' or so. I have always liked to over-design a system even if I think it'll never be exposed to the insults I'm designing for - helps me sleep better at night :-) The nice thing is that these chips so far are all pretty cheap. I'm going to have quite a collection to play with because I'm getting a few different ones to play with. Now I'm adding the LT1785 and probably the 2862 as well... Jameco and Digikey love me.

    Thanks for the info!
  • Mark_TMark_T Posts: 1,981
    edited 2013-09-13 12:12
    For fully isolated operations various datasheets recommend using opto isolation between the RS485 receiver and
    host, using an isolated 5V->5V DC-DC converter to power the receiver chip. This would be essential if source
    and destination were on a separate power network (or phase).

    RS485 itself is only the physical layer, no protocol is implied at all I believe.
  • SapphireSapphire Posts: 496
    edited 2013-09-13 13:37
    One thing to remember with RS-485 is that the slaves will hear both the master and the response from all the other slaves. So be sure to design your protocol such that a response from one slave doesn't trigger another to begin responding, or you will get collisions. For me, I like the MAX487 but it probably won't work at your data rates.
  • lanternfishlanternfish Posts: 366
    edited 2013-09-13 15:31
    You can use cat5/5e for your your cable runs as it's impedance is a very close match to the 120ohms spec for RS485. RS485 is used for the DMX lighting control protocol (250kb/s) and is very reliable in the noisy environment of dimmer land.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-09-13 22:05
    I use RS485 all over the place but it's especially on the highway data systems that the most protection is needed due to lightning. Anyway, just for your good all round not too expensive chip I use the SN65HVD3082EDR and their kin. 80V protection is okay to have on some chips but you find that once you need any kind of protection that 80V is a little on the low side anyway. I use transzorbs, polyfuse, gas discharge tubes, ferrite beads etc to provide real protection but this is not necessary in most cases. The old style MAX485 chips etc don't include any kind of fail-safe protection, that is, not talking about the over-voltage kind, but full fail-safe protects from opens and shorts on the bus which would generate false receive signals otherwise (the transmit is protected as part of the RS485 spec on all chips).

    BTW, a couple of tips. Use one I/O for receive and transmit together and tie RE and OE together to another I/O but use a pull-down on here as you want to make sure that it doesn't hog the bus if software hasn't asserted the TE/OE line yet. Some chips are 3.3V but I just use 5V chips with a 1K resistor from the I/O pin to the rx/tx. Your software should really use a precision half-duplex object rather than the full-duplex ones as I find their bit timing has way too much jitter. Don't forget the 120R termination resistors at each end (not on every node).
  • kwinnkwinn Posts: 8,697
    edited 2013-09-13 22:14
    You can use cat5/5e for your your cable runs as it's impedance is a very close match to the 120ohms spec for RS485. RS485 is used for the DMX lighting control protocol (250kb/s) and is very reliable in the noisy environment of dimmer land.

    Second that. I have used cat5 and cat6 for bus lengths up to 400 - 500 feet, and tested/verified that it would work at 1000 feet on cat5 and 6. The test was done with the cable still in the box so it did not take a noisy environment into account.
  • BigFootBigFoot Posts: 259
    edited 2013-09-14 10:22
    We used the LT1785 / LT1791 in our products. It is compatible with the LTC485 and LTC491 but are fault protected to 60V. They work well in noisy environments.

    http://www.linear.com/product/LT1785
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-09-14 11:59
    In shopping around, I got the impression that all the devices powered by +5 volts are competing in the same markets, so the pretty much conform to the same 8 Pin dip with the same pin configurations.

    That means that you can provide an 8 pin DIP socket and swap out chips that just don't seem right for you.

    On the other hand, the 3.3 volt chips all seem to be SMD... harder to swap as they are soldered in.

    At first reading, I thought you needed to run at the 112K baud, but the documents seem to indicate that lower rates are acceptable. Life is much simpler if you don't try to run your communications any faster than required.

    At least start out with something saner, like 19200 baud. It will make getting to know the command set and other aspects of set up much less brutal.

    I initially dreamt of 1000 meter runs of wire, but I suspect that most of the RS-422/485 applications that are not related to traffic control rarely go over a feet hundred feet. I just keep a coil of 100 feet of wire for bench testing baud rates and so on. I suppose one could have a 500 foot coil it one prefers.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-09-14 15:05
    On the other hand, the 3.3 volt chips all seem to be SMD... harder to swap as they are soldered in.

    As JonnyMac points out in the Spin Zone article, the 3.3V version are also more expensive. As long as you use the proper resistors the 5V work fine with the Prop (at least in my experience).
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-09-15 05:48
    It is an interesting contrast between the 3.3V and 5.0 volt versions.

    My overall design criteria would be to have any driver or reciever that connects to a long external wire be replacable via a socket. That indeterminate length of wire can provide all sorts of unexpected damage to these chips.

    I have wanted the 3.3v chips for ages, but I can't buy them retail in Kaohsiung. I thought they would allow me to have an all 3.3v Propeller setup at the far end. Maybe my thoughts were misguided. Now that 3.3v to 5.0 boost regulators seem cheap, I guess I'll stick with the +5 in an 8 pin DIP.
  • RDL2004RDL2004 Posts: 2,554
    edited 2013-09-15 06:29
    Adapter boards to convert soic-8 to DIP-8 are pretty cheap in quantity and relatively easy to solder.
    You should be able to find them locally without too much trouble.

    Here is a board from TI which has adapters for six of the more common surface mount packages:

    attachment.php?attachmentid=103922&d=1379250930
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-09-15 07:02
    Electronic abounds with adapters of all sorts, but they generally add cost and create additional problems. When in doubt, eliminate the adapter and find a good direct solution.
  • T ChapT Chap Posts: 4,223
    edited 2013-09-15 07:04
    Why adapt a SOIC? This hand solders in seconds easily.
  • RDL2004RDL2004 Posts: 2,554
    edited 2013-09-15 09:33
    Why adapt a SOIC? This hand solders in seconds easily.

    Unfortunately, you can't solder to a plastic breadboard.
    Besides, Loopy wanted something that could plug in a socket for easy replacement:
    My overall design criteria would be to have any driver or reciever that connects to a long external wire be replacable via a socket.

    Of course, then he says:
    Electronic abounds with adapters of all sorts, but they generally add cost and create additional problems.

    Which is pretty much exactly what sockets do.
  • BigFootBigFoot Posts: 259
    edited 2013-09-15 10:24
    We bought four 1000' reels of cat 5 cable to do the testing for our RS422 terminals. We were able to achieve 56K/bps with the proper termination.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-09-15 11:10
    BigFoot wrote: »
    We bought four 1000' reels of cat 5 cable to do the testing for our RS422 terminals. We were able to achieve 56K/bps with the proper termination.

    With CAT5 you have 4 pairs so the trick is to link the pairs at the ends of the cable so that you end up with 4 times the testing length for RS485 or two times the length for RS422. Rather than use RS422 chips I prefer to use RS485 transceivers either for dual RS485 or a full-duplex RS422 as the RS485 chips are also available in far more varieties as well as being specified for a more rugged environment.
Sign In or Register to comment.