Update chapter solution with packet format
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
Severin Kaderli 2022-11-02 23:13:49 +01:00
parent 9a9115bf1b
commit 2c66a18f0e
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
5 changed files with 44 additions and 2 deletions

View file

@ -8,6 +8,8 @@ The main thread and Web Workers can communicate together using messages. They ca
Web Workers are used in this project to put a load on the CPU to modify the magnetic field without locking up the website itself.
\section{CRC}
\section{Manchester Code}
\section{Hall Sensor}

View file

@ -1,12 +1,33 @@
\chapter{Solution}
The solution consists of two separate applications: a website used for transmitting data and a smartphone application used for receiving data. Transmission between the two application happens using a simple protocol on top of magnetic induction.
The solution consists of two separate applications: a website used for transmitting data and a smartphone application used for receiving data. Transmission between the two application happens using a simple protocol on top of signals made using magnetic induction.
\section{Protocol}
\subsection{Signal}
The main communication protocol works over magnetic induction. By putting load on a CPU the resulting magnetic field can be changed. Using a magnetometer in a smartphone these changes can be measured and interpreted.
For simplification purposes the protocol in this project is used to transmit ASCII text but in reality any bit stream can be transmitted.
To indicate the start of a message in the transmission a preamble is used. The preamble used in this protocol is 3 high signals, followed by 1 low signal, followed by 3 high signals.
To indicate the start of a message in the signal, a preamble is used. The preamble used in this protocol is 3 high signals, followed by 1 low signal, followed by 3 high signals.
\subsection{Packet Format}
What follows the preamble is the actual contents of the message packet. The packet content is a bitstream encoded using a manchester code.
For the structure of the packet I
\cite{LoRaPacketFormat}
The first part of the message is the header. The header is \SI{8}{\bit} long and contains the length of the payload in bytes.
Next is the actual payload. As the length of the payload is specified in the header, the payload is limited to a size of $2^8$ bytes.
For verifying the integrity of the payload, a checksum of the payload is calculated and placed at the end of the packet. The algorithm used is the CRC-16-CCITT algorithm with the polynomial $x^{16} + x^{12} + x^{5} + 1$ and an initial value of $\mathtt{0x0000}$. This algorithm is a 16-bit CRC used in many applications such as Bluetooth. \cite{Bluetooth}
\begin{figure}
\begin{bytefield}[bitwidth=.125\linewidth, bitheight=11mm]{4}
\bitbox[]{1}[]{1 Byte} & \bitbox[]{5}[]{n Bytes} & \bitbox[]{2}[]{2 Bytes} \\
\bitbox{1}[bgcolor=red!30]{Payload Length} & \bitbox{5}[bgcolor=blue!30]{Payload} & \bitbox{2}[bgcolor=green!30]{CRC-16-CCITT}
\end{bytefield}
\caption{Packet Structure}
\end{figure}
\subsection{Sending}
\begin{enumerate}

View file

@ -14,6 +14,8 @@
pdfusetitle,
]{hyperref}
\usepackage{bytefield}
\usepackage{tabularray}
\NewTblrEnviron{reqTblr}%
\SetTblrInner[reqTblr]{%

View file

@ -115,3 +115,6 @@
* Header
* Payload
* CRC
# 2022-11-02
* Update chapter solution with the packet format

View file

@ -40,3 +40,17 @@
url = "https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API",
urldate = "2022-10-26"
}
@online {LoRaPacketFormat,
author = "Robert Lie",
title = "LoRa Packet Format, Time on Air and Adaptive Data Rate",
year = "2018",
url = "https://www.mobilefish.com/download/lora/lora_part17.pdf",
urldate = "2022-11-02"
}
@manual{Bluetooth,
organization = "Bluetooth SIG",
title = "Bluetooth Specification Version 4.2 [Vol 0]",
year = "2014",
}