\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 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 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}
    \item{Convert the text to an ASCII encoded bit stream}
    \item{Encode the ASCII bit stream using manchester encoding}
    \item{Start the transmission by sending the preamble}
    \item{Transmit the manchester encoded bit stream}
    \item{Repeat from step 3 until transmission is stopped}
\end{enumerate}

\subsection{Receiving}
\begin{enumerate}
    \item{Detect the preamble}
    \item{Decode the received manchester encoded bit stream}
    \item{Convert the ASCII bit stream to text}
\end{enumerate}

\section{Website}

\section{App}
