added lorawan applications examples and explanation of demodulation

This commit is contained in:
Simon Pirkelmann 2019-12-01 11:46:17 +01:00
parent 6029b45fb8
commit 3861ebe2b3
23 changed files with 44265 additions and 24 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

View File

@ -152,6 +152,48 @@ def symbol():
plt.savefig('lora_symbols_{}.png'.format(i)) plt.savefig('lora_symbols_{}.png'.format(i))
plt.show() plt.show()
def demodulation():
# demodulation
fs = 8000
T = 10
t = np.linspace(0, T, T*fs, endpoint=False)
for i in range(0,3):
frac = 0.3
t_jump = T * (1 - frac)
# 250, 500, 750, 1000, 1250, 1500, 1750
t1 = (frac)*T
if i == 0:
symbol_p1 = chirp(t[0:int(frac*len(t))], f0=250, f1=1750, t1=T, method='linear')
symbol_p2 = chirp(t[int(frac*len(t)):], f0=250, f1=1750, t1=T, method='linear')
elif i == 1:
symbol_p1 = chirp(t[0:int(frac * len(t))], f0=1750, f1=250, t1=T, method='linear')
symbol_p2 = chirp(t[int(frac * len(t)):], f0=1750, f1=250, t1=T, method='linear')
elif i == 2:
symbol_p1 = chirp(t[0:int(frac * len(t))], f0=700, f1=700, t1=T, method='linear')
symbol_p2 = chirp(t[int(frac * len(t)):], f0=700, f1=700, t1=T, method='linear')
symbol = np.hstack((symbol_p2, symbol_p1))
ff, tt, Sxx = spectrogram(symbol, fs=fs, noverlap=256, nperseg=512,
nfft=2048)
#chirp = np.hstack((upchirp, upchirp))
#ff, tt, Sxx = spectrogram(chirp, fs=fs, noverlap=256, nperseg=512,
# nfft=2048)
plt.figure(5)
plt.yticks([250, 1000, 1750], ['868.1 MHz - 62.5 kHz', '868.1 MHz', '868.1 MHz + 62.5 kHz'] )
plt.pcolormesh(tt, ff[:513], Sxx[:513])
plt.title("LoRa Symbol")
plt.xlabel('time')
plt.ylabel('frequency')
plt.tight_layout()
plt.savefig('lora_demodulation_{}.png'.format(i))
plt.show()
def spreading_factor(): def spreading_factor():
fs = 8000 fs = 8000
@ -188,6 +230,7 @@ def spreading_factor():
#symbol() #symbol()
spreading_factor() #spreading_factor()
demodulation()
plt.show() plt.show()

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

View File

