RS484 Wind Speed and Wind Direction on the same bus
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?
@Isidro.NavarroMaybe to late for you.You can write onmy one sketch, include both libraries and read both sensors.But first, you have to chand the address of at least one of them, so that you have 2 different addresses on the ModBus.
TK5EPHI,I bought 2 wind sensors from another seller, they look very similar to those sold by DFROBOT.
The commands are the same, I am indeed able to read both using the default address.
But even if the command for changing the address seems to be accepted (the sensor answers correctly), no address change is done.Does anyone have a clue why this could happen ?
Thanks,
TK5EPHI,
Interesting post, as I'm to buy both wind speed and direction sensors.
Does the device keep the modified address or does it have to be reconfigured at each startup ?
Thanks,
TK5EP
RS485_Wind_Speed_Transmitter_SKU_SEN0483:
After setting, you need to re-power on and restart the transmitter to make this address take effect.
SEN0482_RS485_Wind_Direction_Transmitter_V2:
Slave response frame (hexadecimal): 00 10 10 00 00 01 04 D8 (7byt), and that indicates the modification is successful.
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
Carson.FiskHi,
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.
KlausHee
I have reread the wiki and forum responses several times, and I still don't understand how to obtain the anemometer and wind vane data separately.Anemometer:- main.c- RS485_Wind_Speed_Transmitter.c- RS485_Wind_Speed_Transmitter.h- Wind_Speedwind vane:- main.c- RS485_Wind_Direction_Transmitter.c- RS485_Wind_Direction_Transmitter.h- Wind_DirectionMy question is, what should I modify and where? Should I run each compiled file separately, "Wind_Speed" and "Wind_Direction"? Or should I compile a common file to display the values of the anemometer and wind vane together? Thank you in advance.