almost done with presentation

pull/1/head
Simon Pirkelmann 2019-11-29 17:14:26 +01:00
parent 6bfe47b59f
commit 6522afb47c
5 changed files with 183 additions and 35 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

View File

@ -24,8 +24,8 @@
\usepackage{setspace}
% Default fixed font does not support bold face
\DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{7} % for bold
\DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{7} % for normal
\DeclareFixedFont{\ttb}{T1}{ascii}{m}{n}{7} % for bold
\DeclareFixedFont{\ttm}{T1}{ascii}{m}{n}{7} % for normal
% Custom colors
\usepackage{color}
@ -58,13 +58,13 @@
\newcommand\pythonstyle{
\lstset{
language=Python,
basicstyle=\ttm\color{white},
basicstyle=\ttfamily\color{white}\tiny,
otherkeywords={self}, % Add keywords here
keywordstyle=\ttb\color{lightblue},
commentstyle=\ttb\color{teal},
keywordstyle=\ttfamily\color{lightblue},
commentstyle=\ttfamily\color{teal},
emph={MyClass,__init__}, % Custom highlighting
emphstyle=\ttb\color{deepred}, % Custom highlighting style
stringstyle=\color{red},
emphstyle=\ttfamily\color{deepred}, % Custom highlighting style
stringstyle=\ttfamily\color{red},
frame=tb, % Any extra options here
backgroundcolor = \color{black},
showstringspaces=false %
@ -441,7 +441,7 @@ $\rightarrow$ max. 600 messages per hour on SF7 \\
\end{minipage}
\item Programmable in MicroPython thanks to \texttt{uPyLora} library by lemariva (\url{https://github.com/lemariva/uPyLora})
\begin{spacing}{0.52}
\begin{spacing}{0.84}
\begin{python}
from lora_transceiver import LoRaTransceiver
from uPySensors.ssd1306_i2c import Display
@ -452,7 +452,7 @@ disp = Display()
lora = LoRaTransceiver(display=disp)
# send a string
lora.send_string("hello world!")
lora.send_string("Hello World!")
# send some raw binary data
lora.send([0x01, 0x02, 0x03])
@ -465,7 +465,7 @@ lora.send([0x01, 0x02, 0x03])
\begin{frame}[fragile]{Playground Part I}
\begin{itemize}
\item Receiving data:
\begin{spacing}{0.52}
\begin{spacing}{0.84}
\begin{python}
from lora_transceiver import LoRaTransceiver
from uPySensors.ssd1306_i2c import Display
@ -480,7 +480,7 @@ lora.recv()
\end{python}
\end{spacing}
\item Change LoRa parameters
\begin{spacing}{0.52}
\begin{spacing}{0.85}
\begin{python}
# change the spreading factor
lora.setSpreadingFactor(10)
@ -499,42 +499,190 @@ lora.setSyncWord(0x34)
\end{itemize}
\end{frame}
\section{LoRaWAN or 'How to send data to the cloud'}
\begin{frame}{Introduction}
\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}
\textbf{Outline:}
\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 Extensions: LoRaWAN
\begin{itemize}
\item explain basic idea (getting your sensor data online)
\item network topology
\item protocol
\item encryption
\item Fair use policy \url{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{itemize}
\item Practical part II: playing around with MicroPython LoRa modules, getting data into the cloud
\item LoRaWAN packet decoder {\small \url{https://lorawan-packet-decoder-0ta6puiniaut.runkit.sh/}}
\end{itemize}
\end{frame}
\section{Practical Part II}
\begin{frame}[fragile]
\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 Set device address, network and application key
\item Encrypt data (done by uLoRaWAN)
\item Encode data (as in Part I)
\item Send data ...
\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}
On the receiver side:
\end{frame}
\begin{frame}{References and further reading}
\begin{footnotesize}
References:
\begin{itemize}
\item ... receive data
\item Decrypt data (using keys)
\item Decode data (as in Part I)
\item Do something with the data
\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}
Best practices to reduce payload size: \url{https://www.thethingsnetwork.org/forum/t/best-practices-to-limit-application-payloads/1302}\\
Cayenne Low Power Payload (LPP)
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}