diff --git a/.vscode/settings.json b/.vscode/settings.json index 059e842..defd69d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,160 +1,217 @@ { - "latex-workshop.latex.tools": [ - { - "name": "latexmk", - "command": "latexmk", - "args": [ - "-synctex=1", - "-interaction=nonstopmode", - "-file-line-error", - "-pdf", - "-outdir=%OUTDIR%", - "%DOC%" - ], - "env": {} - }, - { - "name": "lualatexmk", - "command": "latexmk", - "args": [ - "-synctex=1", - "-interaction=nonstopmode", - "-file-line-error", - "-lualatex", - "-outdir=%OUTDIR%", - "%DOC%" - ], - "env": {} - }, - { - "name": "xelatexmk", - "command": "latexmk", - "args": [ - "-synctex=1", - "-interaction=nonstopmode", - "-file-line-error", - "-xelatex", - "-outdir=%OUTDIR%", - "%DOC%" - ], - "env": {} - }, - { - "name": "latexmk_rconly", - "command": "latexmk", - "args": [ - "%DOC%" - ], - "env": {} - }, - { - "name": "pdflatex", - "command": "pdflatex", - "args": [ - "-synctex=1", - "-interaction=nonstopmode", - "-file-line-error", - "%DOC%" - ], - "env": {} - }, - { - "name": "bibtex", - "command": "bibtex", - "args": [ - "%DOCFILE%" - ], - "env": {} - }, - { - "name": "rnw2tex", - "command": "Rscript", - "args": [ - "-e", - "knitr::opts_knit$set(concordance = TRUE); knitr::knit('%DOCFILE_EXT%')" - ], - "env": {} - }, - { - "name": "jnw2tex", - "command": "julia", - "args": [ - "-e", - "using Weave; weave(\"%DOC_EXT%\", doctype=\"tex\")" - ], - "env": {} - }, - { - "name": "jnw2texminted", - "command": "julia", - "args": [ - "-e", - "using Weave; weave(\"%DOC_EXT%\", doctype=\"texminted\")" - ], - "env": {} - }, - { - "name": "pnw2tex", - "command": "pweave", - "args": [ - "-f", - "tex", - "%DOC_EXT%" - ], - "env": {} - }, - { - "name": "pnw2texminted", - "command": "pweave", - "args": [ - "-f", - "texminted", - "%DOC_EXT%" - ], - "env": {} - }, - { - "name": "tectonic", - "command": "tectonic", - "args": [ - "--synctex", - "--keep-logs", - "--print", - "%DOC%.tex" - ], - "env": {} - } - ], - "latex-workshop.latex.outDir": "../output", - "editor.wordWrap": "on", - "cSpell.words": [ - "Anduril", - "behaviour", - "bytestream", - "deasserted", - "Kernighan's", - "malloc", - "microcontroller", - "microcontrollers", - "MOSFET", - "op-amp", - "prescaler", - "Puratich", - "QPPI", - "reflectometry", - "Sahil", - "setpoint", - "Skydio", - "timestep", - "transceive", - "UART", - "WARG" - ], - "files.associations": { - "bitbang_ex.h": "c", - "timer_registers.h": "c" + "latex-workshop.latex.tools": [ + { + "name": "latexmk", + "command": "latexmk", + "args": [ + "-synctex=1", + "-interaction=nonstopmode", + "-file-line-error", + "-pdf", + "-outdir=%OUTDIR%", + "%DOC%" + ], + "env": {} }, - "cmake.ignoreCMakeListsMissing": true, - "python.terminal.activateEnvironment": true, - "latex-workshop.chktex.enabled": false + { + "name": "lualatexmk", + "command": "latexmk", + "args": [ + "-synctex=1", + "-interaction=nonstopmode", + "-file-line-error", + "-lualatex", + "-outdir=%OUTDIR%", + "%DOC%" + ], + "env": {} + }, + { + "name": "xelatexmk", + "command": "latexmk", + "args": [ + "-synctex=1", + "-interaction=nonstopmode", + "-file-line-error", + "-xelatex", + "-outdir=%OUTDIR%", + "%DOC%" + ], + "env": {} + }, + { + "name": "latexmk_rconly", + "command": "latexmk", + "args": [ + "%DOC%" + ], + "env": {} + }, + { + "name": "pdflatex", + "command": "pdflatex", + "args": [ + "-synctex=1", + "-interaction=nonstopmode", + "-file-line-error", + "%DOC%" + ], + "env": {} + }, + { + "name": "bibtex", + "command": "bibtex", + "args": [ + "%DOCFILE%" + ], + "env": {} + }, + { + "name": "rnw2tex", + "command": "Rscript", + "args": [ + "-e", + "knitr::opts_knit$set(concordance = TRUE); knitr::knit('%DOCFILE_EXT%')" + ], + "env": {} + }, + { + "name": "jnw2tex", + "command": "julia", + "args": [ + "-e", + "using Weave; weave(\"%DOC_EXT%\", doctype=\"tex\")" + ], + "env": {} + }, + { + "name": "jnw2texminted", + "command": "julia", + "args": [ + "-e", + "using Weave; weave(\"%DOC_EXT%\", doctype=\"texminted\")" + ], + "env": {} + }, + { + "name": "pnw2tex", + "command": "pweave", + "args": [ + "-f", + "tex", + "%DOC_EXT%" + ], + "env": {} + }, + { + "name": "pnw2texminted", + "command": "pweave", + "args": [ + "-f", + "texminted", + "%DOC_EXT%" + ], + "env": {} + }, + { + "name": "tectonic", + "command": "tectonic", + "args": [ + "--synctex", + "--keep-logs", + "--print", + "%DOC%.tex" + ], + "env": {} + } + ], + "latex-workshop.latex.outDir": "../output", + "editor.wordWrap": "on", + "cSpell.words": [ + "Anduril", + "behaviour", + "bytestream", + "deasserted", + "Kernighan's", + "malloc", + "microcontroller", + "microcontrollers", + "MOSFET", + "noinv", + "op-amp", + "prescaler", + "Puratich", + "reflectometry", + "Sahil", + "setpoint", + "Skydio", + "timestep", + "transceive", + "UART", + "WARG" + ], + "files.associations": { + "bitbang_ex.h": "c", + "timer_registers.h": "c" + }, + "cmake.ignoreCMakeListsMissing": true, + "python.terminal.activateEnvironment": true, + "latex-workshop.chktex.enabled": false, + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false } \ No newline at end of file diff --git a/src/appendix_more _opamps.tex b/src/appendix_more _opamps.tex index dbecbcc..363da1b 100644 --- a/src/appendix_more _opamps.tex +++ b/src/appendix_more _opamps.tex @@ -17,7 +17,7 @@ \section{Extra Practice: Solve the transfer function of the following circuits.} to [short] ++(1,0) node[right]{$V_{out}$}; \end{circuitikz} \caption{Circuit A} - \label{fig:unity-amp} + \label{fig:unity-amp_duplicate} \end{minipage}% \hfill% \begin{minipage}{0.45\textwidth} @@ -50,7 +50,7 @@ \section{Extra Practice: Solve the transfer function of the following circuits.} to [short] ++(1,0) node[right]{$V_{out}$}; \end{circuitikz} \caption{Circuit C} - \label{fig:non_inverting_amp} + \label{fig:non_inverting_amp_duplicate} \end{minipage}% \hfill% \begin{minipage}{0.45\textwidth} diff --git a/src/appendix_more_passives.tex b/src/appendix_more_passives.tex index c838dbd..a383bb5 100644 --- a/src/appendix_more_passives.tex +++ b/src/appendix_more_passives.tex @@ -3,7 +3,11 @@ \section{Extra Practice: Determine the step response of the following circuits.} \label{extra_practice:more_passives} +<<<<<<< HEAD +\noindent State any assumptions regarding component values. These questions are similar to Section \ref{section:passives}. % These questions are more complex then those given in Section \ref{section:passives}, but are fun to consider. +======= \noindent State any assumptions regarding component values. These questions are more complex than those given in Section \ref{section:passives}, but are fun to consider. +>>>>>>> origin/main \begin{figure}[H] \begin{center} @@ -104,5 +108,6 @@ \subsection{Circuit H: Series Inductor and Capacitor} % Two pole R-C filter % TODO : Show the current waveform of the RC step response circuit, sometimes this is asked +% TODO : Show the frequency domain of RC low pass and RC high pass ? \end{document} diff --git a/src/buck_vs_ldo.tex b/src/buck_vs_ldo.tex index 879f2bd..23ef69f 100644 --- a/src/buck_vs_ldo.tex +++ b/src/buck_vs_ldo.tex @@ -123,15 +123,18 @@ \subsubsection{Operation} \label{fig:buck-dcm} \end{figure} +<<<<<<< HEAD +\noindent When $I_L \approx 0$ the switch node voltage, $V_{sw}$ begins to oscillate with a peak of $\approx V_{out} \cdot 2$ converging towards $V_{out}$.\footnote{If the oscillation was undamped, it would have a peak of exactly $V_{out} \cdot 2$ and would not decrease in amplitude over time. In this case, damping is mostly provided by the parasitic resistance of the inductor.} This is because when $I_L \approx 0$, $V_{sw} = 0$ and $V_{out} \neq 0$ which means current will begin to flow through the inductor into the parasitic capacitance, $C_{parasitic}$, that exists between $V_{sw}$ and ground. This small resonant current, $I_L$, results in a noticeable voltage fluctuation on $V_{sw}$, but not on $V_{out}$ because $C_{out} >> C_{parasitic}$ (where $C_{out}$ is the output capacitance of the buck converter). +======= \noindent When $I_L \approx 0$ the switch node voltage, $V_{sw}$, begins to oscillate with a peak of $\approx V_{out} \cdot 2$ converging towards $V_{out}$.\footnote{If the oscillation was undamped, it would have a peak of exactly $V_{out} \cdot 2$ and would not decrease in amplitude over time. In this case, damping is mostly provided by the parasitic resistance of the inductor.} This is because when $I_L \approx 0$, $V_{sw} = 0$ and $V_{out} \neq 0$ which means current will begin to flow through the inductor into the parasitic capacitance, $C_{parasitic}$, that exists between $V_{sw}$ and ground. This small resonant current, $I_L$, results in a noticeable voltage fluctuation on $V_{sw}$, but not on $V_{out}$ because $C_{out} >> C_{parasitic}$ (where $C_{out}$ is the output capacitance of the buck converter). +>>>>>>> origin/main \subsubsection{Switching} -The switch depicted in Figure \ref{fig:buck_converter} is commonly referred to as a high side switch. In practice, the high side switch is usually implemented with a MOSFET (\textit{Metal-oxide semiconductor field effect transistor}) that features fast switching speeds, low switching losses, low conduction losses, low cost, and low leakage. The gate of this MOSFET requires active control from a feedback loop to maintain a stable output voltage. \newline +The switch depicted in Figure \ref{fig:buck_converter} is commonly referred to as a high side switch. In practice, the high side switch is usually implemented with a MOSFET (\textit{metal-oxide semiconductor field effect transistor}) that features fast switching speeds, low switching losses, low conduction losses, low cost, and low leakage. The gate of this MOSFET requires active control from a feedback loop to maintain a stable output voltage. \newline \newnoindentpara An asynchronous buck converter is depicted in Figure \ref{fig:buck_converter} depicts the low side switch as a diode. The diode is nice to use because it does not require control and is cheaper than a transistor. Diodes, due to their forward voltage drop, have higher conduction losses than MOSFETs. \newline -\newnoindentpara Synchronous buck converters replace this low side diode with a MOSFET. In order to avoid shorting out the input voltage source dead-time, a short period of time in which both high side and low side transistors are off, is inserted into the control loop. During the dead-time, current continues to flow through the body diode of the low side MOSFET. -% May seem a bit out of scope of the question, but I find it fairly important, maybe this can be explained better? +\newnoindentpara Synchronous buck converters replace this low side diode with a MOSFET (with a body diode). This MOSFET requires active control, however, it is often used as it reduces conduction losses. In order to avoid shorting out the input voltage source dead-time, a short period of time in which both high side and low side transistors are off, is inserted into the control loop. During the dead-time, current continues to flow through the body diode of the low side MOSFET. % The difference between synchronous and asynchronous is extremely important to explain for readers as this is commonly asked about in interviews. \subsubsection{Losses} There are two major forms of loss in a buck converter: \textit{switching losses} and \textit{conduction losses}. Switching losses is power dissipated every time the FETs are switched (transitioned from off to on, or vice-versa) and scale proportionally with switching frequency. Conduction losses are due to parasitic resistance of elements in the converter and consequently scale proportionally to load current. Buck converters have some quiescent current associated with their active control loop, however, these losses are negligible compared to switching and conduction losses and are not usually analyzed. \newline diff --git a/src/current_sense.tex b/src/current_sense.tex index ca04af9..3a57b6b 100644 --- a/src/current_sense.tex +++ b/src/current_sense.tex @@ -92,13 +92,13 @@ \subsection{Magnetic Sensing} \newnoindentpara This method also works with DC currents if an extra winding around the core is used to actively cancel the magnetic field generated by the sensed DC current. Based on the turns ratio and the current using to cancel the induced magnetic field, the sensed current can be calculated by a meter. -% Not including a picture of a current clamp because it's not really neccessary for the interview question/solution/understanding. Your ability to explain it is more important than knowing what it looks like imo. If we have to include one then I guess https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Clampmeter_Fluke_337.jpg/300px-Clampmeter_Fluke_337.jpg works. +% Not including a picture of a current clamp because it's not really necessary for the interview question/solution/understanding. Your ability to explain it is more important than knowing what it looks like imo. If we have to include one then I guess https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Clampmeter_Fluke_337.jpg/300px-Clampmeter_Fluke_337.jpg works. \subsection{Follow-ups} \begin{itemize} \item What is kelvin sense? \item What are four-wire digital multi-meter probes and why would you use them? - \item What is a hall effect sensor? + \item What is a hall effect sensor? When would one be used? \item How would you sense the inductor current in a buck converter? \item What is common mode rejection ratio for a differential amplifier? \end{itemize} diff --git a/src/diagram_generator/ac_dc.py b/src/diagram_generator/ac_dc.py index 86ac6de..ac1e3db 100644 --- a/src/diagram_generator/ac_dc.py +++ b/src/diagram_generator/ac_dc.py @@ -4,7 +4,7 @@ # fmt: off -TITLE = "AC vs DC Coupling" +TITLE = "AC vs. DC Coupling" def plotter() : @@ -16,7 +16,6 @@ def plotter() : OFFSET = 2 AMPLITUDE = 1 - # TODO : draw a sinusoid with a DC offset ac = AMPLITUDE * np.sin(2 * np.pi * FREQ * t) full = ac + OFFSET diff --git a/src/diagram_generator/hpf_bode_plot.py b/src/diagram_generator/hpf_bode_plot.py index 68eb778..b7b39fd 100644 --- a/src/diagram_generator/hpf_bode_plot.py +++ b/src/diagram_generator/hpf_bode_plot.py @@ -3,8 +3,7 @@ import argparse import control -TITLE = "Frequency vs Gain of High Pass Filter" - +TITLE = "Frequency vs. Gain of High Pass Filter" def plotter(): w0 = 1 @@ -22,7 +21,6 @@ def plotter(): plt.legend() plt.grid(True) - if __name__ == "__main__": parser = argparse.ArgumentParser(f"{TITLE} Plotter") parser.add_argument("--output_path", help="Path to save image to") diff --git a/src/led.tex b/src/led.tex index 0df6dd6..bc08b8e 100644 --- a/src/led.tex +++ b/src/led.tex @@ -121,13 +121,18 @@ \subsection{Pulse Width Modulation} \label{fig:pwm_waveform} \end{figure} +<<<<<<< HEAD +\noindent Note that PWM's application is not limited to LEDs - in a general, simplified manner, PWM can be thought of as a way to control the average voltage or current across a load, and is used in motor control, power supplies, and more. +% See notes for possible future question about RMS vs. AVG voltage where we could explore more of the complexities. This simplification is permissible for now. +======= \noindent Note that PWM's application is not limited to LEDs---in a general, simplified manner, PWM can be thought of as a way to control the average voltage or current across a load, and is used in motor control, power supplies, and more. % See notes for second edition about RMS vs AVG voltage where we could explore more of the complexities. This simplification is permissible for now. +>>>>>>> origin/main \subsection{Follow-ups} \begin{itemize} \item Propose a solution using a MOSFET instead of a BJT. % This is much simpler than using a BJT and is probably what people will think of when initially considering this question. - % \item Propose a solution without using any transistors. % This is a lot more troll and answers could go in a lot of different directions. I'm removing it for + % \item Propose a solution without using any transistors. % This is a lot more troll and answers could go in a lot of different directions. I'm removing it for now. \end{itemize} \end{document} diff --git a/src/main.tex b/src/main.tex index d8afa54..b9f5efb 100644 --- a/src/main.tex +++ b/src/main.tex @@ -118,21 +118,21 @@ \newpage \subfile{led.tex} \newpage -\subfile{keyword.tex} % place after interrupts.tex +\subfile{keyword.tex} % place after: interrupts.tex \newpage \subfile{signalling.tex} \newpage \subfile{pid.tex} \newpage -\subfile{compare-i2c-spi.tex} % place after signalling.tex +\subfile{compare-i2c-spi.tex} % place after: signalling.tex \newpage -\subfile{spi-bitbang.tex} % place after compare-i2c-spi.tex +\subfile{spi-bitbang.tex} % place after: compare-i2c-spi.tex \newpage -\subfile{oscilloscope.tex} % place after voltage_divider.tex, signalling.tex +\subfile{oscilloscope.tex} % place after: voltage_divider.tex, signalling.tex \newpage \subfile{what-is-can.tex} \newpage -\subfile{passives.tex} % place after voltage_divider.tex, oscilloscope.tex, signalling.tex, compare-i2c-spi.tex +\subfile{passives.tex} % place after: voltage_divider.tex, oscilloscope.tex, signalling.tex, compare-i2c-spi.tex \newpage \subfile{packet-parsing.tex} \newpage @@ -140,8 +140,8 @@ \newpage \subfile{adc_init.tex} \newpage -% \subfile{switching.tex} % place after current_sense.tex, led.tex, passives.tex % Add back in when it's completed -% \newpage +% \subfile{switching.tex} % place after: current_sense.tex, led.tex, passives.tex % TODO : Place when completed +% \newpage \subfile{64-bit-timer.tex} \newpage \subfile{stack-growth.tex} @@ -150,8 +150,12 @@ \newpage \subfile{mutex_vs_semaphore.tex} \newpage -\subfile{buck_vs_ldo.tex} % place after passives.tex, opamp.tex +\subfile{buck_vs_ldo.tex} % place after: passives.tex, opamp.tex \newpage +% \subfile{transmission_lines.tex} % TODO : Place when completed +% \newpage +% \subfile{unknown_capacitor.tex} % place after: passives.tex % TODO : Place when completed +% \newpage % Appendix \subfile{appendix_packet_parsing_tests.tex} @@ -160,7 +164,7 @@ \newpage \subfile{appendix_more_passives.tex} \newpage -\subfile{appendix_more _opamps.tex} +\subfile{appendix_more _opamps.tex} % TODO FIX : I put a space in this filename on accident .... at some point fix this plz \newpage % Bibliography diff --git a/src/oscilloscope.tex b/src/oscilloscope.tex index f6411fa..e5385d1 100644 --- a/src/oscilloscope.tex +++ b/src/oscilloscope.tex @@ -54,7 +54,7 @@ \subsection{Bandwidth} % Sampling generates a lot of discrete data-points very quickly that need to be stored quickly for analysis later. When a high sample rate and long time period of sampling is needed to analyze a signal, more memory is important, and can become costly due to the speed requirements of oscilloscope memory. \subsection{Coupling} -Another consideration is the coupling setting for each channel of the oscilloscope. AC vs DC coupling settings. Mathematically signals can be broken down into a static offset component and a dynamic component. Electrically these are represented as the DC and AC component of a signal. +Another consideration is the coupling setting for each channel of the oscilloscope. AC versus DC coupling settings. Mathematically signals can be broken down into a static offset component and a dynamic component. Electrically these are represented as the DC and AC component of a signal. When DC coupling is used the oscilloscope displays the entire signal while in AC coupling mode the DC offset is filtered out leaving only the AC component. An example of AC and DC coupling for an offset sin wave is shown in Figure \ref{fig:ac_dc}. DC coupling is a default setting, however, when trying to analyze small variations in a signal with a large offset using AC coupling is preferred. diff --git a/src/passives.tex b/src/passives.tex index 285b709..acaba31 100644 --- a/src/passives.tex +++ b/src/passives.tex @@ -137,6 +137,7 @@ \subsection{Circuit C} % Solving this circuit fully in time domain because it is conceptually simple even though mathematically complex. \newnoindentpara Analyzing the two elements in the circuit in time domain shows $I = C \cdot \dfrac{dV_{out}}{dt}$ and $V_{in} - V_{out} = I \cdot R$. As $I$ is equivalent in both elements, it can be cancelled out when solving the system of equations, resulting in $V_{in} - V_{out} = R \cdot C \cdot \dfrac{dV_{out}}{dt}$. This expression can be algebraically manipulated into $-\dfrac{dV_{out}}{V_{out}-V_{in}} = -\dfrac{dt}{R \cdot C}$. Integrating both sides, the expression becomes $\ln{\dfrac{V_{out}-V_{in}}{V_{out}}}=-\dfrac{t}{R \cdot C}$. \newline +% Note that this result of integration relies on a set of initial conditions and the way it is explained here abuses notation slightly. This is confusing to explain so I will not be doing it in this solution, however, readers who are not familiar with circuits and attempt the mathematical derivation themselves will likely become confused. I am not sure if there is an easy solution to this as a full explanation is far beyond what an interviewer would ever ask though the result is critical to know. \newnoindentpara After re-arranging the above expression, the solution to the differential equation is given by Equation \ref{eq:lpf-ode}. \begin{equation} @@ -152,6 +153,8 @@ \subsection{Circuit C} \caption{Step Response of a Low Pass Filter Circuit} \label{fig:step-response-low-pass-filter} \end{figure} +% It may be nice to give the readers a frequency domain bode plot of the RC circuit as well. That question is sometimes asked, however, that is a bit of scope creep though? . +% Also consider: Define the term "Bode Plot" for readers and use it? \subsubsection{Connection to I2C} The low-pass filter circuit is extremely fundamental and shows up in a variety of situations. Consider an I2C digital signal in which all drivers are not asserting the line low - in this case, the signal trace has some parasitic capacitance to ground and a pull-up resistor is responsible for pulling the line to a logic high state. This can be modelled as an RC low-pass filter circuit - consequently, an I2C signal (such as the one shown in Figure \ref{fig:i2c_scl}, SCL line) will have a similar step response to the low-pass filter circuit. @@ -194,15 +197,16 @@ \subsection{Circuit D} % \begin{figure}[H] % \centering % \includegraphics[width=0.8\textwidth]{generated_images/hpf_freq_response_plot.png} -% \caption{Frequency vs Gain Plot of a High Pass Filter Circuit} +% \caption{Frequency vs. Gain Plot of a High Pass Filter Circuit} % \label{fig:step-response-high-pass-filter} % \end{figure} \subsection{Follow-ups} \begin{itemize} \item Given an unknown discrete capacitor find the capacitance? How would you determine the capacitance at a given DC bias voltage? % First part is Circuit C. Second part a solution is use Circuit E with an initial condition on Vout as the bias and a very small Iin current. - \item For circuit C, does changing the value of R (assuming all else remains constant) change the total energy dissipated in the resistor? % Answer is no and requires an interesting integral to prove. Someone asked me this recently and I thought it was fun bc i had to do the proof live in fronta them lool. - \item Consider the circuits given in extra practice question \ref{extra_practice:more_passives}. % More complex circuits for consideration + % TODO : Remove this follow-up when unknown_capacitor.tex is added into the book + \item For Circuit C, does changing the value of R (assuming all else remains constant) change the total energy dissipated in the resistor? % Answer is no and requires an interesting integral to prove. This result is fairly unintuitive in my opinion. Someone asked me this recently and I thought it was fun bc i had to do the proof live in front of them. + \item Determine the step response of the circuits given in Section \ref{extra_practice:more_passives}. % More complex circuits for consideration, good for practice \end{itemize} \end{document} diff --git a/src/preamble.tex b/src/preamble.tex index 47dc71c..9afa6fc 100644 --- a/src/preamble.tex +++ b/src/preamble.tex @@ -38,8 +38,7 @@ \subsection{About the Authors} \newline \bluehref{https://www.linkedin.com/in/daniel-puratich}{Daniel} interned at Apple, Tesla, Anduril Industries, and Pure Watercraft, focusing on power electronics and board design. \newline -\newnoindentpara We met at the Waterloo Aerial Robotics Group (WARG), a student team that designs and builds autonomous drones. Uniquely, we have experience in hiring and interviewing multiple co-op students, giving us insight into the interview process from both sides, as well as an understanding of what responses are expected from candidates. We value mentorship, enjoy sharing our knowledge, and take pride in helping others succeed in their co-op journeys. -% I don't want to say led past tense for myself so maybe we add that in after i step down lol. +\newnoindentpara We met at the Waterloo Aerial Robotics Group (WARG), a student team that designs and builds autonomous drones. Uniquely, we have experience leading the team as executive directors and interviewing numerous co-op students for the team. This gives us insight into the interview process from both sides, as well as an understanding of what responses are expected from candidates. We value mentorship, enjoy sharing our knowledge, and take pride in helping others succeed in their co-op journeys. \subsubsection{Other Work} We've published other (free!) guides to help engineering students land firmware and hardware co-op roles. Check them out: @@ -54,6 +53,6 @@ \subsection{Acknowledgements} \subsection{Disclaimer} This book is designed to be an educational resource, drawing from the authors' experiences and research. While we have done our best to ensure accuracy, readers are encouraged to use their own judgment and explore additional resources as needed. The authors and publisher are not responsible for any errors or omissions. Please note, the content is for informational purposes only and is not intended as professional advice. \newline -\newnoindentpara \textcopyright \ Sahil Kale, Daniel Puratich | 2025 +\newnoindentpara \textcopyright \ Sahil Kale, Daniel Puratich | 2026 % Make this update automatically using the date? \end{document} diff --git a/src/switching.tex b/src/switching.tex index d8f9f0b..2a15623 100644 --- a/src/switching.tex +++ b/src/switching.tex @@ -9,11 +9,15 @@ \section{Design a circuit to allow a microcontroller to control a solenoid.} \la \spoilerline \subsection{Solenoids \& Flyback} -A solenoid is an electromagnet based on a coil of wire usually wrapped around a magnetic core to concrentrate the magnetic field. These devices see numerous applications in electro-mechanical systems such as valves and circuit breakers. As the solenoid is made of a long wire, it has resistance. \newline +A solenoid is an electromagnet based on a coil of wire usually wrapped around a magnetic core to concentrate the magnetic field. These devices see numerous applications in electro-mechanical systems such as valves and circuit breakers. As the solenoid is made of a long wire, it has resistance. \newline -\newnoindentpara Due to the coil of wire, a solenoid is highly inductive and requires extra considerations to control in an embedded system. Consider when a solenoid is enabled the question states $I = 1\text{A}$ so when disabling the solenoid the goal is to switch to a $I = 0 \text{A}$ state. If this state switch is performed quickly then the inductive load can see a very negative $\dfrac{d\text{I}}{d\text{t}}$ as $\dfrac{0 - 1}{\approx 0} = - \infty$. For an inductor $V_L = L \cdot \dfrac{d\text{I}}{d\text{t}}$ so this can lead to a very negative $V_L$ which can cause damage to the circuitry responsible for enabling and disabling the load. \newline +\newnoindentpara Due to the coil of wire, a solenoid is highly inductive and requires extra considerations to control in an embedded system. Consider when a solenoid is enabled the question states $I \approx 1\text{A}$ so when disabling the solenoid the goal is to switch to a $I = 0 \text{A}$ state. If this state switch is performed quickly then the inductive load can see a very negative $\dfrac{d\text{I}}{d\text{t}}$ as $\dfrac{0 - 1}{\approx 0} = - \infty$. For an inductor $V_L = L \cdot \dfrac{d\text{I}}{d\text{t}}$ so this can lead to a very negative $V_L$ which can cause damage to the circuitry responsible for enabling and disabling the load. \newline +<<<<<<< HEAD +\newnoindentpara This is commonly compensated for by using a Schottky diode across the solenoid so that during normal operation the diode does nothing, but if the voltage across the coil, $V_L$, goes negative then the diode begins conducting quickly allowing the solenoid to dissipate it's energy without damaging the switching circuitry. As this diode protects the circuit from the flyback voltage spike induced by the inductive load it is referred to as a Flyback Diode. +======= \newnoindentpara This is commonly compensated for by using a Schottky diode across the solenoid so that during normal operation the diode does nothing, but if the voltage across the coil, $V_L$, goes negative then the diode begins conducting quickly allowing the solenoid to dissipate its energy without damaging the switching circuitry. As this diode protects the circuit from the flyback voltage spike induced by the inductive load it is referred to as a Flyback Diode. +>>>>>>> origin/main \begin{figure}[H] \begin{center} @@ -41,39 +45,45 @@ \subsection{Switching Loads} \newnoindentpara For any common microcontroller, GPIO pins by themselves will not be capable of switching a load with these voltage and current requirements so the use of a pass element transistor is used. The selected transistor needs to be capable of handling the load's voltage and current requirements while being capable of being controlled from the microcontroller. \subsection{Transistors} -As introduced in Question \ref{section:led}, a BJT or FET could be selected for this application.\footnote{Of course other options exist, however, for a simple application these are the only options worthy of consideration.} +As introduced in Question \ref{section:led}, a BJT or FET could be selected for this application\footnote{Of course other options exist, however, for a simple application these are the only options worthy of consideration.}. An electromechanical relay is not considered for this application due to their large size, cost, and low switching speed compared to solid state semiconductor devices. -As BJTs consume current at the base and have a constant base to emitter voltage drop, holding a BJT on requires constant power consumption. MOSFETs on the other hand require a gate to source voltage, but once the gate capacitance is filled they do not require any current to hold enabled. Additionally consider that the conduction losses of MOSFETs is much lower than BJTs. Consequently for driving loads, MOSFETs are prefferred! \newline +\newnoindentpara As BJTs consume current at their base and have a constant base to emitter voltage drop, holding a BJT in the ON state requires constant power consumption. MOSFETs on the other hand require a gate to source voltage, but once the gate capacitance is filled they do not require any current (and therefore power) to hold enabled. Additionally, consider that the conduction losses of MOSFETs is much lower than BJTs. Consequently for driving loads, MOSFETs are preferred! \newline -WIP +\newnoindentpara There are numerous types of MOSFET, but a key differentiator is N-Channel (aka NMOS) and P-Channel (aka PMOS). Depletion mode MOSFETs are most common and will be discussed here exclusively. NMOS FETs require a positive voltage between the gate and source terminals for them to turn ON, knwn as a positive $V_{gs}$, whereas PMOS FETs require a negative $V_{gs}$ to turn ON. Both types of FETs turn OFF when $V_{gs} \approx 0$. Consequently, saying a FET is ON means $\bar{V_{gs}} >> \bar{V_{th}}$ and a FET being OFF means $\bar{V_{gs}} \approx 0$. When a FET is ON, $V_{ds} \approx 0$, and when it is OFF, $I_{ds} \approx 0$. The conditions to enable and disable the FETs drive which applications the FETs can be used in, however, NMOS FETs generally have lower RDSon (Resistance between the drain and source pins when ON) then PMOS FETs have making them preferred. A lower RDSON results in decreased conduction losses. -% TODO WRITE : PCh FETS have more RDSon (and therefore conduction losses) than Nch FETs so +\subsection{High Side vs. Low Side} +The solenoid can be switched using a MOSFET using a PMOS FET at the high side or an NMOS FET at the low side as shown in Figure x and Figure y respectively. -\subsection{High Side vs Low Side} +% TODO DRAW : High Side PMOS & Solenoid w/ Flyback -WIP +% TODO DRAW : Low Side NMOS & Solenoid w/ Flyback -% Ground is more common around the system, espeacilly cars with grounded chassis +There are numerous tradeoffs with choosing either solution for this application including: -% think of high voltage, switching neutral would make unscrewing a lightbulb unsafe +\begin{itemize} + \item If multiple load devices are present, it is likely all of them need ground while they could require different voltage level power sources. By performing high side switching the total number of wires required in the harness could be decreased. For automotive applications the chassis also serves as ground meaning a low impedance ground connection to peripherals can come for free. + \item If a load requires a higher voltage and ground is prevelant then having high voltage always connected to the harness to the load exposes humans to a risk even when they preseive the load as unpowerred as the human can touch the high voltage harness and the chassis to receive a shock even whehn the load is not powerred. + \item Low side switching is the easiest bc % TODO write -> % The primary advantage of low side switching is that it is easier to switch a transistor on the low side rather than the high side. % Also lower conduction losses by using an NMOS + \item Loads may also have signal connections so ensuring they always share a ground reference even when high voltage power is disabled can be important +\end{itemize} -% harnesses can share a ground wire (or use a chassis for ground) +While the low side NMOS is easy to drive from the MCU, to do a high side PMOS, an NMOS FET must be used to buffer the switching. This NMOS FET does not need a large current rating as it is only driving the gate of the PMOS. It's purpose is to protect the pin of the microcontroller from being exposed to a high voltage. This completed circuit is shown in: -% common mode offset +% TODO DRAW : high side switched solenoid with low side NMOS to pull the gate with connection to MCU -% TODO DRAW : high side switched solenoid +To achieve low RDSON and high side switching, a high side NMOS can be used, however, +% TODO WRITE +% Note a high side NMOS can be used but then a higher voltage is required. Gets the best of both worlds +% introduce the concept of a switched capacitor (bootstrap cap / charge pump) to create this rail without an inductor? -% The primary advantage of low side switching is that it is easier to switch a transistor on the low side rather than the high side. +In this case as the voltage is low and the solenoid lacks any other IO or system level considerations, a low side NMOS circuit is optimal as shown in: -% the existence of other ground referenced digital signals incentivizes high side switching for the loads +% TODO DRAW : low side switched solenoid with connection to MCU -% referenced to ground - -% TODO DRAW : low side switched solenoid - -% \subsection{Follow-ups} -% \begin{itemize} -% \item -% \end{itemize} +\subsection{Follow-ups} +\begin{itemize} + \item What is the use case of adding a pull-up or pull-down resistor onto the gate of the switching MOSFET? % consider turn on case of the microcontroller, the pull-up asserts the logic state of the line when the microcontroller is not driving it. + \item Describe a technique for reducing the power consumption required to hold the solenoid enabled? % after reaching a steady state, PWM can be used to hold the position usually while putting less RMS current into the coil. +\end{itemize} \end{document} diff --git a/src/transmission_lines.tex b/src/transmission_lines.tex new file mode 100644 index 0000000..7cefb08 --- /dev/null +++ b/src/transmission_lines.tex @@ -0,0 +1,58 @@ +\documentclass[main.tex]{subfiles} + +\begin{document} + +%How would you measure the length of a 50 ohm coaxial cable ? +% Maybe make this a follow-up question +% If you probe the resistance of a 50 ohm coaxial cable on one end with the other end open circuit with a DMM, what resistance does it show? +% What if the cable is infinitely long? + +\section{How would you determine the length of an unknown coaxial cable?} \label{section:Transmission_lines} + +You cannot using a mechanical measurement device (i.e. measuring tape, ruler, etc.). + +\spoilerline + +\subsection{Transmission Lines} + +% TODO + +\subsection{Characteristic Impedance} + +Characteristic impedance relates voltage and current waves + +% TODO : Add link to the Alpha Phoenix videos, I love those for explain char impedance and velocity factor +% should look through the WARG EE bookshelf stuff + +% how trace width and stackup affect char impedance, what vias do to it as well! + +% TODO + +\subsection{Scattering Parameters} + +% TODO +% Scattering Parameters are used to describe power flow in high frequency circuits. +% While Scattering Parameters are useful for analysis of losses and transmissions, other parametric systems are used as well to aid in different forms of analysis\footnote{See Impedance, Admittance, & ABCD matrixes} + +% Define return loss and insertion loss? + +% 20log vs 10log could in incorporated as well + + + +\subsection{Propagation Constant} + +% TODO + +\subsection{Smith Chart} + +% TODO : Explain why this exists basically, dont do anything crazy with it + +\subsection{Follow-ups} +\begin{itemize} + \item What is impedance matching? Where is it used and why? + % \item Is measuring S11 a valid method of comparing the effectiveness of an antenna? % Looking for discussions of radiated power versus lost power. ie Lossy antennas such as the monopole with essentially a lowest possible loss-less S11. Also radiation pattern might be nice to discuss the importance of. The section doesn't really discuss antennas so removing for now? + \item Can an RF transmitter be damaged if it transmits when it's antenna is disconnected? Why? % Yes, Power reflects back and fries the power amplifier due to large S11. This is an important concept +\end{itemize} + +\end{document} diff --git a/src/unknown_capacitor.tex b/src/unknown_capacitor.tex new file mode 100644 index 0000000..3360b55 --- /dev/null +++ b/src/unknown_capacitor.tex @@ -0,0 +1,63 @@ +\documentclass[main.tex]{subfiles} + +\begin{document} + +\section{Determine the capacitance of an unknown discrete capacitor.} \label{section:unknown_capacitor} + +\subsection{Constraints} +\begin{itemize} + \item Ensure your method can determine the capacitance at any given DC bias voltage. + \item Using a tool with a direct capacitor meter (i.e. Digital Multimeter (DMM), LC Meter, Vector Network Analyzer (VNA)) is not permitted. Consider using a bench-top power supply, components of known values, and the oscilloscope only. % Force a solution based on first principles instead of "connect it to a DMM in capacitance reading mode..." + \item Assume the capacitance is known to be larger than $1 \mu H$. % avoid the RF implications of this question mostly +\end{itemize} + +\spoilerline + +\subsection{RC Time Domain} + +A simple approach is to connect a resistor in series with the unknown capacitor and then apply a voltage step to the input while measuring the voltage of the output. This circuit appears and behaves as shown in Figure \ref{fig:rc_low_pass_filter}. Recall that the output of the circuit, $V_{out}$ takes one time constant, $\tau = R \cdot C$, to go from it's initial voltage, $V_i$, to an intermediary voltage $V_i+(1-e^{-1}) \cdot V_s$ where the voltage of the applied step is represented by $V_s$. Note that $1-e^{-1} \approx 0.632 $ is a simple mathematical constant. + +\newnoindentpara By plotting $V_{out}$ on the oscilloscope after a step the time constant, $\tau$, can be measured. Because the resistor value, $R$, is known for the circuit the capacitance can be easily calculated as $C = \frac{\tau}{R}$. To achieve a reasonable time constant trial and error with varying the value of the resistor, $R$, can be used. The input voltage step is applied by enabling a constant voltage power supply. As the power supply is not an ideal source, there will be some finite rise time to the applied input step. To ensure an accurate measurement it is critical that the rise time of the power supply input voltage step is significantly shorter than the time constant of the RC Circuit to ensure assuming an ideal step is a reasonable assumption. + +\newnoindentpara The capacitance of a physical capacitor changes with varying DC bias voltages. If a large voltage step, $V_s$, is used then the effects of DC bias will start to affect the measurement. If a small voltage step, $V_s$, is used then quantization error of the oscilloscope will make it difficult to determine the time constant $\tau$ from the plot exactly. Varying the value of the initial voltage, $V_i$, allows for measurements of the unknown capacitor at different DC bias points. Separating $V_i$ and $V_s$ can be done by using two different channels of a power supply unit in the following circuit. + +% TODO DRAW: 2x series power supply channels into an RC circuit with probes on VIN and VOUT + +\subsection{Constant Current} + +% TODO WRITE +% can apply a constant current to it and measure slope of the voltage plot, challenges with dc bias + +\subsection{LC Resonance} + +Another method of accomplishing this is to resonate the capacitor with a known inductance. + +% TODO DRAW : Series LC Circuit with probes + +% TODO DRAW : Parallel LC Circuit with probes + +% parallel and series options for resonance, pros and cons, capacitor has some ESL as is ... + +% TODO + +\subsection{Non-Ideal Capacitor Modelling} + +% consider if this section should even exist? might be nice to show it just for reference ?? + +% TODO +Discrete capacitors differ from ideal capacitors due to the addition of parasitic effects. Capacitor models of increasing complexity exist for numerous different types of capacitors, however, the following model shown in Figure x is commonly considered. + +% TODO DRAW : Series RLC with bleed R in par with C model of a capacitor + +The Bode Plot for this circuit appears as follows + +% TODO PLOT : bode plot of RLC series circuit ? figure out the formulas LT Spice uses :sob: + +\subsection{Follow-ups} +\begin{itemize} + \item Consider other possible solutions? % I'm sure there are, will let people get creative on it, no particular solution I'm fishing for. + \item If a DMM set to resistance measurement mode is connected to a very large capacitor, what readings will it give and why? % Looking for an increasing resistance as the observed impedance. Requires understanding of how a DMM works + \item How would you use a VNA to determine the capacitance? % looking for a solution with some RF insight, S-params & Smith Chart stuff, some VNA's might have easy capacitance meters? looking for a relatively low frequency answer. +\end{itemize} + +\end{document} diff --git a/src/voltage_divider.tex b/src/voltage_divider.tex index 6c2d2e8..1dd8399 100644 --- a/src/voltage_divider.tex +++ b/src/voltage_divider.tex @@ -75,7 +75,7 @@ \subsection{Voltage Divider Circuit} \subsection{Voltage Divider Intuition} Consider a few specific cases of this circuit to help build intuition to approach problems featuring the voltage divider. \begin{itemize} - \item A simple case of the voltage divider circuit is when both resistors have the same value. $R = R_t = R_b$. In this case, $\frac{V_{out}}{V_{in}} = \frac{R}{R+R} = \frac{R}{2 \cdot R} = \frac{1}{2}$ which means $V_{in} = 2 \cdot V_{out}$ or $V_{out} = \frac{1}{2} \cdot V_{in}$. + \item A simple case of the voltage divider circuit is when both resistors have the same value: $R = R_t = R_b$. In this case, $\frac{V_{out}}{V_{in}} = \frac{R}{R+R} = \frac{R}{2 \cdot R} = \frac{1}{2}$ which means $V_{in} = 2 \cdot V_{out}$ or $V_{out} = \frac{1}{2} \cdot V_{in}$. % This is mentioned as this question is frequently asked, people should know the answer immediately \item Because $R_t > 0 \ \Omega$ and $R_b > 0 \ \Omega$ are required (as negative resistors do not exist), in all cases of the circuit being employed we observe that $0 < \frac{V_{out}}{V_{in}} < 1$. This indicates that $V_{out}$ < $V_{in}$ always holds for the voltage divider so the circuit always scales a voltage down from its input to its output. \item This circuit assumes no source impedance from $V_{in}$ and no loading connected to $V_{out}$. However, this assumption is not always valid in practical circuits (and explored later in this answer). \end{itemize}