Can anyone help me with the arduino code for sending data to S-Soil MTEC-02B soil moisture sensor which working using modbus RS485 protocol. The schematic diagram is also given below.MAX RS485 module is used for the communication.

Sensor link is given below.
https://www.seeedstudio.com/RS485-Soil-Moisture-Temperature-EC-Sensor-S-Soil-MTEC-02B-p-4860.html?
This is the code i have used but it did not respond with the sensor. I think requesting data from modbus module are not compatible:
#include <SoftwareSerial.h>
#include <Wire.h>
/*
RO = Receiver Output. Connects to a serial RX pin on the microcontroller
RE = Receiver Enable. Active LOW. Connects to a digital output pin on a microcontroller. Drive LOW to enable receiver, HIGH to enable Driver
DE = Driver Enable. Active HIGH. Typically jumpered to RE Pin.
DI = Driver Input. Connects to serial TX pin on the microcontroller
*/
//2 connections between Arduino and 'MAX485 TTL to RS-485 Interface Module'
#define RE 8 //[digital pin 8 -> RE]
#define DE 7 //[digital pin 7 -> DE]
const byte nitro[] = {0x01, 0x03, 0x00, 0x1e, 0x00, 0x01, 0xe4, 0x0c}; //Request code for nitrogen level
const byte phos[] = {0x01, 0x03, 0x00, 0x1f, 0x00, 0x01, 0xb5, 0xcc}; //Request code for phosporous
const byte pota[] = {0x01, 0x03, 0x00, 0x20, 0x00, 0x01, 0x85, 0xc0}; //Request code for potassium
const byte ec[] = {0x01, 0x03, 0x00, 0x15, 0x00, 0x01, 0x95, 0xCE}; //Request code for electric conductivity
const byte sal[] = {0x01, 0x03, 0x00, 0x14, 0x00, 0x01, 0xC4, 0x0E}; //Request code for salinity
const byte temp[] = {0x01, 0x04, 0x00, 0x00, 0x00, 0x03, 0xB0, 0x0B}; //Request code for temperature
byte values[11]; //empty byte array of length 11
//another 2 connection between Arduino and 'MAX485 TTL to RS-485 Interface Module'
//[digital pin 2 -> RO]
//[digital pin 3 -> DI]
SoftwareSerial mod(2, 3); //defining the module as 'mod' object
void setup() {
Serial.begin(9600); //initialize serial monitor
mod.begin(9600); // initialize sensor module
pinMode(RE, OUTPUT); //set digital pin 8 as output
pinMode(DE, OUTPUT); //set digital pin 7 as output
delay(1000); //wait 1 second
}
void loop() {
byte val1, val2, val3, val4, val5, val6; //defining six byte variables
val1 = nitrogen(); //calling function nitrogen()
delay(250); // wait 0.25 seconds
val2 = phosphorous(); //calling function phosphorous()
delay(250); // wait 0.25 seconds
val3 = potassium(); //calling function potassium()
delay(250); // wait 0.25 seconds
val4 = conductivity(); //calling function conductivity()
delay(250); // wait 0.25 seconds
val5 = salinity(); //calling function salinity()
delay(250); // wait 0.25 seconds
val6 = temperature(); //calling function temperature()
delay(250); // wait 0.25 seconds
Serial.print("Nitrogen: ");
Serial.print(val1); //print nitrogen level in serial monitor
Serial.println(" mg/kg");//unit
Serial.print("Phosphorous: ");
Serial.print(val2); //print Phosphorous level in serial monitor
Serial.println(" mg/kg");//unit
Serial.print("Potassium: ");
Serial.print(val3); //print Potassium level in serial monitor
Serial.println(" mg/kg");//unit
Serial.print("EC: ");
Serial.print(val4); //print Electric Conductivity level in serial monitor
Serial.println(" S");//unit
Serial.print("SL: ");
Serial.print(val5); //print Salinity level in serial monitor
Serial.println(" mg/kg");//unit
Serial.print("Temperature: ");
Serial.print(val6); //print Temperature in serial monitor
Serial.println(" C");//unit
delay(2000);
}
byte nitrogen() {
digitalWrite(DE, HIGH);
digitalWrite(RE, HIGH);
delay(10); //wait 0.01 seconds
if (mod.write(nitro, sizeof(nitro)) == 8) {
digitalWrite(DE, LOW);
digitalWrite(RE, LOW);
for (byte i = 0; i < 7; i++) {
//Serial.print(mod.read(),HEX);
values[i] = mod.read(); //retrieving the nitrogen level in hexadecimal
Serial.print(values[i], HEX); //converting nitrogen level into decimal
}
Serial.println();
}
return values[4]; //send the value
}
byte phosphorous() {
digitalWrite(DE, HIGH);
digitalWrite(RE, HIGH);
delay(10); //wait 0.01 seconds
if (mod.write(phos, sizeof(phos)) == 8) {
digitalWrite(DE, LOW);
digitalWrite(RE, LOW);
for (byte i = 0; i < 7; i++) {
//Serial.print(mod.read(),HEX);
values[i] = mod.read(); //retrieving the phosphorous level in hexadecimal
Serial.print(values[i], HEX); //converting phosphorous level into decimal
}
Serial.println();
}
return values[4]; //send the value
}
byte potassium() {
digitalWrite(DE, HIGH);
digitalWrite(RE, HIGH);
delay(10); //wait 0.01 seconds
if (mod.write(pota, sizeof(pota)) == 8) {
digitalWrite(DE, LOW);
digitalWrite(RE, LOW);
for (byte i = 0; i < 7; i++) {
//Serial.print(mod.read(),HEX);
values[i] = mod.read(); //retrieving the potassium level in hexadecimal
Serial.print(values[i], HEX); //converting potassium level into decimal
}
Serial.println();
}
return values[4]; //send the value
}
byte conductivity() {
digitalWrite(DE, HIGH);
digitalWrite(RE, HIGH);
delay(10); //wait 0.01 seconds
if (mod.write(ec, sizeof(ec)) == 8) {
digitalWrite(DE, LOW);
digitalWrite(RE, LOW);
for (byte i = 0; i < 7; i++) {
//Serial.print(mod.read(),HEX);
values[i] = mod.read(); //retrieving the electric conductivity level in hexadecimal
Serial.print(values[i], HEX); //converting electric conductivity level into decimal
}
Serial.println();
}
return values[4]; //send the value
}
byte salinity() {
digitalWrite(DE, HIGH);
digitalWrite(RE, HIGH);
delay(10); //wait 0.01 seconds
if (mod.write(sal, sizeof(sal)) == 8) {
digitalWrite(DE, LOW);
digitalWrite(RE, LOW);
for (byte i = 0; i < 7; i++) {
//Serial.print(mod.read(),HEX);
values[i] = mod.read(); //retrieving the salinity level in hexadecimal
Serial.print(values[i], HEX); //converting salinity level into decimal
}
Serial.println();
}
return values[4];
}
byte temperature() {
digitalWrite(DE, HIGH);
digitalWrite(RE, HIGH);
delay(10); //wait 0.01 seconds
if (mod.write(temp, sizeof(temp)) == 8) {
digitalWrite(DE, LOW);
digitalWrite(RE, LOW);
for (byte i = 0; i < 7; i++) {
//Serial.print(mod.read(),HEX);
values[i] = mod.read(); //retrieving the temperature in hexadecimal
Serial.print(values[i], HEX); //converting temperature into decimal
}
Serial.println();
}
return values[4]; //send the value
}