# An Experimental Comparison of Basic Device Localization Systems in Wireless Sensor Networks
## 5 Testbed Implementation
### Communication Protocol  
To let the target node be able to collect RSSI values for each reference node, a wireless connection between the devices must be established. Once the connection has been established, the target receives simple data packets (i.e., signals) from the reference nodes, and every time it receives a packet, RSSI is calculated based on the number of transmission errors detected in the newly received packet, since a higher number of errors is expected for lower received powers. The ESP-Now communication protocol (available at [[https://github.com/espressif/esp-now](https://github.com/espressif/esp-now)]([https://github.com/espressif/esp-now](https://github.com/espressif/esp-now)), accessed on 1 April 2025), also developed by Espressif Systems, was used to implement the sensor network and enable the devices present to communicate with each other in order to reduce power consumption during wireless communication. Esp-Now activates a peer-to-peer transmission between ESP family devices, with a power consumption lower than the classic Wi-Fi communication. It uses the integrated Wi-Fi module, so it always uses the 2.4 GHz band, but in this case, it does not make a classic connection to the Wi-Fi Access Point and it does not interfere with normal home wireless communications. Energy saving is not achieved by decreasing the transmission power but by simplifying and reducing the connection and communication time. The transfer of a packet can have a maximum size of 250 bytes. It is not suitable for the transmission of high rates, but it is sufficient for the transfer of small data, typical of IOT applications. Data can be transmitted unidirectionally or bidirectionally, single-duplex or full-duplex, and be encrypted. The communication mode on the right of Figure 11 foresees a board that is the target acting as receiver (or Slave) and several boards acting as emitters (or Master). Note that there are no \"emitter/master\" and \"receiver/slave\" components in the ESP-Now documentation. Each board can be an emitter or a receiver. However, to keep things clear, both these terms are used to differentiate their role. The sender board receives a confirmation message indicating whether the message has been delivered correctly or not, while the receiver board receives messages from all the senders and is able to identify which board sent the message. Since the target is able to identify which device sent a packet, it can associate each device with an RSSI value and thus establish distances from the devices. As seen, we need to model the radio channel of our environment and then derive the parameters \(A\) and \(n\) so that Equation (4) can be applied. The methodology used to derive these parameters is based on an empirical method, i.e., the observation of data. Parameter \(A\) is the power of the received signal, in dBm, at the reference distance of 1 m. To establish how much it is worth, the value it assumes is observed by placing two devices at the exact distance of 1 m and making an average of more values, as shown in Tables 1 and 2. The functions of the program loaded on the device carrying out these measurements reported that in an indoor environment, this parameter assumes the average value of \(A=-49\) dBm, while in an outdoor environment, the value is \(A=-51\) dBm. Parameter \(n\), as already shown, is the so-called signal propagation constant; it indicates the reduction in the power density of an electromagnetic wave as it propagates in space. This value is usually between 2 and 4, as shown in Table 2, where 2 indicates propagation in free space, 4 indicates lossy environments, and for the case of complete specular reflection (in some environments, such as buildings, stadiums, and other indoor environments), it can reach values between 4 and 6. The choice of the value was made by observing the distance values obtained for different values of \(n\).