689 lines
21 KiB
TeX
689 lines
21 KiB
TeX
\documentclass{beamer}
|
|
%
|
|
% Choose how your presentation looks.
|
|
%
|
|
% For more themes, color themes and font themes, see:
|
|
% http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
|
|
%
|
|
\mode<presentation>
|
|
{
|
|
\usetheme{Singapore} % or try Darmstadt, Madrid, Warsaw, ...
|
|
\usecolortheme[RGB={3,138,94}]{structure}
|
|
\usefonttheme{structurebold} % or try serif, structurebold, ...
|
|
\setbeamertemplate{navigation symbols}{}
|
|
\setbeamertemplate{headline}{}
|
|
%\setbeamertemplate{caption}[numbered]
|
|
\setbeamertemplate{footline}[frame number]
|
|
}
|
|
|
|
\usepackage[english]{babel}
|
|
\usepackage[utf8x]{inputenc}
|
|
\usepackage{fancyvrb}
|
|
\usepackage{tcolorbox,listings}
|
|
\usepackage{textpos}
|
|
\usepackage{setspace}
|
|
|
|
% Default fixed font does not support bold face
|
|
\DeclareFixedFont{\ttb}{T1}{ascii}{m}{n}{7} % for bold
|
|
\DeclareFixedFont{\ttm}{T1}{ascii}{m}{n}{7} % for normal
|
|
|
|
% Custom colors
|
|
\usepackage{color}
|
|
\definecolor{deepblue}{rgb}{0,0,0.5}
|
|
\definecolor{deepred}{rgb}{0.6,0,0}
|
|
\definecolor{deepgreen}{rgb}{0,0.5,0}
|
|
\definecolor{lightblue}{rgb}{0.6,0.8,1.0}
|
|
\definecolor{teal}{rgb}{0.45,0.85,1.0}
|
|
|
|
|
|
\fvset{frame=single,framesep=1mm,fontfamily=courier,fontsize=\scriptsize,framerule=.3mm,numbersep=1mm,commandchars=\\\{\}}
|
|
\usepackage{color}
|
|
|
|
\tcbuselibrary{listings,skins,breakable}
|
|
|
|
|
|
\lstdefinestyle{commandline}{
|
|
basicstyle=\ttfamily\scriptsize,
|
|
numbers=none,
|
|
keywordstyle=\color{blue},
|
|
morekeywords={{git add}},
|
|
%numberstyle=\tiny,
|
|
numbersep=2pt,
|
|
moredelim=**[is][\color{darkgreen}]{_green_}{_green_},
|
|
moredelim=**[is][\color{red}]{_red_}{_red_},
|
|
moredelim=**[is][\color{blue}]{_blue_}{_blue_},
|
|
}
|
|
|
|
% Python style for highlighting
|
|
\newcommand\pythonstyle{
|
|
\lstset{
|
|
language=Python,
|
|
basicstyle=\ttfamily\color{white}\tiny,
|
|
otherkeywords={self}, % Add keywords here
|
|
keywordstyle=\ttfamily\color{lightblue},
|
|
commentstyle=\ttfamily\color{teal},
|
|
emph={MyClass,__init__}, % Custom highlighting
|
|
emphstyle=\ttfamily\color{deepred}, % Custom highlighting style
|
|
stringstyle=\ttfamily\color{red},
|
|
frame=tb, % Any extra options here
|
|
backgroundcolor = \color{black},
|
|
showstringspaces=false %
|
|
}}
|
|
|
|
\newtcblisting{ConsoleVerbatim}{
|
|
arc=0mm,
|
|
top=-2mm,
|
|
bottom=-2mm,
|
|
left=0mm,
|
|
right=0mm,
|
|
width=\textwidth,
|
|
boxrule=0.5pt,
|
|
colupper=white,
|
|
colback=black,
|
|
spartan,
|
|
listing only,
|
|
listing options={style=commandline},
|
|
breakable
|
|
}
|
|
|
|
% Python environment
|
|
\lstnewenvironment{python}[1][]
|
|
{
|
|
\pythonstyle
|
|
\lstset{#1}
|
|
}
|
|
{}
|
|
|
|
\lstdefinestyle{commandline}{
|
|
basicstyle=\ttfamily\tiny,
|
|
numbers=none,
|
|
keywordstyle=\color{blue},
|
|
morekeywords={{git add}},
|
|
%numberstyle=\tiny,
|
|
numbersep=2pt,
|
|
moredelim=**[is][\color{darkgreen}]{_green_}{_green_},
|
|
moredelim=**[is][\color{red}]{_red_}{_red_},
|
|
moredelim=**[is][\color{blue}]{_blue_}{_blue_},
|
|
}
|
|
\newtcblisting{ConsoleVerbatimTiny}{
|
|
arc=0mm,
|
|
top=-2mm,
|
|
bottom=-2mm,
|
|
left=0mm,
|
|
right=0mm,
|
|
width=\textwidth,
|
|
boxrule=0.5pt,
|
|
colupper=white,
|
|
colback=black,
|
|
spartan,
|
|
listing only,
|
|
listing options={style=commandline},
|
|
breakable
|
|
}
|
|
|
|
\newenvironment{reference}[2]{ %
|
|
\begin{textblock*}{\textwidth}(#1,#2) %
|
|
\rule{10cm}{0.5pt}\\
|
|
\tiny\bgroup\color{black}}{\egroup % for the emulated
|
|
\end{textblock*}}
|
|
|
|
\usepackage{hyperref}
|
|
|
|
|
|
\definecolor{darkgreen}{rgb}{0.0,0.5,0.0}
|
|
|
|
\title[LoRa]{A Brief Introduction to \includegraphics[trim=0 4cm 0 0, scale=0.15]{images/lora.jpg}}
|
|
\author{Simon Pirkelmann}
|
|
\institute{\includegraphics[scale=0.5]{images/iR.pdf}}
|
|
\date{December 2nd, 2019}
|
|
|
|
\AfterPreamble{\hypersetup{
|
|
urlcolor=blue,
|
|
}}
|
|
|
|
\begin{document}
|
|
|
|
\begin{frame}
|
|
\titlepage
|
|
\end{frame}
|
|
|
|
% Uncomment these lines for an automatically generated outline.
|
|
\begin{frame}{Outline}
|
|
\tableofcontents
|
|
\end{frame}
|
|
|
|
|
|
|
|
\section{LoRa}
|
|
|
|
\subsection{Motivation}
|
|
\begin{frame}{Motivation}
|
|
\begin{itemize}
|
|
\item Example: monitor well-being of honey bees\\[0.5cm]
|
|
\includegraphics[scale=0.10]{images/honeybee.png}
|
|
\hspace{0.5cm}
|
|
\includegraphics[scale=0.055]{images/weight.png}
|
|
\includegraphics[scale=0.045]{images/temperature.jpg}
|
|
\includegraphics[scale=0.60]{images/humidity.jpg}\\[0.3cm]
|
|
\hspace{6cm}
|
|
\includegraphics[scale=0.04]{images/distance.jpg} \hspace{0.5cm}
|
|
\includegraphics[scale=0.15]{images/no-electricity.png} \\
|
|
\pause
|
|
\begin{minipage}{0.40\textwidth}
|
|
\vspace{-2cm}
|
|
\item Requirements:
|
|
\begin{itemize}
|
|
\setlength{\itemsep}{0pt}
|
|
\item Low data rate (a few bytes per day)
|
|
\item Low power consumption
|
|
\item Low cost
|
|
\item Long range
|
|
\end{itemize}
|
|
\end{minipage}
|
|
\pause
|
|
\begin{minipage}{0.45\textwidth}
|
|
\hspace{0.2cm}
|
|
Options:
|
|
\begin{itemize}
|
|
\setlength{\itemsep}{0pt}
|
|
\item Data line (e.g. ethernet)
|
|
\item Wifi, Bluetooth
|
|
\item Cellular
|
|
\end{itemize}
|
|
\end{minipage}
|
|
\vspace{0.1cm}
|
|
\pause
|
|
\item Solution: LPWAN (\textbf{L}ow-\textbf{P}ower \textbf{W}ide-\textbf{A}rea \textbf{N}etwork)
|
|
\begin{itemize}
|
|
\item \textbf{LoRa}, \textbf{LoRaWAN}, \textbf{TheThingsNetwork}
|
|
\item SigFox, NB-IoT, Weightless, ...
|
|
\end{itemize}
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\subsection{LoRa facts}
|
|
\begin{frame}{LoRa Facts}
|
|
\begin{reference}{0mm}{70mm}
|
|
https://www.thethingsnetwork.org/docs/lorawan/
|
|
\end{reference}
|
|
\begin{itemize}
|
|
\item Developed by \textbf{Semtech} (originally by Cycleo)\\
|
|
\hspace{0.3 cm}\textbf{Note:} parts of the PHY layer are \textbf{proprietary}!
|
|
\item Frequency: \textbf{868 MHz} \textbf{SRD} band (in the EU)
|
|
\item \textbf{25 mW} transmission power
|
|
\item Bandwidth: \textbf{125} to \textbf{500 kHz}
|
|
\item Data rate between \textbf{250 Bit/sec} and 21 \textbf{kBit/sec} \\
|
|
\hspace{0.3 cm}\textbf{BUT}: not made for a lot of data
|
|
\item Low cost: \textbf{$\sim $10 EUR} CAPEX (for nodes), almost no OPEX
|
|
\item Low power: devices can last \textbf{years on battery}
|
|
\item Long distance: up to \textbf{10 km} range
|
|
\end{itemize}
|
|
\only<2>{
|
|
\begin{textblock*}{100mm}(-5mm,-65mm)
|
|
\textblockcolour{white}
|
|
\begin{exampleblock}{LoRa distance record}
|
|
\includegraphics[scale=0.3]{images/distance_record.png}
|
|
\end{exampleblock}
|
|
\end{textblock*}
|
|
}
|
|
\end{frame}
|
|
|
|
\begin{frame}{LoRa facts}
|
|
\begin{reference}{0mm}{75mm}
|
|
https://www.thethingsnetwork.org/docs/lorawan/
|
|
\end{reference}
|
|
LoRa is \textbf{NOT} for:
|
|
\begin{itemize}
|
|
\item Realtime data - only small packets, every couple of minutes
|
|
\item Phone calls - you can do that with GPRS/3G/LTE
|
|
\item Controlling lights in your house - check out ZigBee or BlueTooth
|
|
\item Sending photos, watching Netflix - check out WiFi
|
|
\end{itemize}
|
|
Important: \includegraphics[trim=0cm 4cm 0 0cm, scale=0.11]{images/lora.jpg} $\leftrightarrow$ \includegraphics[trim=0cm 4cm 0 0cm,scale=0.15]{images/lorawan.jpg} $\leftrightarrow$ \includegraphics[trim=0cm 4cm 0 0cm,scale=0.06]{images/ttn.png}\\[0.3cm]
|
|
\begin{itemize}
|
|
\item \textbf{LoRa}: PHY layer $\Rightarrow$ modulation technique
|
|
\item \textbf{LoRaWAN}: Network protocol
|
|
\item \textbf{TheThingsNetwork (TTN)}: Network server, handles routing of data to the \textit{cloud}
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\subsection{PHY layer: modulation and demodulation}
|
|
\begin{frame}{Digital modulation}
|
|
\begin{itemize}
|
|
\item \textbf{A}mplitude \textbf{S}hift \textbf{K}eying (ASK)
|
|
\end{itemize}
|
|
\includegraphics[scale=0.35]{images/unmodulated.png}
|
|
\includegraphics[scale=0.35]{images/amplitude_modulation.png}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Digital modulation}
|
|
\begin{reference}{0mm}{75mm}
|
|
https://en.wikipedia.org/wiki/Chirp\_spread\_spectrum
|
|
\end{reference}
|
|
\begin{itemize}
|
|
\item \textbf{F}requency \textbf{S}hift \textbf{K}eying (FSK)
|
|
\end{itemize}
|
|
\includegraphics[scale=0.35]{images/unmodulated.png}
|
|
\includegraphics[scale=0.35]{images/frequency_modulation.png}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Digital modulation}
|
|
\begin{itemize}
|
|
\item Used by LoRa: \textbf{C}hirp \textbf{S}pread \textbf{S}pectrum (CSS) modulation
|
|
\begin{center}
|
|
\includegraphics[scale=0.3]{images/chirp.png}
|
|
\includegraphics[scale=0.3]{images/chirp_spectrogram.png}
|
|
\end{center}
|
|
\begin{itemize}
|
|
\item Chirp = frequency change over time\\
|
|
\end{itemize}
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{LoRa modulation}
|
|
\begin{itemize}
|
|
\item LoRa uses \textbf{Up-Chirps} (frequency increases) and \textbf{Down-Chirps} (frequency decreases)
|
|
\end{itemize}
|
|
\includegraphics[scale=0.3]{images/lora_upchirp.png}
|
|
\includegraphics[scale=0.3]{images/lora_downchirp.png}
|
|
%\item Messages always start with 8 Up-Chirps
|
|
\end{frame}
|
|
|
|
\begin{frame}{Example LoRa packet}
|
|
\begin{reference}{0mm}{70mm}
|
|
Thanks Valentin and Stefan (DM4SG) for providing this data
|
|
\end{reference}
|
|
\begin{center}
|
|
\includegraphics<1>[scale=0.2]{images/lora_signal.png}
|
|
\includegraphics<2>[scale=0.2]{images/lora_signal_2.png}
|
|
\includegraphics<3>[scale=0.2]{images/lora_signal_3.png}
|
|
\end{center}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Chirps and Symbols}
|
|
\begin{overlayarea}{\textwidth}{\textheight}
|
|
\begin{center}
|
|
\includegraphics<1>[scale=0.4]{images/lora_symbols_0.png}
|
|
\includegraphics<2>[scale=0.4]{images/lora_symbols_1.png}
|
|
\includegraphics<3>[scale=0.4]{images/lora_symbols_2.png}
|
|
\includegraphics<4>[scale=0.4]{images/lora_symbols_3.png}
|
|
\includegraphics<5>[scale=0.4]{images/lora_symbols_4.png}
|
|
\includegraphics<6>[scale=0.4]{images/lora_symbols_5.png}
|
|
\end{center}
|
|
\only<2->{
|
|
Time of frequency jump determines which data is encoded\\
|
|
}
|
|
\begin{center}
|
|
\only<3>{Example: \texttt{data = }\texttt{00000}}
|
|
\only<4>{Example: \texttt{data = }\texttt{00010}}
|
|
\only<5>{Example: \texttt{data = }\texttt{00011}}
|
|
\only<6>{Example: \texttt{data = }\texttt{10110}}
|
|
\end{center}
|
|
\end{overlayarea}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Spreading factor}
|
|
\begin{itemize}
|
|
\item Number of bits per symbol is determined by \textbf{spreading factor} (SF)
|
|
\begin{center}
|
|
\includegraphics<1>[scale=0.5]{images/lora_spreading_factors.png}
|
|
\end{center}
|
|
\item Possible values: SF7 - SF12\\
|
|
\hspace{0.5cm} SF7: 7 bits per symbol \\
|
|
\hspace{0.5cm} SF12: 12 bits per symbol
|
|
\item Spreading factor influences max. range
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Demodulation}
|
|
\begin{itemize}
|
|
\item Signal is multiplied by (mixed with) Down-Chirp
|
|
\item Fourier Transform
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Forward error coding}
|
|
\begin{itemize}
|
|
\item For each symbol several \textbf{parity bits} are added (= redundant information) \\
|
|
Reason: allows to detect and fix errors that occur during transmission (due to interference, etc.)
|
|
\item \textbf{Coding rate} determines number of parity bits:\\
|
|
\hspace{0.25cm} CR 4/5 : of 5 bits transmitted, 4 bits are actual data\\
|
|
\hspace{1.5cm}$\vdots$\\
|
|
\hspace{0.25cm} CR 4/8 : of 8 bits transmitted, 4 bits are actual data
|
|
\item Additionally: \textbf{C}yclical \textbf{R}edundancy \textbf{C}heck (CRC)
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{LoRa package format}
|
|
\begin{reference}{0mm}{70mm}
|
|
Source: SX1276/77/78/79 datasheet
|
|
\end{reference}
|
|
\includegraphics[scale=.3]{images/lora_packet_structure.png}
|
|
\begin{itemize}
|
|
\item Header: contains information about
|
|
\begin{itemize}
|
|
\item payload length
|
|
\item coding rate
|
|
\item CRC present?
|
|
\end{itemize}
|
|
\item Implicit header mode: no header sent
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Data rate and air time}
|
|
\begin{itemize}
|
|
\item Data rate depends on bandwidth (BW), spreading factor (SF) and coding rate (CR)\\[0.3cm]
|
|
\begin{minipage}{0.4\textwidth}
|
|
\textbf{Symbol duration}:
|
|
\begin{equation*}
|
|
T_{sym} = \frac{2^{SF}}{BW}
|
|
\end{equation*}
|
|
\end{minipage}
|
|
\begin{minipage}{0.5\textwidth}
|
|
\textbf{Symbol rate}:
|
|
\begin{equation*}
|
|
R_{sym} = \frac{1}{T_{sym}}
|
|
\end{equation*}
|
|
\end{minipage}
|
|
|
|
\item \textbf{Data rate}:
|
|
\begin{equation*}
|
|
R_{data} = \underbrace{SF}_{\# \text{bits per symbol}} \cdot \underbrace{R_{symb}}_{\text{symbol rate}} \cdot \underbrace{\frac{4}{4 + CR}}_{\text{coding rate}}
|
|
\end{equation*}
|
|
\item Example data rates:\\
|
|
\begin{tabular}{lll|lr}
|
|
SF7 &BW250 &CR4/5 & $\approx 10.9$ &$\tfrac{kbit}{s}$ \\ \hline
|
|
SF7 &BW125 &CR4/5 & $\approx 5.5$ &$\tfrac{kbit}{s}$ \\ \hline
|
|
SF12 &BW125 &CR4/5 & $\approx 0.29$ & $\tfrac{kbit}{s}$
|
|
\end{tabular}
|
|
%\item Sync word: \url{https://forum.chirpstack.io/t/relation-between-sync-word-private-network-and-end-nodes/191/17}
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Time-On-Air}
|
|
\begin{reference}{0mm}{65mm}
|
|
According to \textit{Allgemeinzuteilung von Frequenzen zur Nutzung durch Funkanwendungen mit geringer Reichweite für nicht näher spezifizierte Anwendungen; Non-specific
|
|
Short Range Devices (SRD)}, Bundesnetzagentur, 2018
|
|
\end{reference}
|
|
\begin{itemize}
|
|
\item Comply with \textbf{duty cycles} of the SRD band:
|
|
\begin{tabular}{l|r|r}
|
|
Frequency & Duty Cycle & ERP \\
|
|
\hline
|
|
868,0 - 868,6 MHz & 1 \% & 25 mW
|
|
\end{tabular}
|
|
\item This amounts to $\approx 30$ seconds of transmission time per hour (maximum!). Try to keep it way below.
|
|
\item Airtime calculator: \url{https://www.loratools.nl/\#/airtime}
|
|
\item Example: \texttt{20 bytes} payload \\
|
|
$\rightarrow$ max. 25 messages per hour on SF12 \\
|
|
$\rightarrow$ max. 600 messages per hour on SF7 \\
|
|
|
|
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\section{Playground Part I}
|
|
\begin{frame}[fragile]{Playground Part I}
|
|
\begin{itemize}
|
|
\item Module used: \textbf{Wemos® TTGO LORA32 868Mhz ESP32}
|
|
\begin{minipage}{0.6\textwidth}
|
|
\begin{small}
|
|
\begin{itemize}
|
|
\item ESP32
|
|
\item LoRa Chip SX1276
|
|
\item OLED display
|
|
\item Antenna (needs to be connected!)
|
|
\end{itemize}
|
|
\end{small}
|
|
\end{minipage}%
|
|
\begin{minipage}{0.4\textwidth}
|
|
\includegraphics[scale=0.075]{images/ttgo_module.JPG}
|
|
\end{minipage}
|
|
\item Programmable in MicroPython thanks to \texttt{uPyLora} library by lemariva (\url{https://github.com/lemariva/uPyLora})
|
|
|
|
\begin{spacing}{0.84}
|
|
\begin{python}
|
|
from lora_transceiver import LoRaTransceiver
|
|
from uPySensors.ssd1306_i2c import Display
|
|
|
|
disp = Display()
|
|
|
|
# create transceiver
|
|
lora = LoRaTransceiver(display=disp)
|
|
|
|
# send a string
|
|
lora.send_string("Hello World!")
|
|
|
|
# send some raw binary data
|
|
lora.send([0x01, 0x02, 0x03])
|
|
\end{python}
|
|
\end{spacing}
|
|
\item Have a look at SX1276 datasheet
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}[fragile]{Playground Part I}
|
|
\begin{itemize}
|
|
\item Receiving data:
|
|
\begin{spacing}{0.84}
|
|
\begin{python}
|
|
from lora_transceiver import LoRaTransceiver
|
|
from uPySensors.ssd1306_i2c import Display
|
|
|
|
disp = Display()
|
|
|
|
# create transceiver
|
|
lora = LoRaTransceiver(display=disp)
|
|
|
|
# start receiving data (and output on the screen)
|
|
lora.recv()
|
|
\end{python}
|
|
\end{spacing}
|
|
\item Change LoRa parameters
|
|
\begin{spacing}{0.85}
|
|
\begin{python}
|
|
# change the spreading factor
|
|
lora.setSpreadingFactor(10)
|
|
|
|
# change the frequency
|
|
lora.setFrequency(868.1e6)
|
|
|
|
# change signal bandwidth
|
|
lora.setSignalBandwidth(250e3)
|
|
|
|
# change sync word
|
|
lora.setSyncWord(0x34)
|
|
\end{python}
|
|
\end{spacing}
|
|
\item Task: \textit{Turn off your neighbors LED!}
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\section{LoRaWAN}
|
|
\begin{frame}{LoRaWAN}
|
|
\begin{reference}{2mm}{80mm}
|
|
https://www.thethingsnetwork.org/docs/lorawan/
|
|
\end{reference}
|
|
\begin{itemize}
|
|
\item LoRaWAN is for getting your sensor data online
|
|
\item Media access control (MAC) protocol
|
|
\item Network topology:\\
|
|
\begin{center}
|
|
\includegraphics[scale=0.085]{images/lorawan_topology.png}
|
|
\end{center}
|
|
\item \textbf{Gateways} forward data from nodes to the \textit{cloud}
|
|
\item Transmission is secured by AES-128 encryption
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Device registration}
|
|
\begin{itemize}
|
|
\item \textbf{TheThingsNetwork} aims to build a global LoRaWAN network
|
|
\item Devices need to be registered and assigned to an application before they can communicate with the network
|
|
\begin{enumerate}
|
|
\item Create an account on \url{https://www.thethingsnetwork.org/}
|
|
\item Log in and open the \textit{Console}
|
|
\item
|
|
\begin{minipage}{0.35\textwidth}
|
|
\vspace{-1.85cm}Create an application
|
|
\end{minipage}%
|
|
\begin{minipage}{0.6\textwidth}
|
|
\vspace{-0.2cm}
|
|
\includegraphics[scale=0.08]{images/lorawan_application.png}
|
|
\end{minipage}
|
|
\item Create a device and register it. Go to \textit{Settings} and change activation method to Activation by Personalisation (ABP)\\
|
|
\includegraphics[scale=0.08]{images/lorawan_abp.png}
|
|
\end{enumerate}
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Keys}
|
|
\begin{reference}{2mm}{80mm}
|
|
https://nootropicdesign.com/projectlab/2018/10/28/lorawan-end-devices/
|
|
\end{reference}
|
|
\begin{itemize}
|
|
\item Three important keys (when using ABP):\\
|
|
\begin{scriptsize}
|
|
\begin{center}
|
|
\hspace*{-8pt}\makebox[\linewidth][c]{%
|
|
\begin{tabular}{l|l}
|
|
Device Address (\textbf{DevAddr}) & identification of the device in TTN \\
|
|
\hline
|
|
Network Session Key (\textbf{NwkSKey}) & secure communication between device and TTN \\
|
|
\hline
|
|
Application Session Key (\textbf{AppSKey}) & secure communication between device and application
|
|
\end{tabular}
|
|
}
|
|
\end{center}
|
|
\end{scriptsize}
|
|
\begin{itemize}
|
|
\item DevAddr tells TTN where to route the data
|
|
\item NwkSKey used for message validity check (MIC)\\ (prevents tampering with messages)
|
|
\item AppSKey are used for payload encryption/decryption\\ (prevents reading the data)
|
|
\item Need to be \textbf{hardcoded} into the device
|
|
\end{itemize}
|
|
\item Alternatively: use Over-the-Air Activation (OTAA) (more secure)
|
|
\item Frame counters: Each message is equipped with a counter that prevents re-transmit attacks
|
|
\end{itemize}
|
|
\begin{reference}{2mm}{70mm}
|
|
https://www.thethingsnetwork.org/forum/t/limitations-data-rate-packet-size-30-seconds-uplink-and-10-messages-downlink-per-day-fair-access-policy-guidelines/1300
|
|
\end{reference}
|
|
\end{frame}
|
|
|
|
\begin{frame}{LoRaWAN payload format}
|
|
\begin{reference}{2mm}{70mm}
|
|
http://www.techplayon.com/lora-long-range-network-architecture-protocol-architecture-and-frame-formats/
|
|
\end{reference}
|
|
\begin{center}
|
|
\includegraphics[scale=0.35]{images/lorawan_payload_format.png}
|
|
\end{center}
|
|
Useful link:
|
|
\begin{itemize}
|
|
\item LoRaWAN packet decoder {\small \url{https://lorawan-packet-decoder-0ta6puiniaut.runkit.sh/}}
|
|
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\section{Practical Part II}
|
|
\begin{frame}[fragile]{Playground Part II}
|
|
Example code for sending data to \textbf{TheThingsNetwork}:
|
|
\begin{spacing}{0.85}
|
|
\begin{python}
|
|
from lora_transceiver import LoRaTransceiver
|
|
from uPySensors.ssd1306_i2c import Display
|
|
import uLoRaWAN
|
|
from uLoRaWAN.MHDR import MHDR
|
|
|
|
disp = Display()
|
|
|
|
# create transceiver for LoRaWAN frequency (channel 0 = 868.1 Mhz)
|
|
lora = LoRaTransceiver(frequency=868.1E6, syncword=0x34, display=disp)
|
|
|
|
# set address and keys for LoRaWAN (with ABP)
|
|
devAddr = [0x26, 0x01, 0x16, 0x5C] # ir_test_device_01
|
|
nwkSKey = [0x9D, 0x95, 0x0F, 0xAB, 0xCB, 0x63, 0xD3, 0x04, 0xBC, 0x09,
|
|
0xC4, 0x9E, 0xC5, 0xDF, 0x3C, 0x37]
|
|
appSKey = [0xC9, 0x6C, 0x00, 0xD1, 0xB0, 0x1C, 0x2E, 0x42, 0x11, 0xBA,
|
|
0x32, 0x6F, 0x2F, 0xC2, 0x75, 0x6A]
|
|
|
|
# lorawan object for conversion of data in LoRaWAN message format
|
|
lorawan = uLoRaWAN.new(nwkSKey, appSKey)
|
|
|
|
message = list(map(ord, 'Hello World!')) # convert to bytes
|
|
lorawan.create(MHDR.UNCONF_DATA_UP, { 'devaddr': devAddr, 'fcnt': 0,
|
|
'data': message })
|
|
payload = lorawan.to_raw()
|
|
|
|
lora.send(payload)
|
|
\end{python}
|
|
\end{spacing}
|
|
(the code is based on the \texttt{uLoRaWAN} library by mallagant, see: {\small \url{https://github.com/mallagant/uLoRaWAN}})
|
|
\end{frame}
|
|
|
|
\begin{frame}[fragile]{Playground Part II}
|
|
For testing you can use the following device addresses and keys:
|
|
\begin{itemize}
|
|
\item
|
|
\textbf{nwkSKey}
|
|
\begin{python}
|
|
9D 95 0F AB CB 63 D3 04 BC 09 C4 9E C5 DF 3C 37
|
|
\end{python}
|
|
\item \textbf{appSKey}
|
|
\begin{python}
|
|
C9 6C 00 D1 B0 1C 2E 42 11 BA 32 6F 2F C2 75 6A
|
|
\end{python}
|
|
\item \textbf{devAddr} (choose one):
|
|
\begin{python}
|
|
1: 26 01 16 5C 10: 26 01 1A CE
|
|
2: 26 01 18 52 11: 26 01 12 F1
|
|
3: 26 01 1E 4F 12: 26 01 1B 18
|
|
4: 26 01 17 83 13: 26 01 19 40
|
|
5: 26 01 1B 5C 14: 26 01 19 96
|
|
6: 26 01 1E B5 15: 26 01 18 FF
|
|
7: 26 01 13 DA
|
|
8: 26 01 1E 8F
|
|
9: 26 01 18 F1
|
|
\end{python}
|
|
\item Watch incoming data at
|
|
\begin{center}
|
|
\url{https://enny86r86c66.x.pipedream.net}
|
|
\end{center}
|
|
and check the gateway logs at (@BayernWLAN wifi)
|
|
\begin{center}
|
|
\url{http://192.168.1.1/}
|
|
\end{center}
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{References and further reading}
|
|
\begin{footnotesize}
|
|
References:
|
|
\begin{itemize}
|
|
\item Decoding LoRa \url{https://revspace.nl/DecodingLora}
|
|
\item \textit{LoRa und The Things Network} - talk by Hubert Högl (FH Augsburg)
|
|
\item \href{https://electronics.stackexchange.com/questions/278192/understanding-the-relationship-between-lora-chips-chirps-symbols-and-bits}{Stackexchange thread about LoRa symbols}
|
|
\item \href{http://wireless.ictp.it/school_2017/Slides/LoRaDetails.pdf}{LoRa talk}
|
|
\item \href{https://www.youtube.com/playlist?list=PLmL13yqb6OxdeOi97EvI8QeO8o-PqeQ0g}{Mobilefish.com LoRa youtube tutorials}
|
|
\end{itemize}
|
|
|
|
Further reading:
|
|
\begin{itemize}
|
|
\item TTN Applications: APIs, Python SDK, Integrations {\scriptsize \url{https://www.thethingsnetwork.org/docs/applications/}}
|
|
\item Best practices to reduce payload size: {\scriptsize \url{https://www.thethingsnetwork.org/forum/t/best-practices-to-limit-application-payloads/1302}}
|
|
\item Forum about all things LoRa: \url{https://www.thethingsnetwork.org/forum/}
|
|
\begin{itemize}
|
|
\item Gateway guides
|
|
\item Antenna recommendations
|
|
\item ...
|
|
\end{itemize}
|
|
\item Cayenne Low Power Payload (LPP)
|
|
\end{itemize}
|
|
\end{footnotesize}
|
|
\pause
|
|
\begin{center}
|
|
\textbf{Thanks for your attention!}
|
|
\end{center}
|
|
\end{frame}
|
|
|
|
\end{document}
|