1
\$\begingroup\$

I am trying to develop a sensor network for a rainwater collection system. The setup consists of four "nodes" and a master, where each node has an ultrasonic distance sensor to measure the water's height and a generic MAX-485 transceiver module for communication.

Everything connects to an ATTINY-85 running a simple script and the required MODBUS C libraries. A generic RS-485 to USB dongle is responsible for interfacing with my laptop (eventually a Pi 2B+). I was powering everything with two BK1673 lab power supplies.

I had no issues until I decided to use the power supply module on site. It is rated 24 V @100 W and is located in an enclosure powering a small alarm system and some lighting. It is overkill, as the whole lot draws about 20 W. I installed one node to test before setting the remaining three up, but to my surprise, I received no answer. I suspect there might be some issue with a ground loop.

Each node draws about 25 mA at idle with bursts of 50 mA when communicating (lab testing), so I don't suspect a lack of power being the culprit. Noise doesn't seem to be an issue as the installation location is far from civilization. Biasing and termination resistors are in place, and all nodes are daisy-chained. Powering via a battery, power bank, or lab PSU solves the problem but is not practical. Also, ten feet of CAT-5e between every node linked everything at the lab.

Node Block Diagram

  • Node as is

Would integrating a small DC-DC converter and optocouplers, and adding a signal ground solve my problem?

Isolated RS-485 Node Block Diagram

  • Proposed Node with isolated RS-485 section

EDIT:

First of all, thanks for helping! In hindsight, not having any grounding between nodes is dumb. I will link them with a third conductor. I plan to do this by connecting the negatives of every node to the negative connector of the dongle USB port, hopefully referencing everything to mains earth.

As soon as possible, I will rewire the system as follows. enter image description here

Furthermore, there are four resistors in total; two 650 OHM biasing resistors connected to the 5V power rail on the last node and two 100 OHM termination resistors at the start and finish of the RS-485 bus. CAT-5e has an impedance of 100 OHMS, but the transceiver can drive 100 to 120 OHM impedances according to its datasheet.

\$\endgroup\$
5
  • \$\begingroup\$ Everything turns on stuff you don't present. I've seen ground voltage differences (in Texas) of over 7 kV in a stretch between two buildings on the same property about 200' apart. (There was a research X-ray machine that caused this difficulty there.) We have very little idea of how wide-spread your rainwater collection system is... so it will be hard to help. But even with some details, there are lots of measurements you need to take. And yes, opto-isolation helped in the case I mentioned. We solved the problem using opto. But I can't say that will solve your situation. \$\endgroup\$
    – jonk
    Jul 6, 2022 at 5:32
  • \$\begingroup\$ A couple of things you should add information on. Is the power supply output referenced to mains earth, or does it even have earth connection, or is it mounted on a earthed metal case (this should be in data sheet or instalkation manual how to wire it)? And, are there only the differential pair between RS485 devices or is there also any common reference between them, such as mains earth wire or a separate bus common wire? \$\endgroup\$
    – Justme
    Jul 6, 2022 at 5:38
  • \$\begingroup\$ Also the USB dongle has only two bus wires. How are the fail-safe bias resistors connected, to which supply and ground? And the termination is connected where? What are the resistance values these bias and termination resistors? \$\endgroup\$
    – Justme
    Jul 6, 2022 at 5:56
  • \$\begingroup\$ How do you supply and ground the slave? \$\endgroup\$
    – Lundin
    Jul 6, 2022 at 6:39
  • \$\begingroup\$ Comment to your edit, it is very common to use 120 ohm termination resistors even if the bus has an impedance of 100 ohms. One reason is that it allows to use wider range of different cabling in a system that is nominally supposed to be 120 ohms. And if you have to choose a mismatch, it is better to terminate a 100 ohm line with 120 ohm, than the other way around. And the bias resistors will bring a 100 ohm termination to be much less than 100 ohms. \$\endgroup\$
    – Justme
    Jul 7, 2022 at 6:14

2 Answers 2

3
\$\begingroup\$

Based on your wiring diagrams and modules you use, this is not a problem of a ground loop, but a problem of completely lacking a common ground reference between RS-485 devices.

While it is true that RS-485 is a differential bus and only the difference between the two data wires A and B is important, there is also a requirement for a small enough common mode voltage between devices. RS-485 transceivers also typically require that the grounds between transceivers do not differ more than 7 volts.

That can be arranged in many ways but your system does not arrange it in any way.

The slave modules have a power supply with a floating output. Therefore, the outputs of the two power supplies are not referenced to each other in any way. There could be any DC or AC potential between the two floating outputs of the power supplies. And likely there is, because there is an Y capacitor between mains side and floating side for EMI/EMC reasons.

So if you would measure with a multimeter the AC voltage between output terminal and mains earth, you would see tens of volts and exceeding 100 volts would not be a surprise.

As a counter example, a typical desktop PC, connected properly to an earthed mains plug, will have the earthed metal case connected to the power supply output common terminal. PC voltages are referenced to mains earth.

So given the above, you could communicate RS-485 with two wires only between two earthed desktop PCs as they share a ground reference between RS-485 transceivers. They are tied together by mains earth wiring.

But you can not communicate with two wires only between an earthed desktop PC and device with floating AC mains supply because there are tens of volts AC between RS-485 transceiver grounds, so you need a third bus wire to connect transceiver grounds together.

Same is true for connecting two devices together if they both have power supplies with floating output. If there is no wire to equalize the output ground potentials of the two power supplies, there will be difference in voltage, and it won't work.

Same is true if you use an isolated RS-485 transceiver. The point is, all transceivers, isolated or not, must share a common reference at their RS-485 bus side.

It worked with lab power supply and batteries and power banks with floating outputs, because they are also completely isolated from mains and there is no Y capacitor to mains voltage, so they have much higher impedance and their common mode voltage is set via the RS-485 transceiver input impedance.

\$\endgroup\$
0
\$\begingroup\$

If the nodes are powered over the same CAT5 that carries the data and not grounded in any other way and the RS485 driver/receiver grounds are connected to the DC supply negative it will not be a ground loop.

If your USB-RS485 dongle does not have a ground terminal you may need to add one. (and connect it to the DC negative)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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