From 54c0136a2edaffd3ab6262fad65976a841909dd2 Mon Sep 17 00:00:00 2001
From: Stefan Gehr <stefan.kerman.gehr@fau.de>
Date: Tue, 18 Oct 2022 15:51:40 +0200
Subject: [PATCH] start of the report

---
 report/src/report.tex | 56 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/report/src/report.tex b/report/src/report.tex
index 68ef769..3de4a41 100644
--- a/report/src/report.tex
+++ b/report/src/report.tex
@@ -6,11 +6,12 @@
 \usepackage{amsmath, amssymb}
 %\usepackage{graphicx}
 %\graphicspath{{../figures/}}
+\usepackage{siunitx}
 \usepackage{ragged2e}
 \usepackage{booktabs}
 \usepackage{hyperref}
 
-\title{Solar Pump}
+\title{Solar Pump Control}
 \subtitle{Arduino Project for the Arduino Block Course 2022}
 \author{Engelmann, Mario\and Gehr, Stefan}
 
@@ -21,10 +22,63 @@
 \tableofcontents
 
 \section{Introduction}
+For ur final project we decided to create a control system for a solar pump.
+There is a temperature sensor up at the solar array, and another one down at the heat exchanger.
+When the temperature difference is sufficiently high the pump gets turned on.
+It moves the hot water from the array to the heat exchanger.
+Once a certain smaller temperature difference is reached, the pump turns off again.
+This whole setup is actually realised twice, which means two solar arrays, two heat exchangers, two pumps, four temperature sensors.
+The reason for this is that we are actually planning to use this system.
+One of the author's uncle currently uses some analog electronics to handle his two solar arrays, but he would like to modernise it with a microcontroller.
+He also wants to know what the current state of the pumps are and what the temperatures are.
+For this we have provided a speaker, such that the microcrontroller can tell all the infos, and also a small display with all the infos on it.
+The reason for the speaker is that he is visually impaired.
+The display was just a nice add-on for us, but actually not that useful to our ``client''.
 
 \section{Main Code}
+At first everything is getting initialised, such that it can be used later.
+This contains the LCD display, the four temperature sensors, the two pumps and the button.
+Then the loop starts where a few things happen:
+\begin{itemize}
+	\item BUTTON: We check if our debounced button was pushed.
+		If it was then we
+		\begin{itemize}
+			\item tell our LCD display backlight to turn on for the next 30 seconds.
+			\item start saying all the infos over the loudspeaker.
+		\end{itemize}
+	\item TEMPERATURES: We get all the temperatures using our temperature library.
+		If any of those temperature readouts failed for more than 60 seconds,
+		we start turning on the pump for safety reasons.
+		Also the loudspeaker will continuously say ``error'' to inform the user.
+		Otherwise, with no circulation, the solar array might overheat.
+		If both readouts, for the up-temperature (from the array) and the down-temperature (from the heat exchanger), worked then the concerned pump gets controlled according to those temperatures.
+	\item PUMP: If it is currently turned off then we check if the temperature difference is bigger than \SI{10}{\kelvin}.
+		If it is then we turn it on.
+		If, on the other hand, the pump is currently turned on, then we check if the temperature difference is smaller than \SI{3}{\kelvin}.
+		If it is, then we turn it off again.
+	\item DISPLAY: Show all the current temperature readouts.
+		If there was a long time error with one of the readouts, just show a straight line ``---'' for that temperature instead.
+		Also show the current states of the two pumps.
+\end{itemize}
+
+Calling the functions that say anything over the loudspeaker does not halt the main loop.
+The way this was implemented is further explained in \autoref{sec:mp3}.
+Also the function, that turns on the backlight of the LCD display for 30 seconds,
+is not halting the main loop either.
+This is implemented via a static variable in the function,
+that saves the timestamp of when we started turning the display on.
+If the display is currently turned on and the this timestamp is more than 30 seconds ago, then we turn the backlight off again.
 
 \section{MP3}
+\label{sec:mp3}
+All the sounds we are playing over the speaker are pregenerated mp3-files.
+We used a text-to-speech program called ...
+% TODO: Mario, the stage is yours.
+% - header file soundFiles.h blabla
+% - mp3 module sending the signal start/stop "file number on the sd card"
+
+Another challenge was to not halt the main loop when we want to say something.
+For example if we want to
 
 \section{Saying Numbers}
 
-- 
GitLab