diff options
Diffstat (limited to 'text/demohw.tex')
| -rw-r--r-- | text/demohw.tex | 78 |
1 files changed, 73 insertions, 5 deletions
diff --git a/text/demohw.tex b/text/demohw.tex index 1fb1a58..a457d03 100644 --- a/text/demohw.tex +++ b/text/demohw.tex @@ -1,5 +1,73 @@ -\chapter{Demonstration tacker and stationary smart sensor} -\section{Antenna} -\section{PCB} -\section{Case} -\section{End-result} +%\chapter{Demonstration tracker} + +\chapter{Practical demonstration - tracker with meteo sensor} + +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. + +\section{Hardware} + +nRF9161 DK development kit was adapted with an add-on board made from a universal line \ac{PCB} with headers fitting to Connexio Pro headers. The add-on PCB contained connections Li-ion accumulator and meteo sensor BME680. + +Electronic and PCB schemes with 3D render of PCB can be found in appendix \ref{chap:demoapp}. + +\begin{figure}[!h] + \begin{center} + \includegraphics[width=0.5\textwidth]{obrazky/32_PCB3.JPG} + \end{center} + \caption[Overview of security and fire alarm]{Overview of security and fire alarm board} + \label{fig:pcb1} +\end{figure} + +\begin{figure}[!h] + \begin{center} + \includegraphics[width=0.5\textwidth]{obrazky/32_PCB3.JPG} + \end{center} + \caption[Overview of security and fire alarm]{Overview of security and fire alarm board} + \label{fig:pcb2} +\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}. + +\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{ADC configuration} +When connection with LTE network is successfully established, ADC is configured. Two analog input channels are used in this demo - AIN4 on P0.17 pin connected to LM35 temperature sensor and AIN5 on P0.18 connected to MQ-2 combustible gas sensor. For both channels, \texttt{adc\_channel\_cfg} structs are initialized and channels are set to 10bit resolution, internal 0.6 V reference voltage and 1/2 divider using \texttt{adc\_channel\_cfg()}, setting channels voltage range to 1.2 V. Both channels (if they are enabled by the button configuration) are then sampled in set interval using a custom fuction \texttt{adc\_sample()} and printed to USB serial. + +\subsection{Digital inputs and outputs} +For ease of implementation, digital sensors on GPIO pins P0.16 (DRV5033) and P0.19 (PIR) were added to the device tree as additional development kit buttons. This avoided the need for their own separate initialization and reading codes. + +These digital input sensors are then processed as buttons using callback handler \texttt{button\_handler()}. This function is called with bitmasks \texttt{button\_states} and \texttt{has\_changed}, making it ease to figure state change for these two sensors. + +Two buttons and two switchers are used for optionally disabling the corresponding sensors. This is executed in \texttt{button\_handler()}. + +Four on-board LEDs are used for local signalization of status of PIR sensor (LED1) and Hall effect sensor (LED2), as well as over-threshold values of temperature (LED3) and combustible gas (LED4) sensors. + +\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.2\textwidth]{obrazky/mqttcom.png} + \end{center} + \caption[Demo MQTT communication]{Sample of resulting MQTT communication} + \label{fig:mqttcom} +\end{figure} |
