I'm working on a home automation project, where I want to use rs485(modbus) for communication between modules and I was wondering, if there is a way to automate the process of adding new devices(slaves) to the bus and addressing them automatically.
I found this document, and there are some ways to achieve this, but since I'm new to this I'm not really sure how to do it exactly.
I was thinking about something like this as mentioned in the document, but I don't understand how can I use the unique id obtained from the slave to set it's slave id.
Liang et. al. [4] present a concept that will enable
reconfiguration of slave IDs when there are ID conflicts.
The system employed slaves with unique identification
numbers in them. In case of devices with conflicting
Modbus IDs, the master requests the conflicting slaves to
send their unique identification number to the master
within a certain pre-set interval like in Ethernet [5]. The
slaves then will attempt to send their ID back after a
random waiting period so that the IDs are received at the
master reliably. In case the IDs are not received by the
master, the same process will be re-initiated several times
until the identification numbers of all the slaves are
received. Once the identification numbers of the slaves are
received successfully by the master, the master will then
send configuration messages to set Modbus ID of each
slave referring to it by its identification number.
Has anyone done something like this before?