# A Reconfigurable Mesh-Ring Topology for Bluetooth Sensor Networks
## Proposed Method
### Mesh-Ring Formation Algorithm  
To reduce the path length and mitigate the packet delay in the ring subnet, a Mesh-Ring scatternet formation algorithm with a shortest path routing algorithm is proposed in this study. The algorithm designs two phases to form the Mesh-Ring scatternet. In the first phase, a coordinator advertises and discovers its neighboring slave nodes, computes the Mesh-Ring topology and distributes node connection information to the masters in the ring subnet. In the second phase, each master in the ring subnet starts to build its corresponding piconet, connects with its neighboring piconets via slave bridges and interconnects with another corresponding piconet via one mesh link. Finally, a Mesh-Ring topology is generated. In the first phase, a root designated as a coordinator discovers and queries its one-hop neighboring slaves to form the multi-hop scatternet. Whenever the root discovers another device in its proximity, it establishes a temporary piconet. Then, the root will be the master and the device that was in inquiry scan state will be the slave. After a certain period of time, the root can collect all its one-hop neighboring information. After collecting all the neighboring information, the connection information is computed by the coordinator to form the desired multi-hop scatternet. To form a ring-based subnet, at least two bridge links are considered. In the ring subnet, one mesh link is introduced to reduce the packet transmission delay. In a piconet, the total number is eight and one master is used to schedule the packet transmission in a piconet. In order to mitigate the packet length in the ring subnet and maximize the piconet utilization, the minimum number of piconets is achieved under the formation constraint, and the formation criterion is defined as Equation (1). \[p=\left\lceil\frac{n}{7}\right\rceil \tag{1}\]  
where \(p\) is the minimum number of formation piconets, \(n\) is the total number of discovered nodes, including the coordinator and all discovered slaves. In general, the piconet number should be equal to n/8 in Equation (1), where 8 is the limit of the number of connected devices. However, each bridge node needs to connect with 2 piconets in the ring subnet, and this bridge can be counted twice in each  
Figure 1: An illustrated Mesh-Ring topology example. piconet. Therefore, the remaining number of devices in a piconet is 6; thus, Equation (1) is divided by 7. In Equation (1), the maximum number in a piconet is limited to eight. The bridge link is used to connect with the other two masters in the ring subnet. To connect the masters in the ring subnet, the number of masters is one and the maximum number of available mesh links is \(ml\), which is equal to \(7\times p-n\). After the scatternet topology is acquired, the minimum number of piconets is computed by Equation (1). After that, the coordinator computes and distributes the mesh link, the piconet information and the inter-piconet connection information to all the other masters in the ring subnet. After receiving the piconet and inter-piconet information, each master starts to form its own piconet, interconnects with the other two bridges, and connects with the other corresponding master to form the mesh-ring topology. As a result, the identification of each master in the ring can be specified by the coordinator for packet routing over the ring subnet. With a 52-node example, a coordinator M1 discovers 51 other slave nodes. With \(n=52\), M1 then computes the minimum number of piconet \(p=8\), and the number of available mesh links is 4. The 4 mesh links can be distributed by a maximum path criterion with path length \(pl~{}=~{}\lfloor p/2\rfloor\). The \(pl\) value is used by the maximum path criterion in the master to connect with the farthest master, thus reducing the path length of the ring subnet.