# Sensing in Inland Waters to Promote Safe Navigation: A Case Study in the Aveiro's Lagoon
## 3 Low-Cost Maritime Data-Sharing System Design and Evaluation
### Maritime Real-Time Data-Sharing: The NMEA Network Simulator and System's Architecture
(b) The water tank contains three 30 g weights at each end of the K-line and four cables to raise and lower it, simulating the height of the tide. Figure 9: The simulator montage: (a) the storage shelf prepared to position the plotter on the highest available surface; (b) the outside plotter and wind sensor installation. Furthermore, the ESP8266 Wi-Fi module [91; 92; 93] was chosen for its ability to establish a dependable serial connection with the Raspberry Pi [94; 95], enabling the retrieval of NMEA data from the plotter. Its compatibility with serial communication protocols and compact form factor makes it a suitable component for integration into the system architecture. This hardware system has the potential to develop a low-cost solution that does not compromise functionality or performance. The Raspberry Pi and ESP8266 combination was leveraged to achieve the necessary capabilities for data transmission [95], enabling a seamless integration into maritime environments with varying levels of instrumentation. The strategic pairing of the Raspberry Pi and ESP8266 empowers the maritime sharing system to efficiently retrieve NMEA data, contributing to the overall effectiveness of maritime operations. A Raspberry Pi 3 A+ model was initially used to implement a dual Wi-Fi functionality. However, this setup faced connectivity issues as the Raspberry Pi kept disconnecting from the plotter's Wi-Fi network and connecting to a domestic network after a few seconds. This affected data access through a REST API. To address this issue, an ESP8266 device was introduced to enable a serial port connection between the Raspberry Pi [94] and NMEA network data. The data were then transmitted to the local network where the Raspberry Pi was connected. It was possible to analyze the sharing of NMEA data from the Raspberry Pi 3 Model A+ to the Firebase. This test showed that the Raspberry Pi 3 model A+ was not suitable due to its limited processing power and RAM. Upgrading to the Raspberry Pi 3 B+ model resulted in a slight improvement, but performance issues persisted. In conclusion, the Raspberry Pi 4 B+ with 4 GB RAM demonstrated a higher information processing speed and responsiveness, particularly in handling front-end and back-end tasks. The final solution used a Raspberry Pi 4 B+ with an ESP8266 serial connection to retrieve NMEA data. This low-cost solution enables vessels with some nautical instrumentation to share data. Initially, a Python script was used for data storage and Firebase transmission. Despite the delayed responses resulting from API requests, the Vue.js website effectively utilizes a Web API Serial to read the connection values from the ESP8266 plotter. VUE.js [96] was used to display, process and store the received data in the Firebase database. The final architecture of the data-sharing system (Figure 10) maintained the previously proposed hardware setup, but the Flask API functionality was removed because it was not possible to send requests from the Firebase host to the Raspberry Pi API. To address this, the Firebase host was kept, and the front-end code (VUE.js) was modified so that the ESP8266 could read the data directly, bypassing the need for the Flask Python API. This change reduced latency and improved the Raspberry Pi's efficiency in displaying and storing data. Figure 10: The final architecture proposed for the maritime data-sharing system. As shown in Figure 10, the Raspberry Pi connects to a Wi-Fi network (i.e., 4 G hotspot) available on the boat, which not only communicates with the VUE.js interface to receive data from the Firebase database but also updates the database in real-time. This connection ensures that the shared data are continuously updated in real-time, allowing for accurate and timely information sharing.