RS484 Wind Speed and Wind Direction on the same bus

userHead JohnKed 2022-05-26 14:18:26 2418 Views3 Replies

Hi! 

 

I just bought from DFRobot a RS485 Wind Speed Transmitter (SEN0483) a RS485 Wind Direction Transmitter (SEN0482) and a USB to RS485 Module (FIT0737)

 

I want to connect those to a Raspberry Pi. If I connect only the wind speed module everything is working fine! The same is happening if I connect the wind direction module, everything is working fine and I'm getting values on my Raspberry Pi.

 

But is it possible to connect both of those simultaneously using the same USB to RS485 module (FIT0737)? I'm guessing that I have to connect the cables parallel but I have to change software addresses on the code?

 

Any help here?

2022-10-17 14:35:57

Hi! Please modify the check digit of the command: 03 03 00 00 00 01 85 E8

userHeadPic jenna
2022-10-17 08:51:25

Hi,

 

I am having a hard time reading the sensor after changing the address. I also cant change the address to anything other than slave address =0x03. When I use address =0x03 I get the slave response 00 10 10 00 00 01 04 D8 as expected according to the documentation. Indicating that the modification was successful. However now I cant read wind direction data.

 

I changed the reference frame to the new address.  {0x03, 0x03, 0x00, 0x00, 0x00, 0x01, 0x84, 0x39}

 

Before I attempted to change the address and I was using {0x02, 0x03, 0x00, 0x00, 0x00, 0x01, 0x84, 0x39}; it was working well.

 

 

Please find the code that I am using to change the address  below:

byte address_ref_frame[] = {0x00, 0x10, 0x10, 0x00, 0x00, 0x01, 0x02, 0x00, 0x03, 0xFA, 0x00};byte buf[11];

void setup(){   Serial.begin(9600);   Serial.println("Start");}

void loop(){//    Serial.println("-----------------------------------------------");//    //    Serial.println("Send");   delay(1000);   Serial.write(address_ref_frame, sizeof(address_ref_frame));   Serial.flush();   Serial.readBytes(buf, 11);   delay(1000);

   Serial.println("Buffer");   Serial.println(buf[0], HEX);   Serial.println(buf[1], HEX);   Serial.println(buf[2], HEX);   Serial.println(buf[3], HEX);   Serial.println(buf[4], HEX);   Serial.println(buf[5], HEX);   Serial.println(buf[6], HEX);   Serial.println(buf[7], HEX);   Serial.println(buf[8], HEX);   Serial.println(buf[9], HEX);   Serial.println(buf[10], HEX);   Serial.println(buf[11], HEX);      Serial.flush();   delay (600000);}

 

 

 

Please find the code that I am using to read the sensor  below:

byte wind_direction_ref_frame[] = {0x03, 0x03, 0x00, 0x00, 0x00, 0x01, 0x84, 0x39};byte buf[8];int wind_direction;static const char *direction_list[] = {"North", "Northeast by North", "Northeast", "Northeast by East", "East", "Southeast by East", "Southeast", "Southeast by South", "South", "Southwest by South", "Southwest", "Southwest by West", "West", "Northwest by West", "Northwest", "Northwest by North", "Invalid reading"};  

 

void setup(){   Serial.begin(9600);   Serial.println("Start");}

void loop(){

   Serial.println("-----------------------------------------------");   Serial.println("Sending read request");   delay(2000);   Serial.write(wind_direction_ref_frame, sizeof(wind_direction_ref_frame));   Serial.flush();   Serial.readBytes(buf, 8);   delay(1000);

   wind_direction = buf[3], DEC;   Serial.println("");   Serial.print("Wind Direction: ");   Serial.println(direction_list[wind_direction]);

   Serial.println("Buffer");   Serial.println(buf[0], HEX);   Serial.println(buf[1], HEX);   Serial.println(buf[2], HEX);   Serial.print(buf[3], HEX);   Serial.println(" !");   Serial.println(buf[4], HEX);   Serial.println(buf[5], HEX);   Serial.println(buf[6], HEX);

   Serial.flush();   delay (3000);}

 

 

Many thanks

userHeadPic Carson.Fisk
2022-09-08 21:40:54

Hi,

you may have found the answer already, anyway:

yes, you have to send once the command to change the address of the RS485 device. Per default, they are both set to address = 0x02. You can connect either of the two and send to slave address 0x00 = (broadcast to all devices) the command to change the address (0x00 0x10 0x10 0x00 0x00 0x01 0x02 0x00 0x03 0xFA 0x00 sets slave address =0x03).  Afterwards, you can connect both again and command them individually with the set slave address (in this example on would be 0x02, the other 0x03). Its is also described in the wiki.

 

 

userHeadPic KlausHee