Go Down

Topic: UART to RS485 half duplex (Read 3750 times) previous topic - next topic

Jose Francisco

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.

Nick Gammon

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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

oric_dan

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.

Graynomad

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
Rob Gray aka the GRAYnomad www.robgray.com

oric_dan

#4
Jan 14, 2013, 07:55 pm Last Edit: Jan 15, 2013, 12:18 am by oric_dan(333) Reason: 1

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.

Nick Gammon


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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Docedison

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
--> 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

hammamed

#8
Jan 21, 2013, 10:26 am Last Edit: Jan 21, 2013, 10:29 am by hammamed Reason: 1
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

Go Up