1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
%\chapter{Demonstration tracker}
\chapter{Practical demonstration - tracker with meteo sensor}
\label{chap:demo}
For practical demonstration of an IoT device with 4G/5G connectivity, a development kit Connexio Pro with nRF9161 was selected.
Practical demonstration of an IoT device with LTE-M or NB-IoT connectivity was made on an example of an GPS tracker with meteo sensor, transferring data to a remote cloud server via MQTT protocol, simulating a data transfer to a central panel. For mobile field testing the GNSS was disabled due to long time needed to get fixed location and that get connection to LTE network. Both of these action will reset the state to the other so the behavior is very similar to cold start.
\section{Hardware}
Connexio Pro development kit was adapted with an add-on board made from a universal line \ac{PCB} with headers fitting to its headers. The add-on PCB contains connections for Li-ion accumulator and meteo sensor BME680.
Electronic and PCB schemes with 3D render of PCB can be found in appendix \ref{appendix:demoapp}.
\begin{figure}[!h]
\begin{center}
\includegraphics[width=0.5\textwidth]{obrazky/32_PCB3.JPG}
\end{center}
\caption[PCB of demonstrator tracker]{PCB of demonstrator tracker}
\label{fig:pcb2}
\end{figure}
\begin{figure}[!h]
\begin{center}
\includegraphics[width=0.5\textwidth]{obrazky/33_in_case1.JPG}
\end{center}
\caption[Demonstrator tracker in 3D printed case]{Demonstrator tracker in 3D printed case}
\label{fig:pcb1}
\end{figure}
\section{Firmware tools}
nRF Connect SDK was used as a software platform for the demo application. nRF Connect SDK is a unified software development kit for building products based on all Nordic nRF Series wireless devices. It integrates the Zephyr RTOS and wide range of samples, application protocols, protocol stacks, libraries and hardware drivers \cite{zephyrpp}.
It offers a single code base for all Nordic devices and software components. It simplifies porting modules, libraries and drivers from one application to another, thus reducing development time. nRF Connect SDK is publicly available under OpenSource license, offers source code management with Git and has free nRF Connect for Visual Studio Code IDE support. Zephyr RTOS furthemore provides extensive amount of libraries including standardized access to basic peripheries, IP stack and \ac{MQTT} library \cite{nrfsdk}.
\ac{MQTT} is a lightweight, publish-subscribe protocol that enables efficient and reliable communication between devices in the IoT domain. \ac{MQTT} is based on a broker-client architecture, where a broker is a server that receives and routes messages from multiple clients, and a client is any device that can publish or subscribe to a topic. A topic is a hierarchical identifier that defines the content and scope of a message\cite{mqtt}.
This firmware is based on nRF Connect SDK example named Simple \ac{MQTT}\cite{nrfmqtt} and GNSS example.
\section{Firmware outline}
\subsection{LTE network connection}
First task for the demo firmware is an establishment of a connection to LTE network. This is mostly handled by function \texttt{modem\_configure()}, which turns off power saving modes for better responsivity and calls HAL function \texttt{lte\_lc\_init\_and\_connect()}.
\texttt{lte\_lc\_init\_and\_connect()} takes all modem settings from text config files transferred to macros by Kconfig. This ilustrates a possibility of cross-platform or regionally independent application, where only the config files for given platform or region are needed to be changed.
\subsection{MQTT}
Communication with MQTT server is done by zephyr/net/mqtt.h library. Connection with the server is attempted after LTE and sensors setup with function \texttt{mqtt\_connect()}.
Publishing of message is achieved by function \texttt{mqtt\_publish()} upon a digital sensor is activated or analog sensor exceeds the set threshold value. Example of the MQTT communication sent to a virtual server is shown in figure \ref{fig:mqttcom}.
\begin{figure}[!h]
\begin{center}
\includegraphics[width=0.4\textwidth]{obrazky/mqttcom2.png}
\end{center}
\caption[Demo MQTT communication]{Sample of resulting MQTT communication}
\label{fig:mqttcom}
\end{figure}
\subsection{Application loop}
The program after establishing LTE connection enters main loop which main where it disables LTE, enable GNSS and waits for modem to get from GNSS fixed location. After that it disables GNSS, enables LTE, waits for LTE connection to be established.
With fresh location data it loads data over I2C from BME680 meteo sensor and gets from modem values about radio connection with \ac{BTS}. All these data are than transmitted using MQTT to remote server. After this program waits for specified time and than runs the loop again.
|