Changing the Slave ID of a RS485 Sensor
Step-by-step Guide using Modbus Poll Software
In this article, I will discuss how you can change the slave ID/ Device Address of RS485 sensors using Modbus Poll Software.
In order to connect the RS485 sensors to a Modbus we need to change the slave IDs of the sensors. We need to send an inquiry code to the relevant register to change that particular slave ID. For that, we can use Modbus Poll software. I will give a step-by-step guide to changing the slave ID. I’m discussing the procedure that I have followed taking the SHT20 temperature and humidity sensor (Amazon) as an example. I have referred to the datasheet of that sensor to get the relevant data.
- Install and launch Modbus Poll. You can use the link to download it. (Note: You need Windows to install the software).
- Once installed, run the program.
- Then you need to connect the sensor to your pc using a USB to RS485 converter (Amazon)using wires. Connect as below,
- Then connect the USB port of the converter to your PC.
- Then click on “Connection” in the top menu and choose “Connect”. A new window will open where you need to configure the communication settings. Select the appropriate serial port (COM port) for your RS485 adapter(Can find it by going to device manager → ports).
- Set the communication parameters (baud rate, data bits, stop bits, and parity) to match the settings of your RS485 sensor. Click “OK” to save the settings. The baud rate, data bits, stop bits, and parity can be taken from the datasheet. The following shows the relevant data of my sensor. I have taken it from the datasheet I mentioned above.
- Go to “setup” -> “Read/write definition” and check whether the address mode is on hex or dec. If it is in “Hex”, you need to provide the hexadecimal values of the address. If it is “Dec”, you need to provide the decimal values of the address. Remember it.
In this case it is in decimal mode.
- Now go to “Functions” -> “write single register” and set the current Slave ID, the Address in which the slave ID is saved, and the new ID you prefer. The current slave ID, and address can be taken from the datasheet. If the address mode is in decimal the address should be entered in decimal. Below shows the datasheet information.
Here the device ID is in the register address 0x0101. When it is converted to decimal, the value is 257. The new ID should be given under “value”. I have given “3” as the new ID. Here we are writing a keep register with a new value.
- Then click “send”, if you can see “response ok” just below the test field, the address has been changed correctly.
- You can check that by going to “setup” -> “Read/write definition” and following the configuration. The function, address and updated slave ID, and expected number of bytes need to be added as inputs.
Example :
The function code is 0x04. The address in hex is 0x0001. That value in decimal is 1. The number of bytes is 2. Usually, there are 2 bytes in a register.
Result
If you can observe the above result, we can conclude that the change in address is done. Now you can change all the sensors you have and make the sensors ready to connect with the Modbus.
Note: The “temp” and “Humid” were typed by me.
In the Next part of this series, I will discuss about controlling the RS485 sensors using Arduino boards with Arduino Language.
Cheers!
Protonest for more details.
Protonest specializes in transforming IoT ideas into reality. We offer prototyping services from concept to completion. Our commitment ensures that your visionary IoT concepts become tangible, innovative, and advanced prototypes.
Our Website: https://www.protonest.co/
Email: udara@protonest.co
If you enjoyed this article and would like to show some support, consider buying me a coffee on Ko-Fi.
Your support not only helps me keep creating content like this but also fuels me! ☕️📚
Thank you for being an amazing reader!
Here’s my Ko-Fi link: https://ko-fi.com/udarakumarasena