Skip to content

Commit

Permalink
[docs] let the english speaking master rewrite everything
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchiLaser committed Feb 15, 2024
1 parent e59935a commit 5b00752
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 46 deletions.
12 changes: 7 additions & 5 deletions documentation/chap/hardware/adc.tex
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
\section{Measuring analog voltages}

The core component of the data acquisition is the \href{https://www.raspberrypi.com/documentation/microcontrollers/rp2040.html}{PR2040 Microcontroller} which includes built-in Analog-to-Digital Converters(ADC)\footnote{\href{http://pico-adc.markomo.me/}{This project} is a collection of measurements and analysis in order to document and specify the details of the ADCs of the RP2040 Microcontroller}. These ADCs convert electronic voltages ranging from Ground ($\SI{0}{V}$) to a reference voltage $U_{ref}$ into a digital number defined by the resolution which is depicted in bits. The resolution for all the ADCs in the RP2040 IC is set to 12 bits, meaning that the digital result from an ADC is in between $0$ and $2^{12} = 4096$. Within this conversion the mapping from the analog input voltage to a corresponding digital number should be proportional but has small uncertainties which are defined by the resolution as seen in \cref{fig:ADC-Curve}. This picture also clearly shows that a value acquired by an ADC has an uncertainty of half the voltage to which the least significant bit (LSB) corresponds. This can be calculated as:
The main part of the data collection process is the PR2040 Microcontroller, which has built-in Analog-to-Digital Converters (ADCs). These ADCs convert electronic voltages ranging from Ground ($\SI{0}{V}$) to a reference voltage $U_{ref}$ into digital numbers, with a resolution set to 12 bits. This means the digital result from an ADC falls between $0$ and $2^{12} = 4096$. In theory this mapping should be proportional but in practise there are small uncertainties in this conversion process due to the resolution, as depicted in \cref{fig:ADC-Curve}. This figure shows that the uncertainty of a value acquired by an ADC is half the voltage corresponding to the least significant bit (LSB), which can be calculated as:

\begin{equation*}
\sigma = \pm{} U_{ref} \cdot \frac{1}{2} \cdot \frac{1}{2^{resolution}} = \pm{} U_{ref} \cdot 2^{-(resolution + 1)}\,.
\end{equation*}
Expand All @@ -12,9 +13,10 @@ \section{Measuring analog voltages}
\label{fig:ADC-Curve}
\end{figure}

In reality there are multiple reasons for small short time fluctuations in the voltage which are greater than the quantization uncertainty of an ADC. Therefore the propper uncertainty of an ADC in an electronic application can be measured with a calibration.
The \href{https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf}{data sheet} explains that four ADC channels (ADC0 to ADC3) are connected to GPIO Pins and the fifth ADC channel (ADC4) is connected to an internal temperature sensor. Notably the fourth channel ADC3 can be used to measure the VSYS voltage of the Raspberry Pi Pico board.
Each channel is linked to a single Analog-to-Digital Converter (ADC) through an internal switch, allowing the selection of one channel at a time. The shared ADC operates with a maximum sampling rate of 500 kilosamples per second (KSps). This sampling rate can be used for measuring voltages on a single channel at the full sampling speed (simplex). Alternatively, it can simultaneously measure two channels by periodically switching between them, effectively dividing the sampling rate to 250 KSps per channel. The accuracy and the sampling rate are sufficient to use this as the core of a simple oscilloscope which acquires periodically ADC values and streams the data to another device for further processing.
In practice, there are further reasons for short-term fluctuations in voltage which are bigger than the quantization uncertainty. Therefore, the proper uncertainty of an ADC in an electronic application can be determined through a calibration process. A detailed explanation and characterisation of the Raspberry Pi Picos ADCs is available on \href{http://pico-adc.markomo.me/}{this website}.

The \href{https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf}{data sheet} explains that four ADC channels (ADC0 to ADC3) are connected to GPIO Pins and the fifth ADC channel (ADC4) is connected to an internal temperature sensor. Notably the fourth channel ADC3 is connected to an onboard attenuator. This configuration is intended to be used to measure the VSYS voltage of the Raspberry Pi Pico board.

An ADC can only measure voltages between $\SI{0}{V}$ and $U_{ref}$ but we want to build an oscilloscope that can measure positive and negative voltages $\pm{}U_{max}$ within a range of p.ex. $U_{max} > \SI{10}{V}$. It is the task of an analog front-end to map voltages from $-U_{max}$ to $+U_{max}$ into an analog voltage which is suitable for the ADC. Furthermore the range of the input voltage should be selectable and there should be some kind of over-voltage protection on the signal inputs. This allows to measure for higher voltages with less precision or lower voltages with higher precision.
Each channel is linked to a single Analog-to-Digital Converter (ADC) through an internal switch, allowing the selection of one channel at a time. The shared ADC operates with a maximum sampling rate of 500 kilosamples per second (KSps). This sampling rate can be utilized for measuring voltages on a single channel at the full sampling speed (simplex). Alternatively, it can simultaneously measure two channels by periodically switching between them, effectively halving the sampling rate to 250 KSps per channel. The level of accuracy and sampling rate is sufficient for using the system as the core of a simple oscilloscope which periodically acquires ADC values and streams the data to another device for further processing.

An ADC can only measure voltages between $\SI{0}{V}$ and $U_{ref}$ but we aim to build an oscilloscope capable of measuring both positive and negative voltages within a range, for instance, $\vert U \vert > \SI{10}{V}$. To achieve this, an analog front-end is needed to map voltages from $-U_{max}$ to $+U_{max}$ into an analog voltage suitable for the ADC. Furthermore the input voltage range should be adjustable and there should be an over-voltage protection on the signal inputs. This allows for the measurement of higher voltages with less precision or lower voltages with higher precision.
12 changes: 6 additions & 6 deletions documentation/chap/hardware/introduction.tex
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
\section{Introduction}

This chapter explains the hardware details of the measurement system, aiming to provide a clear understanding of why and how the hardware was designed. In principle the purpose of the measurement hardware is to map analog voltages from a wide input range to a smaller input range, which then can be measured using the PR2040 Microcontroller of the Raspberry Pi Pico Microcontroller board.
This part explains how the measurement system's hardware works. It aims to make it clear why and how the hardware was designed. Basically, the hardware is meant to convert analog voltages with a high amplitude into smaller ones. Then, we can measure these smaller voltages using the PR2040 Microcontroller on the Raspberry Pi Pico Microcontroller board.

\subsection{Prerequisites}

In order to discuss the structure of the analog front-end and the corresponding voltage ranges for the oscilloscope some basic knowledge in electronics engineering is assumed. This contains the following topics:
Before we talk about how the analog front-end works and the different voltage ranges for the oscilloscope, you need to know some basics about electronics. This includes:

\begin{itemize}
\item The definition of Charge, Voltage and Current
\item The definition of the electrical resistance, Ohms law and resistors as electrical components
\item Capacitance and capacitors as electrical components
\item The usage of a Diode and a Z-Diode
\item Understanding what Charge, Voltage, and Current are
\item Knowing about electrical resistance, Ohm's Law, and how resistors work
\item Learning about Capacitance and capacitors
\item Knowing how to use a Diode and a Z-Diode
\end{itemize}
14 changes: 6 additions & 8 deletions documentation/chap/hardware/misc_electronics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ \section{Further electrical components and their usage}

\subsection{Voltage clamping with Diodes}

A Diode is a semiconductor device that allows current to flow in one direction only\footnote{This is technically not true because a diode can also let current flow in the opposite direction but this aspect is not necessary for the design described in this report}. When a Voltage is applied across the two terminals in the forward direction the current flows easily whereas on the other hand, when the current is applied in reverse direction, the diode blocks the current. In forward direction the current can only flow when the applied voltage is above a threshold limit, the forward voltage, which for standard silicon diodes is approximately $\SI{0.6}{V}$ to $\SI{0.7}{V}$. This also means that in forward direction a voltage has a constant voltage drop which is equal to its forward voltage. Usually diodes are used to rectify electrical voltages. Apart from the standard semiconductor diodes there are other different types of diodes, e.g. Light-emitting Diodes (LEDs), Zener diodes and Schottky diodes. \cref{fig:diode-types} shows the electrical symbols for some diodes.
A Diode is a semiconductor device that allows current to flow in one direction only\footnote{This is technically not true because a diode can also let current flow in the opposite direction but this aspect is not necessary for the design described in this report}. When a Voltage is applied across the two terminals in the forward direction the current flows easily while in reverse direction the diode blocks current. In the forward direction current flows only if the applied voltage exceeds a threshold limit, the forward voltage, typically around $\SI{0.6}{V}$ to $\SI{0.7}{V}$ for standard silicon diodes. This also means that in forward direction a voltage has a constant voltage drop which is equal to its forward voltage. Diodes are commonly used to rectify electrical voltages with various types like Light-emitting Diodes (LEDs), Zener diodes and Schottky diodes. \cref{fig:diode-types} shows symbols for some diode types.

\begin{figure}[htb]
\centering
Expand All @@ -16,7 +16,7 @@ \subsection{Voltage clamping with Diodes}
\label{fig:diode-types}
\end{figure}

We want to use a diode to prevent our circuit from input voltages which exceed the range it was designed for. \cref{fig:clamping-diodes} shows how this is done: When the signal line is below $\SI{0}{V}$ then the ground terminal is at a higher potential than the signal line and the current flows from $D_2$ directly to ground. When the signal line is above the supply voltage $V_{cc}$ the same happens with $D_1$. However this only works when the input impedance of the device $U_{out}$ is connected to is lower than the resistance across the diode. This way the voltage at $U_{out}$ can be clamped to a defined voltage range.
We want to use a diode to prevent our circuit from input voltages which exceed the designed range. \cref{fig:clamping-diodes} illustrates this: When the signal line is below $\SI{0}{V}$ current flows directly to ground from $D_2$. Similar, when the signal line exceeds the supply voltage $V_{cc}$, $D_1$ conducts. However this only works when the input impedance of the device $U_{out}$ is connected to is lower than the resistance across the diode. This clamping actions maintains the voltage within a defined range.

\begin{figure}[htb]
\centering
Expand All @@ -37,14 +37,12 @@ \subsection{Voltage clamping with Diodes}
\label{fig:clamping-diodes}
\end{figure}

There is one disadvantage when this circuit is build with normal diodes: The voltage between the two terminals must be greater than the forward voltage. In this Example the voltage can only be clamped between $\SI{-0,7}{V}$ and $V_{cc} + \SI{0,7}{V}$. Diodes with a smaller forward voltage reduce this gap and here Schottky diodes are the better choice. Normal diodes are build by combining a p-type and a n-type doped semiconductor. Schottky diodes are just a combination of a doped semiconductor and a bare metal. This construction has faster switching times and lower forward voltages, down to $\SI{0,3}{V}$, compared to conventional diodes. When using Schottky diodes the voltage range which can be achieved with clamping diodes is closer to the reference voltages provided in the circuit.
There is one disadvantage when this circuit is build with normal diodes: The voltage between the two terminals must be greater than the forward voltage. In this Example the voltage can only be clamped between $\SI{-0,7}{V}$ and $V_{cc} + \SI{0,7}{V}$. Diodes with a smaller forward voltage reduce this gap and here Schottky diodes are the better choice. Normal diodes are build by combining a p-type and a n-type doped semiconductor. Schottky diodes are just a combination of a doped semiconductor and a raw piece of metal. This construction has faster switching times and lower forward voltages, down to $\SI{0,3}{V}$.

To find the right diodes for this purpose we also need diodes which can withstand the current. The resistor $R$ in \cref{fig:clamping-diodes} plays a crucial role: without it the current might get really high and the diodes burn from the heat dissipation. This factor also has to be considered when looking for the right electrical components.

Besides clamping these diodes also serve as an ESD protection. Electrostatic discharge (ESD) refers to the sudden flow of electricity between two electrically charged objects caused by contact. This discharge can occur when there is a difference in electrical potential between two objects, leading to the rapid transfer of electrons from one object to the other (p.Ex. Touching metal objects after walking over a carpet can lead to small electric shocks). ESD is dangerous for electronic components primarily because the voltage range of the discharges can easily reach values of kilovolts whereas many components can only operate in ranges of a few volts. When these sparks occur the electrical components are still in safe because the diodes are still going to clamp the voltages in between the legal range.
When selecting diodes, their current tolerance is critical. The resistor $R$ in Figure \ref{fig:clamping-diodes} limits current flow to prevent diode damage from excessive heat dissipation. Besides clamping, these diodes also function as Electrostatic Discharge (ESD) protection. ESD, a sudden flow of electricity between charged objects\footnote{ESD events are the causes for electrical shocks when touching a metal object after walking over a carpet with socks.}, poses a risk to electronic components because the discharge voltage between an ESD event easily reaches values of kolivolts whereas electronic components only operate in ranges of a few volts. Diodes prevent damage by clamping voltages within safe ranges during ESD events.

\subsection{Analog Multiplexers}

An analog multiplexer is an electronic component which works like a switch between multiple signals and a common input or output. The common terminal is routed to one of the available other terminals and the other terminals behave like they are not connected (tristate). To select the terminal the multiplexer has some input signal lines which act as a binary coded selection.
An analog multiplexer is an electronic component acting like a switch, routing multiple signals and a common input or output. Only one of the terminals can be connected at a time. Selection occurs via input signal lines which determine the connected terminal by the binary representation of its terminal number.

On the oscilloscope a multiplexer can be used to switch between different resistors which are all connected to ground. This makes the gain of a non-inverting amplifier variable between some pre-defined configurations. Further details about this will be explained later.
On the oscilloscope a multiplexer switches between resistors which are connected to ground. This makes the gain of a non-inverting amplifier variable across pre-defined configurations.
Loading

0 comments on commit 5b00752

Please sign in to comment.