Changing the RS485 Wind Sensor Address (SEN0483 or SEN0482)
by FuzzyPotato in Circuits > Computers
1411 Views, 6 Favorites, 0 Comments
Changing the RS485 Wind Sensor Address (SEN0483 or SEN0482)
When we purchase the wind speed sensor (SEN0483) or wind direction sensor (SEN0482) they have the same address. This means that we can not use them together unless we change the address on one of the sensors.
Supplies
- RS485 wind speed sensor (SEN0483) or wind direction sensor (SEN0482)
- Arduino board
- UART to RS485 shield. I like this one (DFR0259)
- USB cable
Wiring
- Connect the RS485 to UART converter to the Arduino board.
- Connect the RS485 wind speed sensor to the RS485 to UART converter.
- Green wire to B-
- Yellow wire to A+
- Red wire to a 12v
- Black wire to ground
- Put the Arduino RS485 shield in “auto” mode. Auto mode takes care of some communication for us and makes our code simpler.
Code
This will change the address from 02 to 03
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("Serial started");
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();
}
Testing
- Open the Arduino IDE and create a new sketch.
- Copy and paste the code provided into the sketch.
- Open the Serial Monitor in the Arduino IDE.
- Set the baud rate to 9600.
- Before uploading the code make sure to move the other switch to “off” and then back to “on” once the upload is complete. If you do not do this your Arduino and PC will not be able to communicate properly.
- Upload the code to the Arduino board.
- Observe the readings from the wind sensor displayed in the Serial Monitor: If the Slave response frame looks like this: 00 10 10 00 00 01 04 D8 (7byt), the modification is successful. After setting, you need to re-power on and restart the transmitter to make this address take effect.
- Remember that after you change the address when you send a data request to the sensor you will need to use the new address.
- New data request frame: 0x03, 0x03, 0x00, 0x00, 0x00, 0x01, 0x85, 0xE8
Conclusion
Now we have a sensor that is of a different address. This means that we can use the wind speed sensor and wind direction sensor in parallel.
Take a look at m other tutorials on how to read the sensor readings.
Happy tinkering!