From 1151d348c0d8d5e3a92d02188911dfd305c9187b Mon Sep 17 00:00:00 2001 From: Thing1 Date: Sun, 15 Dec 2024 19:06:48 +0000 Subject: finished coursework --- electronics/cw1/writeup.tex | 117 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 94 insertions(+), 23 deletions(-) (limited to 'electronics/cw1/writeup.tex') diff --git a/electronics/cw1/writeup.tex b/electronics/cw1/writeup.tex index b7fad58..5dfa82d 100644 --- a/electronics/cw1/writeup.tex +++ b/electronics/cw1/writeup.tex @@ -10,8 +10,12 @@ \usepackage{xcolor} \usepackage{graphicx} \usepackage{forest} -\usepackage{tikz-qtree} \usepackage[siunitx, european, straightvoltages, cute inductors]{circuitikz} -\usepackage{setspace} \usepackage{ragged2e} +\usepackage{tikz-qtree} +\usepackage[siunitx, european, straightvoltages, cute inductors]{circuitikz} +\usepackage{setspace} +\usepackage{ragged2e} +\usepackage{graphicx} +\graphicspath{ {./images/} } \addbibresource{ref.bib} @@ -81,17 +85,30 @@ their tanks getting too hot, especially in the summer, my project is perfect for these fish owners. \section{Design specification} + \subsection{Design brief} + This project will need to achieve a few goals to be deemed as a success, they are as follows: + \begin{description} + \item[] Display a status LED to tell the user all is working as expected + \item[] Check the temperature against a known value + \item[] Have the ability to notify the user if the temperature is above the known value + \item[] Have the ability to inform the user if the temperature has risen above the known value and then fallen again + \item[] To have the system reset easily + \end{description} + If my project can meet all of these goals it will be a useable temperature sensing system, primarily designed for fish tanks, + but could be used in any number of temperature dependant environments. \subsection{System Design} - The project will need to do the following things: + \subsubsection{Outline of internal workings} + The project will need to do the following things internally to function as outlined in the design brief. These are tasks that + will be ran on the microcontroller by the assembly code I need to write. \begin{description} - \item[] Read the temprature - \item[] Compare the temprature to a known value + \item[] Read the temperature + \item[] Compare the temperature to a known value \item[] The output is a flashing led and buzzer \item[] The output is a flashing led and buzzer \end{description} - - My system will contain the following components to - function: + + \subsubsection{Outline of component roles} + My system will contain the following components to function scouring to my outline of internal workings: \begin{description} \item[Mircocontroller] This will be used to control all the other components \item[Thermistor] This will sense the temperature @@ -123,19 +140,20 @@ As one can see a button will control the Microcontroller, by drawing all the current that the power supply can through the button, one can make the Microcontroller reset. The Microcontroller will have 2 inputs, and - 4 outputs. The potentiomiter will be used to set the threshold in which the warnings begin, this will be done + 4 outputs. The potentiometer will be used to set the threshold in which the warnings begin, this will be done inside the microcontroller, with a subtraction between the Thermistor value, and the potentiometer value. The needed outputs will pulse to be especially clear that something is wrong. - \subsection{Flowchart} - Here is my code, build into an abstracted flow chart, to make the reading of the program easier. + \subsection{Planning the inner workings} + \subsubsection{Flowchart} + Here is my code, built into an abstracted flow chart, to make the reading of the program easier. It is spread across 2 pages, to ensure it is big enough to read. \begin{tikzpicture}[node distance=2cm] \node (start) [startstop] {Start}; - \node (in1) [io, below of=start] {Read temprature}; + \node (in1) [io, below of=start] {Read temperature}; \node (in2) [io, below of=in1] {Read threshold value}; - \node (dec1) [decision, below of=in2, yshift=-2cm] {Is the temprature too hot?}; + \node (dec1) [decision, below of=in2, yshift=-2cm] {Is the temperature too hot?}; \node (sub1) [subroutine, right of=dec1, xshift=6cm] {Flash}; \node (proc1) [process, below of=dec1, yshift=-2cm, xshift=6cm] {Reset the status flag}; @@ -175,7 +193,7 @@ - \subsection{How will it function?} + \subsubsection{How will it function outside of the microcontroller?} Bellow is the diagram for my circuit, it works mostly via the code on the micro controller, so this is just connecting things between live and the microcontroller. \begin{flushleft} @@ -236,13 +254,13 @@ flashes at the same time; an amber LED that turns on after the flashing has stopped to inform the user that it was too hot at some point; and a green status LED to inform the user that all is working. - \subsection{The code} - Bellow is the code for the micro controller. It is 59 lines long and commented. It contains 12 unique instructions. + \subsubsection{The code controlling everything else} + Bellow is the code for the micro controller. It is 58 lines long and commented. It contains 12 unique instructions. \lstinputlisting[]{./final.asm} This code starts with an initialisation section, that sets the micro controller's input and output pins to do the correct things. Then it defines a subroutine that flashes the LED and buzzer and sets the status led. And finally the main function runs in a loop to continue checking if it is too hot. - \subsection{Errors in code} + \subsubsection{Errors in code} Through out the development of project, a few errors came up in my code, I fixed them, however here is a documented list of them \subsubsection{Forgetting to specify the output register} @@ -255,19 +273,72 @@ was to change a C to an S. \section{System Realisation} + After designing and writing the functionality, code, and the circuit it was time to build it. Here is the finished results. \subsection{Circuit realisation} - PUT CIRCUIT PHOTO HERE - Here is my finished design prototyped on a bread board, I have cut the wires to an adequate length to ensure it is cleanly made. - I left the potential divider uncut, as I changed what value components I was using many times. + \includegraphics[width=\textwidth]{off.jpg.jpeg} - \subsection{Calibrating the sensors} - PUT PHOTOS HERE FOR CALIBRATING + Here is my finished design prototyped on a bread board, I have cut the wires to an adequate length to ensure it is cleanly made. + I left the potential divider uncut, as I changed what value components I was using many times throughout building. In this photo + an external (off breadboard) thermistor is being used. + + I decided to use a multi-turn potentiometer instead of a traditional one, this allowed me and the end user, to calibrate the + system to far smaller amounts. + + \subsection{Calibrating the sensors and testing the system} + To calibrate my system I used water at a known temperature and a thermometer to measure. I then tuned my potentiometer to the adequate + value to ensure the circuit functioned as intended. + + Here is the circuit at a normal state with water at \({20}^\circ C \). + \\ + \\ + \includegraphics[width=\textwidth]{normal.jpg.jpeg} + \\ + As one can see the green LED is on at the correct time! + \\ + \includegraphics[width=\textwidth]{offtemp.jpg.jpeg} + \\ + After adding more hot water one can see it switch to the higher point. + \\ + \includegraphics[width=\textwidth]{hotLED.jpg.jpeg} + \\ + As the temperature rises above the \({26}^\circ C \) switching threshold the red LED begins to blink. + \\ + \includegraphics[width=\textwidth]{hightemp.jpg.jpeg} + \\ + \includegraphics[width=\textwidth]{formerhot.jpg.jpeg} + \\ + As one can see after it falls back to a low temperature the amber status LED comes on to let the user know + it has been too hot. + \\ + \includegraphics[width=\textwidth]{lowtemp.jpg.jpeg} + \\ + This temperature caused the amber LED to come on after being at \({26}^\circ C \) previously. + \\ \subsection{Results} + As shown in the previous sections the circuit has worked as intended, it switches at a user defined temperature, which for testing + purposes I have set to \({26}^\circ C \). The tuning process is easy and simple to work with, only requiring the turning of a potentiometer. + This could be set out of box in a production setting, or it could be tweaked by the use to their needs. \section{System Evaluation} - \subsection{Did it work?} \subsection{What could go better?} + To make this system better I would have liked to make it test temperatures using a difference amplifier to compare to another known temperature as this + would have let me compare to room temperature, instead of set constants, this would be more helpful if the use case was slightly changed, to show relative + temperature, which would be helpful in a factory to show temperatures next to a machine. This however was out of the scope of this project, as I was + attempting to use a microcontroller to do all comparisons, a difference amplifier would have removed the need for the microcontroller, making the project + irrelevant. + + I also would have liked it if I could have added more features to the code, perhaps in some way adding an interrupt service to allow for further user control. + Perhaps as a simple clear amber status LED. + + Finally I was not overly happy with my solution to resetting the microcontroller, I chose to, for a short time, short circuit the power rails of my bread board, + to cut power from the microcontroller, if I were to make any edits to this system I would have replaced this with a simple MOSFET system that could keep it + powered until a button was pressed. This sadly wasn't possible due to time constraints on this project. This is also caused a flaw in the 18M2 picaxe chip. The + original 16F88 has a reset pin, that could have been used to clear the microcontroller's state , this isn't available on the 18M2 chip. + + \subsection{Conclusions} + Overall, including short comings, I am happy with my system. It completed my design brief of a simple temperature sensing system in a simple way. I believe this + could be used for its goal of triggering alarms when fish tanks of other similar items, reach an unsafe temperature. \newpage -- cgit v1.2.3