1
\$\begingroup\$

As shown in the graph, I'm trying to use mcu-controlled switches to turn a segment of rs-485 bus on or off (so that only one segment is on at a time). I was considering analog switches but I'm not confident how to take care of the negative voltage.

enter image description here

My question is:

Is an analog switch the best choice in this situation?(cost is an important consideration)

If so, what kind of analog switches should I use to switch the negative voltage line? or is there a better general method to do it? (a few specific recommendations would be even better!)

Thanks!

\$\endgroup\$
  • \$\begingroup\$ Why are you wanting to do this? \$\endgroup\$ – Andy aka Jul 15 '18 at 14:52
  • \$\begingroup\$ @Andyaka Because this application has more than a thousand nodes (each with a mcu and a transceiver MAX487) which are arranged in several rows and collumns (120 nodes per row). But there is only one master (a raspberry pi). So I need to switch between different rows. \$\endgroup\$ – Gordon Jul 15 '18 at 15:01
  • 1
    \$\begingroup\$ When the master(s?) (the MCUs show in your picture) knows which segment is uses, you can use back-to-back RS485 receivers-transmitters, and enable only the appropriate transimitter. \$\endgroup\$ – Wouter van Ooijen Jul 15 '18 at 16:03
  • 2
    \$\begingroup\$ What makes you think there will be any "negative voltage" on your bus? \$\endgroup\$ – brhans Jul 15 '18 at 16:17
5
\$\begingroup\$

Let's get some things straight first, to avoid miscommunication.

1) There is no "negative voltage line" in RS-485 specification. All the negative voltages in various guides and documentations refer to differential output of the line driver. The lines themselves (usually named A, B or Y, Z) swing between ground and positive voltage (standard +5V, but low-voltage RS-485 becoming more common).

Having said that, the wide CM range of RS-485 technically makes it possible for both lines to swing even with negative levels, e.g. -2..-4V. It is your responsibility to provide your nodes with common ground to avoid situations like this.

2) The maximum number of nodes usually limited by bus capacitance, however in case of RS-485 it is limited by combined impedance of receivers long before line capacitance takes its toll. Usually quoted maximum number is 30, which means your 120-nodes row might have to be split into 4 segments. I am assuming these are your "columns". However you can find transceivers with high input resistance that allow much higher number of nodes on the bus. The LTC2872 for example has 125k resistance, for up to 256 nodes. MAX487 that you've mentioned only allows 128 nodes. Note, that this covers 120-nodes row quite nicely, so you don't actually need "columns".

3) Dealing with this many nodes involves both hardware and software. Since RS-485 is electrical interface specification it says nothing about protocol. Therefore, if you resolve the impedance issue in hardware the software task will be simplified to providing correct addressing mechanism. Alternatively your software can treat part of the node address as MUX control and select correct node cluster before beginning actual communication. In both cases, you do not need those extra MCUs connected to switches.

4) Regardless of what you use to disconnect bus segments, simple termination will most likely be not enough. Biasing resistors should be used to ensure correct idle state of the disconnected bus segment.

5) On the network that big managing half-duplex communication can be quite challenging. Most solutions will likely reduce bus through-output. I would suggest using full-duplex wiring even if you don't need actual full-duplex communication. Uni-directional lines are much easier to multiplex and/or amplify.

Keeping all the above in mind, the actual solution can be as simple as adding a MUX for Enable signal connected to an array of RS-485 transceivers, one transceiver per bus segment. The Tx pins all connected together, the Rx pins need OR logic (either wired or gate). Also you might be able to find transceivers with 3-stated RX outputs or use MUX to connect one Rx at a time.

There are plenty of the suitable chips on the market, like LTC2872, LTC1335 etc. If you choose to split the lines for full-duplex, you can use quad MAX3030E transmitters. For the bus selector you can use any 1-channel MUX, like CD74HC4067, ADG731 etc.

So, the proposed configuration is 10 sub-nets of 120 MAX487/MAX489 nodes, plus 10 additional transceivers connected to master with two CD74HC4067 MUX chips on enable and Rx pins. No additional MCUs necessary.

If you are looking for ready-made solution, there are some RS-485 repeaters available, but they are quite expensive and you need at least 10 of them. IBS485, 8TMUX, PRO-2200. The only benefit of using these is that your software can focus on protocol only (see #3 above).

UPDATE

There is an option to actually use the wiring exactly as in your schematics, but without expensive ready-made repeaters. You can replace all those "switch + MCU" pairs in the drawing with 20 LTC2872 chips configured for half-duplex mode (compatible with your MAX487 chips) and connected with Y1-Z1 to main bus, Y2-Z2 to row segment. Then you cross-wire DY1-RA2, DY2-RA1 and you pretty much have low-cost repeaters. Here how it is done with two transceivers, but you only need one dual transceiver. And if you have used full-duplex wiring then you wouldn't even need that switching circuit in the middle.

So, all your nodes will be on the same bus. The rest is just a matter of a protocol, which in your case (single master) does not even have to worry about collisions.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the detailed explanation! Now I see that I mistaken the common mode voltage to be 0V which caused the most troubles I guess. I'm using the extra MCUs on the left only to reduce wire numbers on the left end actually (as 20 rows are arranged within 3m in height and I thought it's not good to use muxes at the master and set 20 pairs of wires) and yes I do not need the columns. As for termination and alternative full-duplex bus I think I need to learn more to understand the idea. The recommendations and documents are also very helpful. Again thank you very much! \$\endgroup\$ – Gordon Jul 16 '18 at 1:49
  • \$\begingroup\$ In general, the simpler the system the more reliable it is. There is noting simpler than adding 1.5m patch cables to each row with MUX PCB in the middle. What are your bandwidth requirements? It is primary parameter to analyze available options. To understand the difference between full- and half-duplex wiring just compare the Figure 1 and Figure 3 in the documentation. Here you can read about termination. \$\endgroup\$ – Maple Jul 16 '18 at 8:12
  • \$\begingroup\$ Thank you for the materials! I'll consider the pitch cable option :) \$\endgroup\$ – Gordon Jul 17 '18 at 2:02
  • \$\begingroup\$ @Gordon I've added another option for you. Should take care of those 20 cables :) \$\endgroup\$ – Maple Jul 18 '18 at 4:03
  • \$\begingroup\$ Thanks for the update! It is a tempting option except the LTC2872 is too expensive for me. But I think the idea is pretty good. I'll post an update when I get this system work :) \$\endgroup\$ – Gordon Jul 31 '18 at 3:25
1
\$\begingroup\$

Instead of using analogue switches AND, bearing in mind what you said about cost, you could let the master MCU do flow control to allow a particular segment to have priority by using RS487 chips; one extra per row: -

enter image description here

\$\endgroup\$
  • \$\begingroup\$ I wanted to do this but in my arrangement this will result in too many wires (hopefully I explained clear enough in the above reply and sorry I didn't explain this part in the post). Still thank you for the reply! \$\endgroup\$ – Gordon Jul 16 '18 at 1:56
  • \$\begingroup\$ Your explanation doesn't seem to cover the "too many wires" thing. \$\endgroup\$ – Andy aka Jul 16 '18 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.