@ -253,7 +253,9 @@ Important: \includegraphics[trim=0cm 4cm 0 0cm, scale=0.11]{images/lora.jpg} $\l
\item \textbf{A}mplitude \textbf{S}hift \textbf{K}eying (ASK) \item \textbf{A}mplitude \textbf{S}hift \textbf{K}eying (ASK)
\end{itemize} \end{itemize}
\includegraphics[scale=0.35]{images/unmodulated.png} \includegraphics[scale=0.35]{images/unmodulated.png}
\includegraphics[scale=0.35]{images/amplitude_modulation.png} \includegraphics<1>[scale=0.35]{images/amplitude_modulation.png}
\includegraphics<2>[scale=0.35]{images/amplitude_modulation_2.png}
\end{frame} \end{frame}
\begin{frame}{Digital modulation} \begin{frame}{Digital modulation}
@ -264,7 +266,8 @@ https://en.wikipedia.org/wiki/Chirp\_spread\_spectrum
\item \textbf{F}requency \textbf{S}hift \textbf{K}eying (FSK) \item \textbf{F}requency \textbf{S}hift \textbf{K}eying (FSK)
\end{itemize} \end{itemize}
\includegraphics[scale=0.35]{images/unmodulated.png} \includegraphics[scale=0.35]{images/unmodulated.png}
\includegraphics[scale=0.35]{images/frequency_modulation.png} \includegraphics<1>[scale=0.35]{images/frequency_modulation.png}
\includegraphics<2>[scale=0.35]{images/frequency_modulation_2.png}
\end{frame} \end{frame}
\begin{frame}{Digital modulation} \begin{frame}{Digital modulation}
@ -303,12 +306,15 @@ Thanks Valentin and Stefan (DM4SG) for providing this data
\begin{frame}{Chirps and Symbols} \begin{frame}{Chirps and Symbols}
\begin{overlayarea}{\textwidth}{\textheight} \begin{overlayarea}{\textwidth}{\textheight}
\begin{center} \begin{center}
\includegraphics<1>[scale=0.4]{images/lora_symbols_0.png} \includegraphics<1>[scale=0.38]{images/lora_symbols_0.png}
\includegraphics<2>[scale=0.4]{images/lora_symbols_1.png} \includegraphics<2>[scale=0.38]{images/lora_symbols_1.png}
\includegraphics<3>[scale=0.4]{images/lora_symbols_2.png} \includegraphics<3>[scale=0.38]{images/lora_symbols_2.png}
\includegraphics<4>[scale=0.4]{images/lora_symbols_3.png} \includegraphics<4>[scale=0.38]{images/lora_symbols_3.png}
\includegraphics<5>[scale=0.4]{images/lora_symbols_4.png} \includegraphics<5>[scale=0.38]{images/lora_symbols_4.png}
\includegraphics<6>[scale=0.4]{images/lora_symbols_5.png} \includegraphics<6>[scale=0.38]{images/lora_symbols_5.png}
\includegraphics<7>[scale=0.35]{images/lora_demodulation_0.png}
\includegraphics<7>[scale=0.35]{images/lora_demodulation_1.png}
\includegraphics<8>[scale=0.38]{images/lora_demodulation_2.png}
\end{center} \end{center}
\only<2->{ \only<2->{
Time of frequency jump determines which data is encoded\\ Time of frequency jump determines which data is encoded\\
@ -319,6 +325,15 @@ Time of frequency jump determines which data is encoded\\
\only<5>{Example: \texttt{data = }\texttt{00011}} \only<5>{Example: \texttt{data = }\texttt{00011}}
\only<6>{Example: \texttt{data = }\texttt{10110}} \only<6>{Example: \texttt{data = }\texttt{10110}}
\end{center} \end{center}
\only<7->{
\vspace{-0.75cm}
\textbf{Demodulation:}
\begin{itemize}
\item De-chirp signal by multiplying (mixing) with conjugate chirp
\item Fourier Transform
\item Alignment using detect sequence at start of transmission
\end{itemize}
}
\end{overlayarea} \end{overlayarea}
\end{frame} \end{frame}
@ -337,7 +352,7 @@ Time of frequency jump determines which data is encoded\\
\begin{frame}{Demodulation} \begin{frame}{Demodulation}
\begin{itemize} \begin{itemize}
\item Signal is multiplied by (mixed with) Down-Chirp \item De-chirp signal by multiplying (mixing) with conjugate chirp
\item Fourier Transform \item Fourier Transform
\end{itemize} \end{itemize}
\end{frame} \end{frame}
@ -354,6 +369,7 @@ Reason: allows to detect and fix errors that occur during transmission (due to i
\end{itemize} \end{itemize}
\end{frame} \end{frame}
\subsection{Packet format}
\begin{frame}{LoRa package format} \begin{frame}{LoRa package format}
\begin{reference}{0mm}{70mm} \begin{reference}{0mm}{70mm}
Source: SX1276/77/78/79 datasheet Source: SX1276/77/78/79 datasheet
@ -370,6 +386,7 @@ Source: SX1276/77/78/79 datasheet
\end{itemize} \end{itemize}
\end{frame} \end{frame}
\subsection{Data rate and air time}
\begin{frame}{Data rate and air time} \begin{frame}{Data rate and air time}
\begin{itemize} \begin{itemize}
\item Data rate depends on bandwidth (BW), spreading factor (SF) and coding rate (CR)\\[0.3cm] \item Data rate depends on bandwidth (BW), spreading factor (SF) and coding rate (CR)\\[0.3cm]
@ -424,6 +441,7 @@ $\rightarrow$ max. 600 messages per hour on SF7 \\
\section{Playground Part I} \section{Playground Part I}
\begin{frame}[fragile]{Playground Part I} \begin{frame}[fragile]{Playground Part I}
\begin{small}
\begin{itemize} \begin{itemize}
\item Module used: \textbf{Wemos® TTGO LORA32 868Mhz ESP32} \item Module used: \textbf{Wemos® TTGO LORA32 868Mhz ESP32}
\begin{minipage}{0.6\textwidth} \begin{minipage}{0.6\textwidth}
@ -458,8 +476,11 @@ lora.send_string("Hello World!")
lora.send([0x01, 0x02, 0x03]) lora.send([0x01, 0x02, 0x03])
\end{python} \end{python}
\end{spacing} \end{spacing}
\item Have a look at SX1276 datasheet \vspace{-0.1cm}
\item Alternative: HopeRF \textbf{RFM95W} chip
\item For "documentation" see: \url{https://imaginaerraum.de/git/Telos4/LoRa-Workshop}
\end{itemize} \end{itemize}
\end{small}
\end{frame} \end{frame}
\begin{frame}[fragile]{Playground Part I} \begin{frame}[fragile]{Playground Part I}
@ -500,6 +521,7 @@ lora.setSyncWord(0x34)
\end{frame} \end{frame}
\section{LoRaWAN} \section{LoRaWAN}
\subsection{Network topology}
\begin{frame}{LoRaWAN} \begin{frame}{LoRaWAN}
\begin{reference}{2mm}{80mm} \begin{reference}{2mm}{80mm}
https://www.thethingsnetwork.org/docs/lorawan/ https://www.thethingsnetwork.org/docs/lorawan/
@ -516,6 +538,7 @@ https://www.thethingsnetwork.org/docs/lorawan/
\end{itemize} \end{itemize}
\end{frame} \end{frame}
\subsection{TheThingsNetwork}
\begin{frame}{Device registration} \begin{frame}{Device registration}
\begin{itemize} \begin{itemize}
\item \textbf{TheThingsNetwork} aims to build a global LoRaWAN network \item \textbf{TheThingsNetwork} aims to build a global LoRaWAN network
@ -580,11 +603,42 @@ http://www.techplayon.com/lora-long-range-network-architecture-protocol-architec
Useful link: Useful link:
\begin{itemize} \begin{itemize}
\item LoRaWAN packet decoder {\small \url{https://lorawan-packet-decoder-0ta6puiniaut.runkit.sh/}} \item LoRaWAN packet decoder {\small \url{https://lorawan-packet-decoder-0ta6puiniaut.runkit.sh/}}
\end{itemize} \end{itemize}
\end{frame} \end{frame}
\section{Practical Part II} \subsection{Applications}
\begin{frame}{Use cases}
\begin{reference}{0mm}{80mm}
\url{https://www.semtech.com/lora/resources/lora-white-papers}
\end{reference}
\begin{minipage}{0.5\textwidth}
\begin{flushleft}
\textbf{Smart farming}
\end{flushleft}
\includegraphics[scale=0.09]{images/smart_farming.png}
\end{minipage}%
\begin{minipage}{0.5\textwidth}
\begin{flushright}
\textbf{Smart parking}
\end{flushright}
\includegraphics[scale=0.09]{images/smart_parking.png}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\begin{flushleft}
\textbf{Smart home}
\end{flushleft}
\includegraphics[scale=0.09]{images/smart_home.png}
\end{minipage}%
\begin{minipage}{0.5\textwidth}
\begin{flushright}
\textbf{Smart waste management}
\end{flushright}
\includegraphics[scale=0.09]{images/smart_waste.png}
\end{minipage}%
\end{frame}
\section{Playground Part II}
\begin{frame}[fragile]{Playground Part II} \begin{frame}[fragile]{Playground Part II}
Example code for sending data to \textbf{TheThingsNetwork}: Example code for sending data to \textbf{TheThingsNetwork}:
\begin{spacing}{0.85} \begin{spacing}{0.85}
@ -640,24 +694,24 @@ For testing you can use the following device addresses and keys:
4: 26 01 17 83 13: 26 01 19 40 4: 26 01 17 83 13: 26 01 19 40
5: 26 01 1B 5C 14: 26 01 19 96 5: 26 01 1B 5C 14: 26 01 19 96
6: 26 01 1E B5 15: 26 01 18 FF 6: 26 01 1E B5 15: 26 01 18 FF
7: 26 01 13 DA 7: 26 01 13 DA 16: 26 01 12 5B
8: 26 01 1E 8F 8: 26 01 1E 8F 17: 26 01 13 63
9: 26 01 18 F1 9: 26 01 18 F1 18: 26 01 12 09
\end{python} \end{python}
\item Watch incoming data at \item Watch incoming data (forwarded as HTTP POST request) at
\begin{center} \begin{center}
\url{https://enny86r86c66.x.pipedream.net} \url{https://t1p.de/ocp6}
\end{center} \end{center}
and check the gateway logs at (@BayernWLAN wifi) and check the gateway log at (connected to @BayernWLAN wifi)
\begin{center} \begin{center}
\url{http://192.168.1.1/} \url{http://192.168.1.1:1337}
\end{center} \end{center}
\end{itemize} \end{itemize}
\end{frame} \end{frame}
\begin{frame}{References and further reading} \begin{frame}{References and more information}
\begin{footnotesize} \begin{footnotesize}
References: \textbf{References:}
\begin{itemize} \begin{itemize}
\item Decoding LoRa \url{https://revspace.nl/DecodingLora} \item Decoding LoRa \url{https://revspace.nl/DecodingLora}
\item \textit{LoRa und The Things Network} - talk by Hubert Högl (FH Augsburg) \item \textit{LoRa und The Things Network} - talk by Hubert Högl (FH Augsburg)
@ -666,14 +720,14 @@ References:
\item \href{https://www.youtube.com/playlist?list=PLmL13yqb6OxdeOi97EvI8QeO8o-PqeQ0g}{Mobilefish.com LoRa youtube tutorials} \item \href{https://www.youtube.com/playlist?list=PLmL13yqb6OxdeOi97EvI8QeO8o-PqeQ0g}{Mobilefish.com LoRa youtube tutorials}
\end{itemize} \end{itemize}
Further reading: \textbf{Further reading:}
\begin{itemize} \begin{itemize}
\item TTN Applications: APIs, Python SDK, Integrations {\scriptsize \url{https://www.thethingsnetwork.org/docs/applications/}} \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 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/} \item Forum about all things LoRa: \url{https://www.thethingsnetwork.org/forum/}
\begin{itemize} \begin{itemize}
\item Gateway guides \item Gateway guides
\item Antenna recommendations \item Radio module/antenna recommendations
\item ... \item ...
\end{itemize} \end{itemize}
\item Cayenne Low Power Payload (LPP) \item Cayenne Low Power Payload (LPP)

File diff suppressed because one or more lines are too long