# LPWAN-Based Vehicular Monitoring Platform with a Generic IP Network Interface
## 5 Test-Bench
### Equipment and Implementation  
The system architecture presented in Figure 4 has been developed to enable the validation and testing of the proposal. This has involved both a software development and a hardware set-up. The implementation has been released as open source ([[https://github.com/n0p/loratun](https://github.com/n0p/loratun)]([https://github.com/n0p/loratun](https://github.com/n0p/loratun))), and it is available for replicating the experiments carried out in this work, or for use in other projects. Regarding the UNIX network interface for LPWAN, the RI interface has been implemented using the _ip_ UNIX command, in order to establish the forwarding rules to enable the transmission of packets through the new interface. No packet filtering has been established for incoming communications. The PA interface has been achieved by cloning the UNIX _/dev/net/tun_ interface into a new tunneling interface to be controlled with _ioctl_ calls. The flags _IFF_TUN_ and _IFF_NO_PI_ have been used in the _ioctl_ interface request _ifreq_. When the packets are captured by our middleware through this new interface, they are processed and sent to the SCHC software module, which is an evolution of the implementation presented in Ref. [29] whcih now supports UDP/IPv6 compression. The MI interface with the modern is based on serial port communication, using a block-based device and an interface of type _/dev/tryUSB\({}^{*}\)_, given that a USB-to-serial converter is used. As stated above, and further discussed in Ref. [31], the restrictions posed by the LPWAN link leads to the need of employing compression schemes with the aim of optimizing the size of the packets to be sent in this constrained transmission channel. To address this need, our SCHC module has been developed on the basis of the guidelines described in Ref. [28]. In SCHC, the end-node and application gateway (Figure 4) share a common pre-provided context that indicates how to manage the information contained in the protocol headers, in order to remove them from the packet sent over the LPWAN link. Thereby, Figure 7 illustrates the original packet, and the one outputted by the SCHC module of our solution. The SCHC rule applies the compression action for all of the header fields. This is possible thanks to knowing, in this case, the IPv6 addresses, UDP ports, and other static configurations of both ends (pre-provided context). This way, the 40 Bytes of the IPv6 Header, and the 8 Bytes of the UDP header, are compressed down to 1 Bytes, by including a new SCHC header called RuleID, which indicates the way to proceed with the packet once it reaches the application gateway. As can be seen, the application payload remains untouched. A regular laptop with the Ubuntu operating system was used in the tests, and was connected with the OBD-II port of a 2003 Honda Civic 1.6 i-VTEC with petrol engine. A Bluetooth GPS was used for gathering positioning data, and an ELM327-based OBD-II device was employed for obtaining car diagnosis data. The OBD-II device was connected with the laptop using Bluetooth. A software was developed, aimed at periodically obtaining the position in NMEA format and a set of OBD parameter identifiers (PIDs), and sending application-level packets with these data to the IPv6-addressed data server, by using the LPWAN UNIX interface. The communication with our UNIX interface is a regular _AF_INET6 SOCK_DGRAM_ socket supporting IPv6/UDP. The data sent in the packets can be seen in  
Figure 7: SCHC compression of data packets sent by vehicles. Figure 7 within the application payload. From the OBD device, the engine load, RPM, and speed are used, and the latitude, longitude, and speed are taken from the GPS receiver. In our case, we have used LoRaWAN as the communication technology, and the modem was comprised of an Arduino board provided with an RN2483 radio module by Microchip. It operates in LoRaWAN Class A mode, using the ISM 868 MHz frequency band. An ommmidirectional 2.2 dBi antenna has been attached to this device, to transmit at 14 dBm power.