archive/intro.tex

176 lines
12 KiB
TeX

\documentclass[10pt, draftclsnofoot,onecolumn, compsoc]{IEEEtran}
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
\usepackage{textcomp}
\usepackage{todonotes}
\usepackage{caption}
\usepackage{pgfgantt}
\usepackage{setspace}
\linespread{1}
\def \CapstoneTeamName{Automated Fenceless Grazing}
\def \CapstoneTeamNumber{CS3}
\def \GroupMemberOne{Ryan Alder}
\def \GroupMemberTwo{Danila Fedorin}
\def \GroupMemberThree{Matthew Sessions}
\def \CapstoneProjectName{Automated Fenceless Grazing}
\def \CapstoneSponsorCompany{Oregon State University}
\def \CapstoneSponsorPerson{Bechir Hamdaoui}
\def \DocType{Project Archive Master Document}
\newcommand{\NameSigPair}[1]{\par
\makebox[2.75in][r]{#1} \hfil \makebox[3.25in]{\makebox[2.25in]{\hrulefill} \hfill \makebox[.75in]{\hrulefill}}
\par\vspace{-12pt} \textit{\tiny\noindent
\makebox[2.75in]{} \hfil \makebox[3.25in]{\makebox[2.25in][r]{Signature} \hfill \makebox[.75in][r]{Date}}}}
\begin{document}
\begin{titlepage}
\pagenumbering{gobble}
\begin{singlespace}
% 4. If you have a logo, use this includegraphics command to put it on the coversheet.
%\includegraphics[height=4cm]{CompanyLogo}
\par\vspace{.2in}
\centering
\scshape{
\huge CS Capstone \DocType \par
{\large\today}\par
\vspace{.5in}
\textbf{\Huge\CapstoneProjectName}\par
\vfill
{\large Prepared for}\par
\Huge \CapstoneSponsorCompany\par
\vspace{5pt}
{\Large\NameSigPair{\CapstoneSponsorPerson}\par}
{\large Prepared by }\par
Group\CapstoneTeamNumber\par
% 5. comment out the line below this one if you do not wish to name your team
\CapstoneTeamName\par
\vspace{5pt}
{\Large
\NameSigPair{\GroupMemberOne}\par
\NameSigPair{\GroupMemberTwo}\par
\NameSigPair{\GroupMemberThree}\par
}
\vspace{20pt}
}
\begin{abstract}
The Fenceless Grazing System aims to reduce the amount of work
needed by farmers to keep and manage herds of grazing animals. The project
implements a network of devices using the LoRa wireless communication protocol to allow
for long-range interaction between animal-worn collars and a gateway.
An HTTP-based JSON API server is hosted on the same hardware as the gateway, and applies configuration
changes to collars through an application built for Android mobile devices.
A MariaDB SQL database management system is used to store the data
received from the collar for viewing and analysis. This document
contains all information and major documents gathered and created during
the process of implementing the Fenceless Grazing System.
\end{abstract}
\end{singlespace}
\end{titlepage}
\pagebreak
\section*{Table of Contents}
\input{generated.toc}
\pagebreak
\section*{Foreword}
\subsection*{Release Notes}
In its present version, the project is capable of the following things:
\begin{itemize}
\item \textbf{GPS reporting}: Each collar has the ability to gather GPS information frequently and transmit this information back to the gateway. Each end-device has a certain frequency of communication, and can be set to send messages once every certain time period. This value is defined based on the number of end-devices, battery constraints, and desired latency. For example, the frequency can be set to once every 5 minutes. Then, the gateway will hear over LoRa a transmission from an end-device once every 5 minutes. This information is decoded and saved to the database. The contents of this message is the current location of the end-device. This allows each collar to frequently inform the gateway and eventually the user of its current location, and the database provides a history of each collar.
\item \textbf{Observing all animals on the Android application}: The Android application can display to the user the most recent location of each end-device based on the last received transmission. This information is displayed on a fully interactive map, allowing the user to navigate the map by zooming or panning. This provides the user with the ability to observe each animal's location, which is accurate to about a foot.
\item \textbf{Defining grazing boundaries}: The Android application fully supports defining boundaries by adding and manipulating coordinates on an interactive map. The user has the ability to add a grazing boundary using up to ten different points. Once the user has defined these points on the map, and is happy with the resulting boundary, this information is send over HTTP back to the server which then saves this information into the database. The gateway will then poll this database frequently, and once it notices that a new boundary has been defined it will queue this new data to be sent to every end-device on the next transmission. Then, the new boundaries are sent out and received by each collar which overwrites the old boundaries in memory.
\item \textbf{Bounds checking}: Each collar has the ability to determine it's location and check whether or not it is with the grazing bounds through the use of an algorithm. This algorithm determines whether or not a GPS location is constrained by an area defined by a various number of coordinates. This provides the collar with the functionality to divert animals away from boundaries once the stimulus has been decided on and implemented. That is, currently the collar only knows when it is no longer in bounds but does not presently do anything about it. However, it is trivial to do something with this information once stimulus hardware has been implemented.
\item \textbf{Observing end-node movement history}: The Android application has the ability to select one specific collar and observe the history of this collar. The movement of this collar is then displayed onto the interactive map with lines, and the rancher has the ability to see exactly where this animal has been over a certain time period. All of this information is sent to the Android application from the server, and the server gathers this history from the database. As each communication from the end-devices are saved to the database, it is trivial to go through all history for one specific collar.
\end{itemize}
\subsection*{Next Steps}
To pick the project up, we recommend that different hardware be used for the collar devices. We have run
into some serious limitations while using the LoRa-enabled ATMega controllers; the combination of LoRa,
GPS, and Protobuf firmware was too large to fit in device memory. This led us to develop our own, stripped
down versions of a lot of the software. Yet even with this, the firmware on the collar ends up running
in a very constrained environment, and small changes that increase stack usage even by a small amount
can lead to crashes.
At present, the collar is capable of sending its position, retrieving valid grazing areas, and verifying
that it is in a valid position. The next step on the collar side, then (after the hardware changes suggested
above) would be to add to the collar a physical indication of whether or not it is in a valid grazing
boundary (see the Design Document below for an idea of what that is). This physical indication can be
an LED light, but the final goal would be to have that indication be a buzzer or an electric shock.
The gateway software is capable of receiving and configuring a single collar device (See Appendix 4
for an explanation of why only a single device is currently supported). The next step for the
gateway software, then, is to add support for multiple collar devices. Additionally, the gateway
software currently uses the Things Network to decode and process LoRaWAN packets. This is less
than ideal since it requires a connection to the Internet (rather than allowing the system
to work on a LAN), and because it uses a third-party service to process animal data. To avoid
this, the best course of action would be to use a local LoRaWAN implementation on the gateway.
At the time of writing such software is not easily available, and was deemed too difficult to
create. Finally, we recommend that a mechanism be added to the gateway software to verify
that a collar has received an updated grazing boundary.
The Android application is, in our view, the lowest priority at present. It is capable
of authenticating and working with the API server, viewing animal locations,
and of modifying collar grazing boundaries. Next steps could include the display of additional
statistics (this would also require changes to the API server).
Please refer to Appendix 4 for a description of all things that need to be done.
\pagebreak
\section*{Project Introduction}
The Fenceless Grazing System was designed and implemented as requested by OSU professor Bechir Hamdaoui,
who also served as the project's client.
Prof. Hamdaoui believes that there is an emerging market for smart collar systems, and wanted to explore
the implementation of such a system using the LoRa \textbf{Lo}ng \textbf{Ra}nge communication protocol.
The project is meant as a proof of concept of an automated animal tracking and monitoring system.
The team consisted of three members:
\begin{itemize}
\item \textbf{Ryan Alder} served as the liaison with Prof. Hamdaoui, and as a LoRa expert. Being the
most familiar of the three team members with the LoRa protocol, he oversaw and aided the
implementation of the collar and gateway, each of which used the protocol to communicate with
the other. Ryan also tested the system in practice, measuring the effective range of the
components and verifying that data can be transmitted back and forth.
\item \textbf{Danila Fedorin} worked on the "high level" components of the system, namely
the Android application and the API server, as well on the overall system architecture.
He additionally designed the database schema and part of the data encoding protocol
used by the system.
\item \textbf{Matthew Sessions} worked on the "low level" components of the system, namely
the collar and gateway. Having strong background in embedded development, Matthew
was the source of truth in the implementation of hardware components, as well
as their troubleshooting.
\end{itemize}
Prof. Hamdaoui was largely not involved in the overall design of the system. Though he requested
the use of the LoRa protocol, and suggested an overall architecture for the project, the same
overall architecture was independently developed by the team. In meetings, scheduled approximately
once a month, Prof. Hamdaoui provided guidance on which component of the system to prioritize next,
but gave the team the freedom to decide how to implement said component.
The COVID-19 pandemic led the development to slow down slightly, since team meetings and interaction
became more difficult. While previously, hardware components were distributed among some team members
(Ryan and Matthew), this became impractical due to the requirement of social distancing. However, this
did meaningfully affect the project deliverables, as the team was able to set up a system for remotely
modifying the physical components' firmware.
For information on how to pick up the project, see the \emph{Next Steps} section of the \emph{Foreword}, and
Appendix 4.
\subsection*{A Note on Tables of Contents}
A large portion of this document is generated from existing files relating to this project, such as the design document,
the various tech reviews, and the weekly blog posts. Many of these have their own tables of contents. These
tables refer to the page number within overarching section: if the design document begins on page 10, and its table
of contents says that a section is on page 3, this refers to the third page from the beginning of the section, which
would be the 12th page in the document overall.
\end{document}