Pages: [1]   Go Down
Author Topic: UART to RS485 half duplex  (Read 3165 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 200
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello.

How can I connect one uart (arduino or raspberry pi) to a RS485 half duplex network.
The protocol will be MODBUS (only one device communicating at the same time)
The main problem is how to control DE/RE pin to switch between receiver and transmitter.
In this case, I haven't got any control signal: only tx, rx and gnd.
Well, I'm thinking about 3 options:

  • Using one arduino to get data with one serial port and resend data with other serial port, enabling or disabling DE/RE. This option seems to be "expensive"
  • Using a 555 timer to control a delayed signal to DE/RE. As seen in http://www.lvr.com/rs-485_circuits.htm
  • Using a MAX13487E/MAX13488E transceiver with auto direction. Is there a 3v3 version of this chip?

Have you got any experience in this way?

Thanks a lot.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18810
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

See this:

http://www.gammon.com.au/forum/?id=11428

You connect Rx/Tx to the appropriate pins of the RS485 chip, and enable/disable DE as required.

I don't know about MODBUS, that goes outside the scope of that article.
Logged


the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Nick, I understand your rationale for using the 680R's on A,B as you show, but that's not quite the same termination
as the d/s for the LTC1480 shows. I would think the 120R would quench the noise even on a floating line.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8531
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

IIRC Nick's resistors are for fail safe termination, a different issue to the normal 120R termination.

Re the line turn around, you should be able to hang some code off the TX Complete Interrupt to do that.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

IIRC Nick's resistors are for fail safe termination, a different issue to the normal 120R termination.

Understood, but I'm not so sure that matters if you have the 120R across the A,B lines
and all the outputs are turned off. I would have thought the manufacturer would
recommend Nick's scheme if that were an issue. This is just a query, not a debate.
« Last Edit: January 14, 2013, 06:18:51 pm by oric_dan(333) » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18810
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Nick, I understand your rationale for using the 680R's on A,B as you show, but that's not quite the same termination
as the d/s for the LTC1480 shows. I would think the 120R would quench the noise even on a floating line.

On the page I referenced I also have this statement:

Quote
Termination resistors

If the transceivers are not at the ends of the cable termination resistors are probably necessary. Something like 120 ohms, connected between the A and B cables, at each end only, stop the signal reflecting back along the cable.
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18810
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The datasheet doesn't seem to mention the 680 ohm resistors, but I found a reference here:

www.nikhef.nl/user/erichn/antares/RS485v3.pdf

They are called bias resistors apparently, and it seems the chip itself has a certain amount built in.
Logged


Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2892
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My understanding is that the RS-485 bus is to be centered about 2.5 V because the signalling is differential and it was for longer wires that the terminator is required to damp the ringing so the data transitions don't over run each other and they are really a necessity at higher baud rates.

Bob
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everybody,
is it required, in Nick scheme, to share the GND between the two ships when wire length is about 1000 feet (so in total we have 3 wires; 2 for A/B and one for groud)? I tested the two cases with 4 feet wire length, and everything works (no remarks or difference). but I have to know now the number of wire to order a cable suitable for my project (whose the distance is about 1000 feet).

in internet, sometimes I found that the GND must be shared, and sometimes they said that the RS485 receiver compares the voltage difference between both lines (A/B), instead of the absolute voltage level on a signal line (and this prevents the existence of ground loops)

The second question is concerning the baud rate: I used 28800 as mentioned in Nick sketch. but for 1000 feet and with 30 bytes to send (to slave) and 15 bytes to receive (from the slave), what baud rate can guarantee maximum transfer and without error (How can I calculate that)
Think's a lot for your responses
« Last Edit: January 21, 2013, 04:29:39 am by hammamed » Logged

Pages: [1]   Go Up
Jump to: