Troubles collecting data with Modbus RTU

Hi there ! I’m sorry, I’ve no idea if I post this topic in the right section. I’m sure an admin will figure it out…

Anyway, I’ve troubles using a Modbus RTU device with my Arduino Nano.

Here is my code : (by the way, I’m kind of a new with Modbus and I’m still trying to figure it out so please be indulgent with my terrible coding ^^)

#include <ModbusMaster.h>

#define Max485_DE    2
#define Max485_RE_NEG 3

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

  digitalWrite(Max485_RE_NEG, 0);
  digitalWrite(Max485_DE, 0);

  Serial.begin(9600);
  
  node.begin(10, Serial);

  node.preTransmission(preTransmission);
  node.postTransmission(postTransmission);
}

void loop()
{
  uint8_t resultMain;

  resultMain = node.readInputRegisters(0x0053,1);
  delay(580);
  if (resultMain == node.ku8MBSuccess)
  {
    Serial.println(node.getResponseBuffer(0x53));
  }

  delay(1000);
}

Before we go any further, yes my probe use a 9600 baud-rate, it’s ID is 10 and it needs a 580ms delay to send a response.

As you can see, I’m trying to get the data at the address 0x0053 and print it in my serial monitor. This data is a float. (don’t know if that can help)

Now, I found that code in a tutorial and it appeared to work just fine with his setup but for me, it only gets the letter “w”…
I just adapted the code to my needs.

Does someone have a solution ?

I have a LOT of infos about the probe and its precise Modbus RTU Protocole. So feel completely free to ask for any further information !

I thank you in advance for taking time to go through this for me. I appreciate that…

Nico

    Serial.println(node.getResponseBuffer(0x53));

You must not use the Serial interface while it's used by the Modbus.

What are you trying to achieve? What is the Nano used for? You don't need it if you need the data on your PC as you can read the information directly on the PC (libmodbus). So please explain why you've chosen that hardware setup and provide a wiring diagram of it.