read data from controller via RS485 Modbus rtu Arduino I have a device with an rs485 port from which I would like to read the ph value. Below is the connection with the RS485 adapter. 



I tried to read the data with this code but doesn't work:

#include SoftwareSerial.h

#define SSerialRX        10  //Serial Receive pin
#define SSerialTX        11  //Serial Transmit pin
#define SSerialTxControl 3   //RS485 Direction control
#define RS485Transmit    HIGH
#define RS485Receive     LOW
#define Pin13LED         13

SoftwareSerial RS485Serial(SSerialRX, SSerialTX); // RX, TX
byte byteSend;
byte request[] = {0, 0x03, 0, 0, 0, 0x01, 0x85, 0xDB};

void setup()   
{
  // Start the built-in serial port, probably to Serial Monitor
  Serial.begin(9600);
  Serial.println("SerialRemote");  // Can be ignored

  pinMode(Pin13LED, OUTPUT);   
  pinMode(SSerialTxControl, OUTPUT);  

  digitalWrite(SSerialTxControl, RS485Receive);  // Init Transceiver


  RS485Serial.begin(9600);   
  delay(2000);
   RS485Serial.write(request, sizeof(request));

   digitalWrite(Pin13LED, LOW);  
   delay(10);
   digitalWrite(SSerialTxControl, RS485Receive);

}
void loop()   
{

  if (RS485Serial.available()) 
  {
    byteSend = RS485Serial.read();   // Read the byte
    Serial.print(byteSend, HEX);
    Serial.print(" ");
  }
}


Could you help me?
Thanks
I can't say if this is your problem or not but I don't like this bit of code:

   RS485Serial.write(request, sizeof(request));

   digitalWrite(Pin13LED, LOW);  
   delay(10);
   digitalWrite(SSerialTxControl, RS485Receive);


You're sending the request then waiting 10ms and switching to receive mode.  That might be enough of a delay, but it's hard to say (best case, 960Bps at 9600 baud gives about 1ms per byte, which is 8ms for the request, but with software serial it may not be that simple).

Instead you should be using the flush method of the Stream class to wait for the data to be transmitted:

   RS485Serial.write(request, sizeof(request));

   digitalWrite(Pin13LED, LOW);  
   RS485Serial.flush();
   digitalWrite(SSerialTxControl, RS485Receive);