moving some things around and added a missing figure

master
Ondřej Hruška 6 years ago
parent 88b30c2ba4
commit 6c208b1e4f
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 2
      ch.discussion.tex
  2. 10
      ch.example_projects.tex
  3. 17
      ch.pc_software.tex
  4. 2
      ch.wireless.tex
  5. BIN
      thesis.pdf

@ -1,6 +1,6 @@
\chapter{Discussion}
The objective of this work was to develop an extensible platform allowing the user to interact with hardware modules and circuitry from high-level applications running on their \gls{PC}, in other words, to ``bring the Raspberry Pi GPIO header to the \gls{PC}''. It was important to design the platform in such a way that a user without much experience with embedded electronics and low level circuitry could still use it with a reasonable level of comfort and confidence.
The objective of this work was to develop an extensible platform allowing the user to interact with hardware modules and circuitry from high-level applications running on their \gls{PC}, in other words, to ``bring the Raspberry Pi \gls{GPIO} header to the \gls{PC}''. It was important to design the platform in such a way that a user without much experience with embedded electronics and low level circuitry could still use it with a reasonable level of comfort and confidence.
\section{Solution Summary}

@ -4,7 +4,7 @@ This chapter presents several applications of GEX. Those examples are the result
\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.
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.
\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}.
@ -32,7 +32,7 @@ The frequency response of a filter may be measured with a combination of the ADC
\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}).
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}).
\begin{figure}[H]
\centering
@ -55,7 +55,7 @@ The ``Micro Dot pHAT'' add-on board was used to test GEX Zero's compatibility wi
\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.
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.
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.
@ -64,7 +64,7 @@ This method of lightning detection should be regarded as a mere curiosity withou
\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.}
\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.}
\label{fig:captransient}
\end{figure}
@ -89,7 +89,7 @@ This method of lightning detection should be regarded as a mere curiosity withou
\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}
\caption[Captured lightning strikes]{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}

@ -47,7 +47,7 @@ The wireless gateway is accessed by wrapping either of the transports in an inst
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}.
\begin{listing}[h]
\begin{listing}
\begin{pythoncode}
#!/bin/env python3
# The I2C unit, called 'i2c', is configured to use PB6 and PB7
@ -74,7 +74,7 @@ with gex.Client(gex.TrxRawUSB()) as client:
\caption{\label{lst:py_api} An example Python program using the GEX client library}
\end{listing}
\begin{figure}[h]
\begin{figure}
\centering
\includegraphics[width=.7\textwidth] {img/phatmtx.jpg}
\caption[GEX Zero with the Micro Dot pHAT add-on board]{\label{fig:pydemo}GEX Zero with the Micro Dot pHAT add-on board, showing a test pattern defined in a Python script}
@ -86,9 +86,9 @@ First, a client instance is created, receiving the transport as an argument. We
The Python library can be accessed from MATLAB scripts thanks to MATLAB's two-way Python integration~\cite{matlabpy}. Controlling GEX from MATLAB may be useful when additional processing is required, e.g., with data from the \gls{ADC}; however, in many cases, an open source alternative native to Python exists that could be used for the same purpose, such as the NumPy and SciPy libraries~\cite{numpyscipy}.
The example in \cref{lst:matlab_api} demonstrates the use of MATLAB to calculate the frequency spectrum of an analog signal captured with GEX. The syntax needed to use the serial port transport (instead of a raw access to USB endpoints) is shown in a comment.
The example in \cref{lst:matlab_api} (and \cref{fig:matlabpic}) demonstrates the use of MATLAB to calculate the frequency spectrum of an analog signal captured with GEX. The syntax needed to use the serial port transport (instead of a raw access to USB endpoints) is shown in a comment.
\begin{listing}[h]
\begin{listing}
\begin{matlabcode}
% The ADC unit, called 'adc', is configured to use PA1 as Channel 0
@ -115,6 +115,12 @@ The example in \cref{lst:matlab_api} demonstrates the use of MATLAB to calculate
\caption{\label{lst:matlab_api} Calling the Python GEX library from a MATLAB script}
\end{listing}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{img/matlab-fft.png}
\caption{A demonstration of the MATLAB/Python integration}
\label{fig:matlabpic}
\end{figure}
\section{C Library}
@ -182,7 +188,6 @@ This low-level library is intended for applications where the performance of the
The structure-based method utilizes C structs to access individual fields in the payload. Simple payloads can be represented by a struct without problems, but payloads of a dynamic length pose a challenge; we can either define a new struct for each required length, or, when the variable-length array is located at the end of the payload, a struct with the largest needed payload size is defined and the real length is then specified when sending the message. The latter approach is illustrated in \cref{lst:c_api_struct}.
\vfill\newpage
\subsection{Using the Payload Builder Utility}
\begin{listing}
@ -211,5 +216,5 @@ The Payload Builder utility offers a flexible solution to the construction of ar
An example of Payload Builder's usage is shown in \cref{lst:c_api_pb}. We give it a byte buffer and it then fills it with the payload values, taking care of buffer overflow, and advancing the write pointer by the right number of bytes. The third parameter of \mono{pb\_init()} is optional, a pointer to a function called when the buffer overflows; this callback can flush the buffer and rewind it, or report an error.
Payload Builder is accompanied by Payload Parser, a tool doing the exact opposite. While it is not needed in our example, we will find this utility useful when processing command responses or events payloads. The full API of those utilities can be found in their header files.
Payload Builder is accompanied by Payload Parser, a tool doing the exact opposite. While it is not needed in our example, we will find this utility useful when processing command responses or events payloads. The full \gls{API} of those utilities can be found in their header files.

@ -30,7 +30,7 @@ In \gls{OOK}, the carrier generator is switched on and off to transmit ones and
\subsection{Gaussian Minimum-Shift Keying (GMSK)}
\Gls{GMSK} is a variant of \gls{MSK} which uses a Gaussian filter to shape the digital signal before sending it to the oscillator. The principle is similar to \gls{GFSK}, and it is a yet another way to reduce side-band interference and increase spectral efficiency. \gls{GMSK} is used in the \gls{GSM}.
\Gls{GMSK} is a variant of \gls{MSK} which uses a Gaussian filter to shape the digital signal before sending it to the oscillator. The principle is similar to \gls{GFSK}, and it is a yet another way to reduce side-band interference and increase spectral efficiency. %\gls{GMSK} is used in the \gls{GSM}. this is on wikipedia, but cant find a source
\subsection{LoRa Modulation}

Binary file not shown.
Loading…
Cancel
Save