# Edge-Computing Meshed Wireless Acoustic Sensor Network for Indoor Sound Monitoring
## 4 WASN Design
### Logical Topology  
As explained in Section 4.1, nodes send data to the core node. As wireless modules, RPi includes Bluetooth and WiFi 2.4 GHz and 5 GHz modules. To choose one or another, the distances and difficulties different nodes may face in order to send the data must be considered. As this work focuses on indoor environments, these difficulties will be long distances and walls of different materials and thicknesses. Taking that in mind, WiFi has  
Figure 6: Example of WASN deployment in an indoor space. been selected due to its bigger range of connectivity compared to the Bluetooth module integrated into the RPi. Additionally, the 2.4 GHz band has been chosen over the 5 GHz one, given that the connectivity range from the first one is 46 m (150 feet) in front of the 15 m (50 feet) offered by the second one. These distances are valid for indoor environments [43]. There are two ways to send data to the core:  
* Direct connection: Each node connects directly to the core and sends its data. * Using other nodes: A node uses the connectivity of another node to send its data. This topology is called a mesh connectivity [44]. With \(n\) being the number of devices in a mesh network, then each device must be connected to \(n-1\) number of devices. The total number of links can be calculated using the following equation: \[\text{Total number of links, }L=\frac{n\cdot(n-1)}{2}\] (1) In such networking, the nodes can create and update their links automatically. Therefore, in case a route to a node becomes disabled, the network will automatically rebuild a new route through another radio node so that the information can still reach its destination [45]. The connectivity performance of the WASN was tested according to the following configuration. The nodes were programmed to compute the sound equivalent level (\(L_{eq}\)) every 20 s. Equation (2) shows how to calculate the \(L_{eq}\). In the equation, \(L_{eq}\) represents the sound equivalent level (in dBs), \(p_{0}\) is the reference pressure level (which was set to 20 \(\mu\)Pa), \(p_{A}\) are the samples of the measured pressure levels, and \(N\) are the number of samples--which depend on the sampling rate and the amount of time of equivalent level to be calculated. Once the \(L_{eq}\) values of 20 s were calculated in each node of the WASN, the level (in dB) was sent to the core. Then, the core aggregated the values from the five nodes and sent them to the thingspeak cloud platform. \[L_{eq}=10\cdot\log\left[\frac{1}{N}\cdot\sum_{n=0}^{n=N}\frac{(p_{A}(n))^{2}}{ (p_{0})^{2}}\right] \tag{2}\]  
A first deployment of the WASN was carried out following the direct connection strategy. In this strategy, all the nodes send their data directly to the core, without intermediate steps. Due to the architectonic features of the scenario in which the system was deployed, some frames were lost when using this approach, especially the nodes S4 and S5, which are the ones that are physically located further from the core. Moreover, the connection with the node S5 was lost after 12 days of operation. Therefore, a mesh connection was implemented. We used [46] to configure such a mesh in the RPis. Figure 7 shows a schematic of the logical network configuration. As it can be seen, the mesh uses the network 192.168.199.0/24 where each node has the IP 192.168.199.X, where X represents the node number plus 100. On the other hand, the core has the IP 192.168.199.1 inside the meshed network. On the private network created by the router, the core has a DHCP IP (in Figure 7, 192.168.0.47). This network (192.168.0.0/24) contains the rest of the devices (such as computers, smartphones or tablets). Therefore, the mesh network is only available and used by the nodes of the WASN (i.e., RPis). In case a device outside the meshed network wants to communicate with a RPi inside the meshed network, it has to do it through the core device. When a node needs to send data to the core, it will jump from one node to another one as many times as needed to reach the core.