diff --git a/ch.example_projects.tex b/ch.example_projects.tex index 4b0dfdb..c25f6a6 100644 --- a/ch.example_projects.tex +++ b/ch.example_projects.tex @@ -1,3 +1,104 @@ \chapter{Example Applications} -\todo[inline]{OwO} +This chapter presents a few example applications of GEX to illustrate its versatility. + +\section{Frequency Response Measurement} + +The frequency response of a filter may be measured with a combination of the ADC and DAC units. The DAC is configured to generate a sine wave as a stimulus for the filter, while the ADC captures the output waveform. By varying the generated frequency and measuring the amplitude, we obtain a frequency response of the filter. If we measured both the input and output, we could calculate the phase shift and produce a real Bode diagram. + +\cref{fig:demofilter} depicts a simple test setup with a passive RC filter; its characteristics in the low-pass and high-pass configuration, as obtained with GEX, are shown in \cref{fig:demofilter_cap}. + +\begin{figure}[h] + \centering + \includegraphics[width=0.7\textwidth]{img/demofilter.jpg} + \caption{GEX Zero measuring a passive high-pass RC filter} + \label{fig:demofilter} +\end{figure} + +\begin{figure} + \centering + \begin{subfigure}{.5\textwidth} + \centering + \includegraphics[width=\linewidth]{img/filter1.pdf} + \end{subfigure}% + \begin{subfigure}{.5\textwidth} + \centering + \includegraphics[width=\linewidth]{img/filter2.pdf} + \end{subfigure} + \caption[RC filter frequency responses]{Frequency response of two complementary passive RC filters, captured by GEX controlled with a Python script. X: frequency (Hz), Y: peak-to-peak voltage as a raw ADC word } + \label{fig:demofilter_cap} +\end{figure} + +\section{Measuring \texorpdfstring{CO$_2$}{CO2} Concentration} + +The \gls{NDIR} CO$_2$ sensor MH-Z19B provides both a \gls{UART} interface, and a pulse-width modulated signal with a duty cycle proportional to the CO$_2$ concentration. +We used it to verify the duty cycle measurement functionality of the frequency capture unit, and also tested the \gls{USART} unit with the digital interface. The measured concentration was displayed using the SIPO unit on a 74HC595-drive red-green LED bargraph (\cref{fig:democo2}). + +\begin{figure}[H] + \centering + \begin{subfigure}{.72\textwidth} + \includegraphics[width=.98\textwidth]{img/ph-co2.jpg} + \caption{CO$_2$ concentration measurement} + \end{subfigure}% + \begin{subfigure}{.28\textwidth} + \includegraphics[width=.98\textwidth]{img/sipodemo.jpg} + \caption{LED display} + \end{subfigure} + \caption[Demo with a CO$_2$ sensor]{GEX firmware on the Discovery board reading CO$_2$ concentration from the MH-Z19B \gls{NDIR} sensor and displaying the concentration on an \gls{LED} bargraph} + \label{fig:democo2} +\end{figure} + + +\section{Controlling the ``Micro Dot pHAT''} + +The ``Micro Dot pHAT'' add-on board was used to test GEX Zero's compatibility with pHATs. A photo of the pHAT on GEX Zero, together with example scripts, was presented in \cref{sec:ex_python_script}. While this board does not provide any useful functionality beyond displaying \gls{LED} patterns, it is a proof that third-party add-ons for the RPi Zero may be compatible with GEX, which introduces many interesting possibilities. + +\section{Capturing Transient Effects} + +The ADC unit supports level-based triggering. This was tested first by capturing the charging waveform of a capacitor (\cref{fig:captransient}). As the triggering voltage had to be placed above the noise floor, the triggering condition occurred when a part of the waveform already passed. This was solved by using the pre-trigger feature to include past records at the beginning of the capture. + +A more interesting application of level triggering was discovered by accident during a thunderstorm, when the electromagnetic interference from a (remote) lightning strike caused a voltage spike to appear on an oscilloscope probe. Investigating the phenomenon, we devised a simple ``lightning trap'' circuit (\cref{fig:lightningtrap}). The resistor forms a discharge path for the capacitor, which acts as a high-pass filter of sorts. The voltage on the \gls{ADC} input remains at about half of the operating range, and lightning strikes produce bursts of voltage spikes which we can trigger on and record. + +This method of lightning detection should be regarded as a mere curiosity without much scientific value, and the circuit could certainly be improved to be safer and more sensitive. Nonetheless, the simple setup proved functional and several lightning strikes were automatically captured (\cref{fig:strikes}). + +\begin{figure}[h] +\centering +\includegraphics[width=\textwidth]{img/transient.pdf} +\caption{Capacitor charging waveform captured by the ADC unit, 50\,kS/s. X: sample number, Y: ADC word. X grid: 200\,$\mu$s.} +\label{fig:captransient} +\end{figure} + +\begin{figure}[b] +\centering +\includegraphics[scale=1.2]{img/thundertrap.pdf} +\caption{The ``lightning trap'' circuit} +\label{fig:lightningtrap} +\end{figure} + +\begin{figure}[h] + \centering + \begin{subfigure}{.5\textwidth} + \includegraphics[width=\textwidth]{img/strike1} + \end{subfigure}% + \begin{subfigure}{.5\textwidth} + \includegraphics[width=\textwidth]{img/strike2} + \end{subfigure}\\ + \begin{subfigure}{.5\textwidth} + \includegraphics[width=\textwidth]{img/strike3} + \end{subfigure}% + \begin{subfigure}{.5\textwidth} + \includegraphics[width=\textwidth]{img/strike4} + \end{subfigure} + \caption{Lightning strike-generated bursts of energy captured by the ADC unit. Note the X-axis value 500 where the bursts start: that was the configured pre-trigger length} + \label{fig:strikes} +\end{figure} + + + + + + + + + + diff --git a/ch.pc_software.tex b/ch.pc_software.tex index d287c6c..ef0a735 100644 --- a/ch.pc_software.tex +++ b/ch.pc_software.tex @@ -43,7 +43,7 @@ Three transport implementations have been developed: The wireless gateway is accessed by wrapping either of the transports in an instance of \mono{gex.DongleAdapter} before passing it to \mono{gex.Client}. -\subsection{Example Python Script} +\subsection{Example Python Script} \label{sec:ex_python_script} An example Python program displaying a test pattern on a \gls{LED} matrix using the \gls{I2C}-connected driver chip IS31FL3730 is presented in \cref{lst:py_api} as an illustration of the library usage. A photo of the produced \gls{LED} pattern can be seen in \cref{fig:pydemo}. diff --git a/img/cap-small.png b/img/cap-small.png new file mode 100644 index 0000000..8ac1aec Binary files /dev/null and b/img/cap-small.png differ diff --git a/img/capcharge.png b/img/capcharge.png new file mode 100644 index 0000000..8a5d59d Binary files /dev/null and b/img/capcharge.png differ diff --git a/img/debugging-usb.png b/img/debugging-usb.png new file mode 100644 index 0000000..d9772c4 Binary files /dev/null and b/img/debugging-usb.png differ diff --git a/img/demofilter.jpg b/img/demofilter.jpg new file mode 100644 index 0000000..06b85d3 Binary files /dev/null and b/img/demofilter.jpg differ diff --git a/img/filter1.pdf b/img/filter1.pdf new file mode 100644 index 0000000..1714367 Binary files /dev/null and b/img/filter1.pdf differ diff --git a/img/filter2.pdf b/img/filter2.pdf new file mode 100644 index 0000000..4c7965c Binary files /dev/null and b/img/filter2.pdf differ diff --git a/img/matlab-fft.png b/img/matlab-fft.png new file mode 100644 index 0000000..2cae477 Binary files /dev/null and b/img/matlab-fft.png differ diff --git a/img/ph-co2.jpg b/img/ph-co2.jpg new file mode 100644 index 0000000..1eb7a0c Binary files /dev/null and b/img/ph-co2.jpg differ diff --git a/img/photos/2017-11-04T17:51:29Z_0.png b/img/photos/2017-11-04T17:51:29Z_0.png new file mode 100644 index 0000000..d9772c4 Binary files /dev/null and b/img/photos/2017-11-04T17:51:29Z_0.png differ diff --git a/img/photos/2018-02-08T21:08:35Z_0.png b/img/photos/2018-02-08T21:08:35Z_0.png new file mode 100644 index 0000000..8a5d59d Binary files /dev/null and b/img/photos/2018-02-08T21:08:35Z_0.png differ diff --git a/img/photos/2018-03-04T10:00:40Z_0.jpg b/img/photos/2018-03-04T10:00:40Z_0.jpg new file mode 100644 index 0000000..62b3c52 Binary files /dev/null and b/img/photos/2018-03-04T10:00:40Z_0.jpg differ diff --git a/img/photos/2018-03-10T14:07:00Z_0.mp4 b/img/photos/2018-03-10T14:07:00Z_0.mp4 new file mode 100644 index 0000000..d19ed91 Binary files /dev/null and b/img/photos/2018-03-10T14:07:00Z_0.mp4 differ diff --git a/img/photos/2018-03-23T20:42:24Z_0.png b/img/photos/2018-03-23T20:42:24Z_0.png new file mode 100644 index 0000000..2cae477 Binary files /dev/null and b/img/photos/2018-03-23T20:42:24Z_0.png differ diff --git a/img/photos/ph-1w.jpg b/img/photos/ph-1w.jpg new file mode 100644 index 0000000..bbc3b8e Binary files /dev/null and b/img/photos/ph-1w.jpg differ diff --git a/img/sipodemo.jpg b/img/sipodemo.jpg new file mode 100644 index 0000000..16a261f Binary files /dev/null and b/img/sipodemo.jpg differ diff --git a/img/sipodemo.png b/img/sipodemo.png new file mode 100644 index 0000000..5f6cef4 Binary files /dev/null and b/img/sipodemo.png differ diff --git a/img/strike1.pdf b/img/strike1.pdf new file mode 100644 index 0000000..0a0fd63 Binary files /dev/null and b/img/strike1.pdf differ diff --git a/img/strike2.pdf b/img/strike2.pdf new file mode 100644 index 0000000..f7fe8cc Binary files /dev/null and b/img/strike2.pdf differ diff --git a/img/strike3.pdf b/img/strike3.pdf new file mode 100644 index 0000000..6300120 Binary files /dev/null and b/img/strike3.pdf differ diff --git a/img/strike4.pdf b/img/strike4.pdf new file mode 100644 index 0000000..8474089 Binary files /dev/null and b/img/strike4.pdf differ diff --git a/img/thundertrap.pdf b/img/thundertrap.pdf new file mode 100644 index 0000000..46c1ba0 Binary files /dev/null and b/img/thundertrap.pdf differ diff --git a/img/transient.pdf b/img/transient.pdf new file mode 100644 index 0000000..d87a6c5 Binary files /dev/null and b/img/transient.pdf differ diff --git a/thesis.pdf b/thesis.pdf index 20fd5a5..9568bf0 100644 Binary files a/thesis.pdf and b/thesis.pdf differ