I can not get the correct values from EC meter via rs485

I bought a 3 in 1 EC meter which made in China and the interface is RS-485.
Hardware wire connection I think is correct.
I also get the values from Arduino IDE serial monitor.
But I thought the values are not correct.

Here is the data sheet and result link: - YouTube
And here is my code:

#include <SoftwareSerial.h>
#include <Wire.h>

#define RE 8
#define DE 7

const byte ec[ ] = {0x01, 0x03, 0x00, 0x00, 0x00, 0x03, 0x05, 0xCB};
byte values[8];

SoftwareSerial mod(2, 3);

void setup()
{
Serial.begin(9600);
mod.begin(9600);
pinMode(RE, OUTPUT);
pinMode(DE, OUTPUT);
delay(1000);
}

void loop()
{
// EC reading

digitalWrite(DE, HIGH);
digitalWrite(RE, HIGH);
delay(1000);

if (mod.write(ec, sizeof(ec)) == 8)
{
digitalWrite(DE, LOW);
digitalWrite(RE, LOW);
for (byte i = 0; i < 7; i++)
{
values[i] = mod.read();
Serial.print(values[i], HEX);
}
Serial.println();
}
int soil_ec = int(values[3]<<8|values[4]);
delay(1000);

Serial.print(" Soil EC: ");
Serial.print(soil_ec);

delay(2000);
}

// datasheet
Inquire Frame
Address Function Start/End address Data length CRC-L CRC-H
0x01 0x03 0x00 0x00 0x00 0x03 0x05 0xCB

Response Frame
Address Function Return Soil-moisture Soil-temperature EC-value CRC-L CRC-H
0x01 0x03 0x06 0x02 0x92 0xFF 0x9B 0x03 0xE8 0xD8 0x0F

Please use code tags when posting code, and post a link to the sensor data sheet or product page.

Why do you think the values are incorrect?

Have you calibrated the sensor with a known standard?

Describe how you are attempting to make the measurement.

When you post code (properly), at a minimum, it needs to compile.

That code will not compile and has no chance of working as-is.

Sorry for the mistake, I also retype the code.

WattsThat via Arduino Forum <arduino@discoursemail.com> 於 2021年6月6日 週日 上午9:56寫道:

Please use code tags when posting code, and post a link to the sensor data sheet or product page.

Why do you think the values are incorrect?

Have you calibrated the sensor with a known standard?

Describe how you are attempting to make the measurement.

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