Interfacing Arduino UNO with wind speed through RS485 problem

Dear All,
I am trying to interface Arduino UNO with wind speed through RS485
I am using

RS485 [url=https://www.aliexpress.com/item/1893567852.html?spm=a2g0s.9042311.0.0.27424c4dp7vunY[/url]

Wind Speed [url=https://www.aliexpress.com/item/4000172670473.html?spm=a2g0s.issue_5ptha.0.0.7e894c4d2TqAau[/url]

Wind speed Manual https://media.digikey.com/pdf/Data%20Sheets/Seeed%20Technology/Wind_Speed_Transmitter_485Type_V1.0_UG.pdf

Connection

Code

#include <SoftwareSerial.h> 

#define RX        10    //Serial Receive pin
#define TX        11    //Serial Transmit pin
#define RTS_pin    9    //RS485 Direction control
#define RS485Transmit    HIGH
#define RS485Receive     LOW

SoftwareSerial RS485Serial(RX, TX);

void setup() {

  pinMode(RTS_pin, OUTPUT);  
  
  // Start the built-in serial port, for Serial Monitor
  Serial.begin(9600);
  Serial.println("Anemometer"); 

  // Start the Modbus serial Port, for anemometer
  RS485Serial.begin(4800);   
  delay(1000);
}

void loop() {

  digitalWrite(RTS_pin, RS485Transmit);     // init Transmit
  byte Anemometer_request[] = {0x01, 0x03, 0x00, 0x16, 0x00, 0x01, 0x65, 0xCE}; // inquiry frame
  
  RS485Serial.write(Anemometer_request, sizeof(Anemometer_request));
  RS485Serial.flush();
  
  digitalWrite(RTS_pin, RS485Receive);      // Init Receive
  byte Anemometer_buf[8];
  RS485Serial.readBytes(Anemometer_buf, 8);
 
  Serial.print("wind speed : ");
  for( byte i=0; i<7; i++ ) {
  Serial.print(Anemometer_buf[i], HEX);
  Serial.print(" ");
  }
  Serial.print(" ==> ");
  Serial.print(Anemometer_buf[4]);
  Serial.print(" m/s");
  Serial.println();                  
  delay(100);

}

The output always

wind speed : 6C 8 FF 2 EC 8 F4 ==> 236 m/s
wind speed : 6C 8 FF 2 EC 8 F4 ==> 236 m/s
wind speed : 6C 8 FF 2 EC 8 F4 ==> 236 m/s
wind speed : 6C 8 FF 2 EC 8 F4 ==> 236 m/s
wind speed : 6C 8 FF 2 EC 8 F4 ==> 236 m/s
wind speed : 6C 8 FF 2 EC 8 F4 ==> 236 m/s
wind speed : 6C 8 FF 2 EC 8 F4 ==> 236 m/s

My suspension with

byte Anemometer_request = {0x01, 0x03, 0x00, 0x16, 0x00, 0x01, 0x65, 0xCE}; // inquiry frame

But I am not sure

There's an example request frame in the doc you linked. What do you get if you use that instead?

That device is using the Modbus RTU procotol. Use a corresponding library (p.e. ModbusMaster, available in the IDE's library manager) to access it. The library will tell you the error code you get.

The manual says the device has only one register (0x00), so it doesn't make sensor to try to read register 22 (0x16).

Dear All

Thank you for replay

wildbill:
There's an example request frame in the doc you linked. What do you get if you use that instead?

I tried
byte Anemometer_request = {0x01, 0x03, 0x00, 0x00, 0x84, 0x0A};

results

wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s
wind speed : F0 8 F6 8 F0 0 ==> 240 m/s

Dear pylon
Thanx for the replay,

pylon:
That device is using the Modbus RTU procotol. Use a corresponding library (p.e. ModbusMaster, available in the IDE's library manager) to access it. The library will tell you the error code you get.

The manual says the device has only one register (0x00), so it doesn't make sensor to try to read register 22 (0x16).

I checked the three examples provided with the library and the result is unreadable (mostly squares and cannot be past here)

ammaralroz:
I tried
byte Anemometer_request = {0x01, 0x03, 0x00, 0x00, 0x84, 0x0A};

That's not the request frame in the example.

the request frame in the example is:
byte Anemometer_request = {0x01, 0x03, 0x00, 0x00, 0x00, 0x01, 0x84, 0x0A};

Hope that helps...

I checked the three examples provided with the library and the result is unreadable (mostly squares and cannot be past here)

Sure you have to adapt it to your needs. The examples use the hardware serial interface for communication. If you use it unmodified you send Modbus data to your serial monitor. Of course this doesn't result in any readable character.