GEX thesis source code, full text, references

ch.example_projects.tex 5.9KB

  1. \chapter{Example Applications}
  2. This chapter presents several applications of GEX. Those examples are the result of evaluation during the firmware development and do not cover the full range of supported features; nonetheless, they should give the reader a good idea about the possibilities.
  3. \section{Frequency Response Measurement}
  4. \begin{wrapfigure}[16]{r}{0.42\textwidth}
  5. \vspace{-1em}
  6. \centering
  7. \includegraphics[width=\linewidth]{img/demofilter.jpg}
  8. \caption{GEX Zero measuring a passive high-pass RC filter}
  9. \label{fig:demofilter}
  10. \end{wrapfigure}
  11. The frequency response of a filter may be measured with a combination of the \gls{ADC} and \gls{DAC} units. The \gls{DAC} is configured to generate a sine wave as a stimulus for the filter, while the \gls{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.
  12. \cref{fig:demofilter} depicts a simple test setup with a passive RC filter with a 100\,nF capacitor and a 470\,$\Omega$ resistor; its characteristics in the low-pass and high-pass configuration, as obtained by GEX, are shown in \cref{fig:demofilter_cap}. The irregularity at higher frequencies is likely caused by noise and nonlinearities in the \gls{DAC} output.
  13. \begin{figure}
  14. \centering
  15. \begin{subfigure}{.5\textwidth}
  16. \centering
  17. \includegraphics[width=\linewidth]{img/filter1.pdf}
  18. \end{subfigure}%
  19. \begin{subfigure}{.5\textwidth}
  20. \centering
  21. \includegraphics[width=\linewidth]{img/filter2.pdf}
  22. \end{subfigure}
  23. \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 }
  24. \label{fig:demofilter_cap}
  25. \end{figure}
  26. \section{Measuring \texorpdfstring{CO$_2$}{CO2} Concentration}
  27. 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.
  28. 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 \gls{SIPO} unit on a 74HC595-drive red-green \gls{LED} bargraph (\cref{fig:democo2}).
  29. \begin{figure}[H]
  30. \centering
  31. \begin{subfigure}{.72\textwidth}
  32. \includegraphics[width=.98\textwidth]{img/ph-co2.jpg}
  33. \caption{CO$_2$ concentration measurement}
  34. \end{subfigure}%
  35. \begin{subfigure}{.28\textwidth}
  36. \includegraphics[width=.98\textwidth]{img/sipodemo.jpg}
  37. \caption{LED display}
  38. \end{subfigure}
  39. \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}
  40. \label{fig:democo2}
  41. \end{figure}
  42. \section{Controlling the ``Micro Dot pHAT''}
  43. 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 proved that third-party add-ons for the RPi Zero may be compatible with GEX Zero, which introduces many interesting possibilities.
  44. \section{Capturing Transient Effects}
  45. The \gls{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.
  46. 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.
  47. 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}).
  48. \begin{figure}[h]
  49. \centering
  50. \includegraphics[width=\textwidth]{img/transient.pdf}
  51. \caption[Capacitor charging waveform captured by the ADC unit]{Capacitor charging waveform captured by the ADC unit, 50\,kS/s. X: sample number, Y: ADC word. X grid: 200\,$\mu$s.}
  52. \label{fig:captransient}
  53. \end{figure}
  54. \begin{figure}[b]
  55. \centering
  56. \includegraphics[scale=1.2]{img/thundertrap.pdf}
  57. \caption{The circuit used for lightning detection}
  58. \label{fig:lightningtrap}
  59. \end{figure}
  60. \begin{figure}[h]
  61. \centering
  62. \begin{subfigure}{.5\textwidth}
  63. \includegraphics[width=\textwidth]{img/strike1}
  64. \end{subfigure}%
  65. \begin{subfigure}{.5\textwidth}
  66. \includegraphics[width=\textwidth]{img/strike2}
  67. \end{subfigure}\\
  68. \begin{subfigure}{.5\textwidth}
  69. \includegraphics[width=\textwidth]{img/strike3}
  70. \end{subfigure}%
  71. \begin{subfigure}{.5\textwidth}
  72. \includegraphics[width=\textwidth]{img/strike4}
  73. \end{subfigure}
  74. \caption[Captured lightning strikes]{Lightning strike-generated bursts of energy captured by the ADC unit at 60\,kS/s (shown as raw ADC words). Note the X-axis value 500 where the bursts start: that was the configured pre-trigger length.}
  75. \label{fig:strikes}
  76. \end{figure}