added lorawan applications examples and explanation of demodulation

pull/1/head
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.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():
fs = 8000
@ -188,6 +230,7 @@ def spreading_factor():
#symbol()
spreading_factor()
#spreading_factor()
demodulation()
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)
\end{itemize}
\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}
\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)
\end{itemize}
\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}
\begin{frame}{Digital modulation}
@ -303,12 +306,15 @@ Thanks Valentin and Stefan (DM4SG) for providing this data
\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}
\includegraphics<1>[scale=0.38]{images/lora_symbols_0.png}
\includegraphics<2>[scale=0.38]{images/lora_symbols_1.png}
\includegraphics<3>[scale=0.38]{images/lora_symbols_2.png}
\includegraphics<4>[scale=0.38]{images/lora_symbols_3.png}
\includegraphics<5>[scale=0.38]{images/lora_symbols_4.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}
\only<2->{
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<6>{Example: \texttt{data = }\texttt{10110}}
\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{frame}
@ -337,7 +352,7 @@ Time of frequency jump determines which data is encoded\\
\begin{frame}{Demodulation}
\begin{itemize}
\item Signal is multiplied by (mixed with) Down-Chirp
\item De-chirp signal by multiplying (mixing) with conjugate chirp
\item Fourier Transform
\end{itemize}
\end{frame}
@ -354,6 +369,7 @@ Reason: allows to detect and fix errors that occur during transmission (due to i
\end{itemize}
\end{frame}
\subsection{Packet format}
\begin{frame}{LoRa package format}
\begin{reference}{0mm}{70mm}
Source: SX1276/77/78/79 datasheet
@ -370,6 +386,7 @@ Source: SX1276/77/78/79 datasheet
\end{itemize}
\end{frame}
\subsection{Data rate and air time}
\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]
@ -424,6 +441,7 @@ $\rightarrow$ max. 600 messages per hour on SF7 \\
\section{Playground Part I}
\begin{frame}[fragile]{Playground Part I}
\begin{small}
\begin{itemize}
\item Module used: \textbf{Wemos® TTGO LORA32 868Mhz ESP32}
\begin{minipage}{0.6\textwidth}
@ -458,8 +476,11 @@ lora.send_string("Hello World!")
lora.send([0x01, 0x02, 0x03])
\end{python}
\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{small}
\end{frame}
\begin{frame}[fragile]{Playground Part I}
@ -500,6 +521,7 @@ lora.setSyncWord(0x34)
\end{frame}
\section{LoRaWAN}
\subsection{Network topology}
\begin{frame}{LoRaWAN}
\begin{reference}{2mm}{80mm}
https://www.thethingsnetwork.org/docs/lorawan/
@ -516,6 +538,7 @@ https://www.thethingsnetwork.org/docs/lorawan/
\end{itemize}
\end{frame}
\subsection{TheThingsNetwork}
\begin{frame}{Device registration}
\begin{itemize}
\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:
\begin{itemize}
\item LoRaWAN packet decoder {\small \url{https://lorawan-packet-decoder-0ta6puiniaut.runkit.sh/}}
\end{itemize}
\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}
Example code for sending data to \textbf{TheThingsNetwork}:
\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
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
7: 26 01 13 DA 16: 26 01 12 5B
8: 26 01 1E 8F 17: 26 01 13 63
9: 26 01 18 F1 18: 26 01 12 09
\end{python}
\item Watch incoming data at
\item Watch incoming data (forwarded as HTTP POST request) at
\begin{center}
\url{https://enny86r86c66.x.pipedream.net}
\url{https://t1p.de/ocp6}
\end{center}
and check the gateway logs at (@BayernWLAN wifi)
and check the gateway log at (connected to @BayernWLAN wifi)
\begin{center}
\url{http://192.168.1.1/}
\url{http://192.168.1.1:1337}
\end{center}
\end{itemize}
\end{frame}
\begin{frame}{References and further reading}
\begin{frame}{References and more information}
\begin{footnotesize}
References:
\textbf{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)
@ -666,14 +720,14 @@ References:
\item \href{https://www.youtube.com/playlist?list=PLmL13yqb6OxdeOi97EvI8QeO8o-PqeQ0g}{Mobilefish.com LoRa youtube tutorials}
\end{itemize}
Further reading:
\textbf{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 Radio module/antenna recommendations
\item ...
\end{itemize}
\item Cayenne Low Power Payload (LPP)

File diff suppressed because one or more lines are too long