Modbus communication problem

Hi guys,

I'm trying to communicate with a modbus device but I'm having problems, something strange is happening.

In the first construction of the project, communication worked normally. When I went to build other units, communication didn't work anymore. After testing and verifying everything, I see that the MAX485 module was different from the first one. One using MAX485 ESA CI (OK) and the other with MAX485 CSA CI (NOK). Looking at the document, the only difference is about temperature tolerance, but here in my lab I have no problem with that.

As I'm having difficulties to find to buy MAX485 with ESA chip, I decided to perform new tests on the module with CSA chip. To my surprise, I found a way for the module to work, but I can't leave it that way, and I couldn't understand why it worked either.

Strangely the communication works when I parallel the MAX485 with an RS485 USB converter. This USB converter is connected to the computer but it is not doing any kind of communication, just connected. If disconnected, Arduino stops communicating with the device (Result = 224). If connect again, communication returns.

In the image the yellow and black cables are connected to the device.
Brown and gray interconnect the MAX485 with the RS485 USB converter. A-A, B-B.

Does anyone have any idea what might be going on?

I am using an Arduino MEGA 2560.
Follow the code below.

Thank you!

#include <ModbusMaster.h>

#define MAX485_DE      2
#define MAX485_RE_NEG  3

// instantiate ModbusMaster object
ModbusMaster node;

void preTransmission()
  digitalWrite(MAX485_RE_NEG, 1);
  digitalWrite(MAX485_DE, 1);

void postTransmission()
  digitalWrite(MAX485_RE_NEG, 0);
  digitalWrite(MAX485_DE, 0);

void setup()
  pinMode(MAX485_RE_NEG, OUTPUT);
  pinMode(MAX485_DE, OUTPUT);
  // Init in receive mode
  digitalWrite(MAX485_RE_NEG, 0);
  digitalWrite(MAX485_DE, 0);


  // Modbus slave ID 1
  node.begin(1, Serial1);
  // Callbacks allow us to configure the RS485 transceiver correctly

void loop()
  uint8_t result;
  result = node.readInputRegisters(4121, 1);
  if (result == node.ku8MBSuccess)
    Serial.print(F("Total Flow: "));
    Serial.print(F("Connect Fail. Result = "));

You wrote you just electrically connect the USB-RS485 device and this connecting makes communication work. So my guessing is connecting this USB-RS485-device makes electrically a difference.

The datasheet of the MAX 485 shows termination-resistors are needed on both ends

Do your MAX485 modules have such termintation resistors?

best regards Stefan

The modules I use are from this model. I found this image on the internet. The terminal would be this 120 OHM resistor there?

One thing I noticed, I measured the resistance between A and B with a multimeter and noticed that without the RS485 USB, the resistance is low, around 66 OHMs. With RS485 USB connected, it goes to 190 OHMs.

Hi Wendelf,

if the resistance goes up to a higher value if you connect another device to the bus is strange.

Can you please post hand-drawn schematics of what was connected to what and how you measured the resistance. I mean add the multimeters probes to the schematic where you connected the probes to measure.

66 Ohms seems plausible if two of your modules are connected with each other.
120 Ohms on both ends in parallel results in a resistance of the half (60 Ohms)
Now adding your USB-485-device in parallel should result in a resistance of 15 ohms.

What do you measure if you change the black and the red probe?

The picture says "remove except for drivers on each end of the cable run" This makes sense because each additional driver on the bus would reduce the resistance more and more as all those resistors would be connected in parallel.

best regards Stefan


Honestly, I don't know if I measured it correctly.
I used a multimeter like this, set to 200 OHMs.

Below my scheme.
These values were obtained by placing the red probe on A and the black probe on B, on the MAX485 module.

Performing new measurements I noticed the following result:
Device + MAX485 = 130 OHMs (invert probe = The same but wavering more).
Device + MAX485 + USB INTERFACE (disabled from USB) = 66 OHMs (invert probe = same but wavering more).
Device + MAX485 + USB INTERFACE (enable on USB) = 190 OHMs (invert probe = -50 OHMs).

Another thing I noticed is that just by placing the multimeter in the max485 module, the measurement works. I take out the multimeter and the measurement stops.

By saying "the neasurement works" do you mean
holding the probes into the screw-socket the data-transmission over your RS-485 works

removing the probes from the screw-socket the data-transmission works not?

Do you get the same result of you use another object that gives some mechanical pressure on the socket?

did you ckeck if there is anywere a cold soldering?

Do you have some more MAX485-modules? with termination-resistor in place
What happens if you change to another MAX485-module?

best regards Stefan

By saying "the neasurement works" do you mean
holding the probes into the screw-socket the data-transmission over your RS-485 works

removing the probes from the screw-socket the data-transmission works not?


I tested over 20 different modules MAX485.

I sent it for testing at the electronics lab to see this resistor issue. Once I have an answer I'll post it here.

Thanks for now for your suggestions.

Sorry for the delay.

I inform you that we have found the solution!

After testing in our electronics laboratory, a 2k2 resistor was inserted between B and ground.
After this change I am able to perform the device measurement normally now.

Thank you very much!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.