\documentclass[10pt, draftclsnofoot,onecolumn, compsoc]{IEEEtran}

\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist

\usepackage{hyperref}
\usepackage{framed}
\usepackage{textcomp}
\usepackage{todonotes}
\usepackage{caption}
\usepackage{pgfgantt}
\usepackage{setspace}
\linespread{1}

\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

  \title{Project Documentation}

\begin{document}
\maketitle

\section{Project Overview}
Our project consists of three major components: a series of end-devices attached to each animal, a gateway hosted in a central location, and a network server implementing the LoRaWAN capabilities. Much of the communication between these devices is via LoRa, the physical communication protocol. Each end-device communicates back and forth with the gateway using LoRa and LoRaWAN as illustrated in the image linked below. A Raspberry Pi is the main computer that implements both the LoRaWAN gateway and the HTTP API server. The LoRaWAN gateway intercepts communications and forwards LoRa packets received from each end-device to the network server over the desired backend. This depends on the internet setup at each seperate farm, and can vary between Ethernet or Wi-Fi to a router connected to an ISP modem. The gateway also sends packets back to each end-device when the user has provided a new set of boundary coordinates.

Packets are forwarded by the gateway off to The Things Network, hosted outside of our LAN. The Things Network manages encryption and parsing of the packets, and sends all data back to us over the internet backend. The Pi gathers this data, and stores it in the SQL database.

Lastly, the HTTP server hosted on the Pi queries the databased when necessary to send communications back to the user. The user runs an Android application on their smartphone, and is able to connect to our service from anywhere outside of the LAN as long as they have an internet connection.

Each collar, or end-device, hosts various hardware components. These components include an Arduino Nano, a 5 volt to 3.3 volt logic converter, a GPS receiver, and a LoRa transceiver. These components communicate over SPI and the Nano hosts compiled C++ code that manages sending and receiving GPS data over LoRaWAN as well as boundary checking.

All of these components work together to provide the required functionality of the Fenceless Grazing System, and give the user a seamless way to interact with each one of the collars while sufficiently abstracting the technical components.

\begin{figure}[h]
    \centering
    \includegraphics[width=0.8\linewidth]{stack.png}
    \caption{Project Structure Diagram}
\end{figure}

The following sections are generated from the README files found in the repositories for this project. In case there are some visual bugs (which is not uncommon with LaTeX generated from Markdown), please refer to the original markdown files found in the project archive.

\pagebreak
\input{readme-app.tex}

\pagebreak
\input{readme-server.tex}

\pagebreak
\input{readme-cdl.tex}

\pagebreak
\input{readme-gateway.tex}
\input{readme-collar.tex}

\end{document}
