# Addressing Gaps in Small-Scale Fisheries: A Low-Cost Tracking System +
## 2 Materials and Methods
### System Architecture  
The architecture presented in [40; 41] has been adapted to collect and ingest data sent by under-12-meter inshore fishing vessels over two different interfaces. One interface is based on a secure REST API over HTTPS, while another is based on a secure Message Queuing Telemetry Transport Secure (MQTTS) broker (Figure 1). The first interface is dedicated to manage data from 2G/3G/4G devices, while MQTTS is suitable for LoRaWAN broadcasts. Long Range (LoRa) is an expanded spectrum frequency modulation technique derived from Chirp Spread Spectrum (CSS) technology and is used to implement many Internet of Things (IoT) device networks. The LoRaWAN specification is a Low-Power Wide-Area (LPWA) networking protocol designed to connect IoT devices to the Internet, meeting a number of requirements such as bi-directional communication, end-to-end security, mobility, and localization services. The communication between the LoRa Gateway and the network server is achieved using the MQTT protocol and the MQTT broker as server to collect messages and clients that can read and write to the broker. Different services are used in the LoraWAN infrastructure to manage the requests of several IoT devices. The LoRa Geo Server is used to geolocate LoRaWAN devices, while the Lora App Server provides a web interface where clients, applications, and devices can be managed. In addition, the LoRa App Server is responsible for managing join requests and managing/encrypting application payloads and allows integration with external services thanks to gRPC and RESTful API. Messages collected by the LoRa App server are sent to Amazon Web Services, which in turn forwards the requests to the Amazon Lambda service. The developed architecture also accepts data from asset trackers such as Teltonika devices (e.g., FMM640) that rely on a mobile network. These trackers send data to the Traccar server through TCP or UDP protocols over secure channels (using TLS/SSL). An interface on a Traccar server is also developed to receive data over a dedicated HTTPS REST interface, which extends the methods available to ingest data. The Traccar server is hosted on the Amazon Elastic Compute Cloud (Amazon EC2) and is managed through Docker. The Traccar system includes a web application--based on the Sencha ExtJS framework and OpenLayers--for managing users, devices, and the map view [42; 43]. The set of measured variables is augmented with a proximity inductive sensor (i.e., Omron E2B-M12 KN08-WP-B1) that is attached to the hauler. Figure 1: Architecture that manages real-time data sent over LoRaWAN and 2G/3G/4G connections. A GPS tracker collects SSF positional data. The processing of this signal enables the detection of fishing activity. A dedicated microcontroller filters the signal of the inductive sensor avoiding anomalous behaviors (e.g., start/stop of hauler) and bouncing (input is debounced). The microcontroller drives a hard line that is acquired by the tracker and then ingested through the above-described architecture. When the hauler is active and rotation is detected by the microcontroller, the output signal is kept high for at least 1 min to ensure that the state is properly sent. Data are stored in the Amazon DynamoDB database. By using a custom lambda function [44] and basing on events from Traccar, sets of consecutive vessel broadcasts are partitioned into individual fishing trips, which could be retrieved through the dedicated REST API. More details on how trips are reconstructed are reported in the following Section 2.3. We rely, where possible, on serverless services to ensure a proper scaling when the number of monitor vessels will increase. Elastic Search and Kibana services are used to retrieve fishing trips in an efficient way while also providing a graphical dashboard for the end-users that can have a quick overview of performed operations over space and time. Finally, a MongoDB NoSQL database with Node.js and Angular provides the web application to show fishing trips.