From 503536700af0723b466849a2590bf23d046b4e04 Mon Sep 17 00:00:00 2001 From: James Date: Sat, 20 Aug 2022 10:50:44 +1200 Subject: [PATCH 1/7] docs: :memo: enhance readability of `KaTeX` (#2) --- presentations/AnalogL1/presentation.html | 76 +++++++++++------------ presentations/AnalogL6/presentation.html | 4 +- presentations/DigitalL1/presentation.html | 2 +- presentations/DigitalL2/presentation.html | 2 +- presentations/DigitalL3/presentation.html | 10 +-- presentations/DigitalL4/presentation.html | 26 ++++---- presentations/DigitalL5/presentation.html | 22 +++---- 7 files changed, 71 insertions(+), 71 deletions(-) diff --git a/presentations/AnalogL1/presentation.html b/presentations/AnalogL1/presentation.html index 37b6fa0..268b8f8 100644 --- a/presentations/AnalogL1/presentation.html +++ b/presentations/AnalogL1/presentation.html @@ -287,7 +287,7 @@ - A source that produces a nearly sinusoidal AC voltage is provided to you - The voltage generated by this source can be expressed in time-domain as -\\[ v\_{L(t)} = V\_{L(pk)}sin \left( \omega\_{L} t \right) \quad \text{where} \quad \omega\_{L} = 2 \pi f\_{L} = 1000 \pi \quad \because \ f\_{L} = 500Hz \\] +\\[ v\_{\text{L}}(t) = V\_{\text{L(pk)}}\sin \left( \omega\_{\text{L}} t \right) \quad \text{where} \quad \omega\_{\text{L}} = 2 \pi f\_{\text{L}} = 1000 \pi \quad \because \ f\_{\text{L}} = 500\,\text{Hz} \\] - RMS of this voltage, VL, can be set to between 13.6VRMS and 15.4VRMS via a software application - This AC source needs to be powered by providing 30VDC from a bench-top DC power source - It employs a switched-mode converter to synthesize an AC output voltage from a DC input voltage @@ -301,7 +301,7 @@ - A load that consists of a fixed inductor, LL, in series with a variable resistor, RL, is provided to you - The impedance of this load can be expressed in the phasor-domain as -\\[ Z\_{L} = R\_{L} + j \omega\_{L} L\_{L} \quad \text{where} \quad \omega\_{L} = 2 \pi f\_{L} = 1000 \pi \quad \because \ f\_{L} = 500Hz \\] +\\[ Z\_{\text{L}} = R\_{\text{L}} + j \omega\_{\text{L}} L\_{\text{L}} \quad \text{where} \quad \omega\_{\text{L}} = 2 \pi f\_{\text{L}} = 1000 \pi \quad \because \ f\_{\text{L}} = 500\,\text{Hz} \\] - The inductor has a fixed inductance of 4mH ± 20% - The resistance of the variable resistor can be set between 5Ω and 105Ω using the knob - Helps control complex power of the load to between specified 2.5VA and 7.5VA @@ -431,7 +431,7 @@ - Voltage is a measure of the charge imbalance that provides the force to move the electrons through a circuit branch - Resistance of a circuit branch is a measure of how hard it is for the electrons to flow through that branch - Ohm's law relates voltage, current and resistance of a resistor -\\[ V\_{DC} = I\_{DC}R \quad \text{OR} \quad v\_{(t)} = i\_{(t)}R \\] +\\[ V\_{\text{DC}} = I\_{\text{DC}}R \quad \text{or} \quad v(t) = i(t)R \\] ] .right-column[ @@ -507,27 +507,27 @@ R - \(V_{DC} = I_{DC}R\) - \(v_{(t)} = i_{(t)}R \) + \(V_\text{DC} = I_\text{DC}R\) + \(v(t) = i(t)R \) \(\bar{V} = \bar{I}R\) - \(v_{(t)} = i_{(t)}R \) - \(V_{(s)} = I_{(s)}R \) + \(v(t) = i(t)R \) + \(V(s) = I(s)R \) L Short Cct. - \(v_{(t)} = L \frac{\mathrm{d} i_{(t)}}{\mathrm{d} t} \) + \(v(t) = L \frac{\mathrm{d} i(t)}{\mathrm{d} t} \) \(\bar{V} = j X_L \bar{I} = j\omega L \bar{I}\) - \(v_{(t)} = L \frac{\mathrm{d} i_{(t)}}{\mathrm{d} t} \) - \(V_{(s)} = s L I_{(s)}\) + \(v(t) = L \frac{\mathrm{d} i(t)}{\mathrm{d} t} \) + \(V(s) = s L I(s)\) C Open Cct. - \(i_{(t)} = C \frac{\mathrm{d} v_{(t)}}{\mathrm{d} t} \) - \(\bar{V} = j X_C \bar{I} = \bar{I}/j\omega C \) - \(i_{(t)} = C \frac{\mathrm{d} v_{(t)}}{\mathrm{d} t} \) - \(V_{(s)} = {I_{(s)}} / {sC} \) + \(i(t) = C \frac{\mathrm{d} v(t)}{\mathrm{d} t} \) + \(\bar{V} = j X_C \bar{I} = \frac{\bar{I}}{j\omega C} \) + \(i(t) = C \frac{\mathrm{d} v(t)}{\mathrm{d} t} \) + \(V(s) = \frac {I(s)} {sC} \) @@ -556,10 +556,10 @@ - Solve the simultaneous equations from KVL and KCL by substituting for V & I relationships from 1st step - As an example for circuit here there are 3 unknown Is and Vs, and the 3 equations to solve are - - At node KCL1: `\( \quad I_{in} - I_{1} - I_{2} = 0 \)` - - From loop KVL1: `\( \quad V_{in} - V_{1} - V_{3} = 0 \quad \Rightarrow \quad V_{in} = I_{1}R_{1} + (I_{1} + I_{2})R_{3} \)` + - At node KCL1: `\( \quad I_\text{in} - I_{1} - I_{2} = 0 \)` + - From loop KVL1: `\( \quad V_\text{in} - V_{1} - V_{3} = 0 \quad \Rightarrow \quad V_\text{in} = I_{1}R_{1} + (I_{1} + I_{2})R_{3} \)` - From loop KVL2: `\( \quad V_{1} - V_{2} = 0 \quad \Rightarrow \quad I_{1}R_{1} = I_{2}R_{2} \)` -- Solving the 2 KVL equations and substituting circuit parameters we get `\( I_{1} = I_{2} = 0.5A \ \ \text{&} \ \ I_{in} = 1A \)` +- Solving the 2 KVL equations and substituting circuit parameters we get `\( I_{1} = I_{2} = 0.5\,\text{A} \ \, \text{\&} \ \, I_{\text{in}} = 1\,\text{A} \)` - Could have used a circuit transformation to combine R1 & R2 in parallel and simplified the analysis --- @@ -601,7 +601,7 @@ - These circuit elements include resistors (dissipate energy), batteries (store energy), LEDs (convert energy), etc. - In AC circuits, inductive and capacitive circuit elements result in reactive power since they absorb energy from electrons during part of the time period and release this energy during the remainder of the period - To understand and define real, reactive and apparent power we use **instantaneous power** given by -\\[ p\_{(t)} = v\_{(t)} i\_{(t)} \\] +\\[ p(t) = v(t) \cdot i(t) \\] - Note, AC circuits may not always use sinusoidal sources, and they can be of any wave shape --- @@ -613,11 +613,11 @@ - Real power by **definition is the average of p(t) over a time period, TL** - Consider the resistive load in ['Example 1'](#S17), which only consumes real power - From our analysis we know that -\\[ v\_{L(t)} = V\_{L(pk)} \ cos (1000 \pi t) \quad \text{and} \quad i\_{L(t)} = V\_{L(pk)} \ cos (1000 \pi t) / R\\] +\\[ v\_{\text{L}}(t) = V\_{\text{L(pk)}} \cos (1000 \pi t) \quad \text{and} \quad i\_{\text{L}}(t) = \dfrac{V\_{\text{L(pk)}} \cos (1000 \pi t)}{R}\\] - Instantaneous power in the resistive load in ['Example 1'](#S17) is therefore -\\[ p\_{L(t)} = \frac {V^2\_{L(pk)}} {R} \ cos ^2 (1000 \pi t) = \frac {V^2\_{L(pk)}} {2R} \left[ \ cos (2000 \pi t) + 1 \right] \\] +\\[ p\_{\text{L}}(t) = \frac {V^2\_{\text{L(pk)}}} {R} \cos ^2 (1000 \pi t) = \frac {V^2\_{\text{L(pk)}}} {2R} \left[ \cos (2000 \pi t) + 1 \right] \\] - Real power delivered to the resistive load in ['Example 1'](#S17) is therefore -\\[ P = \frac{1} {T\_L} \int\_{0}^{T\_L} p\_{L(t)}\,dt \ = \frac{1} {T\_L} \int\_{0}^{T\_L} v\_{(t)} i\_{(t)} \,dt \ = V^2\_{L(pk)}/2R \\] +\\[ P = \frac{1} {T\_\text{L}} \int\_{0}^{T\_\text{L}} p\_{\text{L}}(t)\,dt \ = \frac{1} {T\_\text{L}} \int\_{0}^{T\_\text{L}} v(t)\cdot i(t) \,dt \ = \frac{V^2\_{\text{L(pk)}}}{2R} \\] ] .right-column-s[ @@ -631,11 +631,11 @@ - RMS value of an AC voltage or a current is defined to provide a measure of (real) power dissipated in a resistive load in an AC circuit - Using the definition of real power and Ohm's law, power dissipated in a resistive load is given by -\\[ P = \frac{1} {T\_L} \int\_{0}^{T\_L} p\_{L(t)}\,dt \ = \frac{1} {T\_L} \int\_{0}^{T\_L} v\_{(t)} i\_{(t)} \,dt \ = \frac {1} {RT\_L} \int\_{0}^{T\_L} v^2\_{(t)} \,dt \ \overset{\underset{\mathrm{OR}}{}}{=} \ \frac{R} {T\_L} \int\_{0}^{T\_L} i^2\_{(t)} \,dt\\\] +\\[ P = \frac{1} {T\_\text{L}} \int\_{0}^{T\_\text{L}} p\_{\text{L}}(t)\,dt \ = \frac{1} {T\_\text{L}} \int\_{0}^{T\_\text{L}} v(t)\cdot i(t) \,dt \ = \frac {1} {RT\_\text{L}} \int\_{0}^{T\_\text{L}} v^2(t) \,dt \ \overset{\underset{\mathrm{OR}}{}}{=} \ \frac{R} {T\_\text{L}} \int\_{0}^{T\_\text{L}} i^2(t) \,dt\\] - From this, we could develop the definition of RMS value of an AC voltage or a current as -\\[ V^2\_{RMS} = \frac{1} {T\_L} \int\_{0}^{T\_L} v^2\_{(t)} \,dt \quad \text{and} \quad I^2\_{RMS} = \frac{1} {T\_L} \int\_{0}^{T\_L} i^2\_{(t)} \,dt \\] +\\[ V^2\_{\text{RMS}} = \frac{1} {T\_\text{L}} \int\_{0}^{T\_\text{L}} v^2(t) \,dt \quad \text{and} \quad I^2\_{\text{RMS}} = \frac{1} {T\_\text{L}} \int\_{0}^{T\_\text{L}} i^2(t) \,dt \\] - As an example, RMS value of a **sinusoidal** AC voltage (and similarly a current) is give by -\\[ V\_{RMS} = \sqrt{ \frac{1} {T\_L} \int\_{0}^{T\_L} V^2\_{L(pk)} \ cos ^2 (\omega\_{L} t) \,dt } = \sqrt{ \frac{1} {T\_L} \int\_{0}^{T\_L} \frac {V^2\_{L(pk)}} {2} \ \left[ cos(2\omega\_{L} t) + 1 \right] \,dt } = \frac {V\_{L(pk)}} {\sqrt{2}}\\] +\\[ V\_{\text{RMS}} = \sqrt{ \frac{1} {T\_\text{L}} \int\_{0}^{T\_\text{L}} V^2\_{\text{L(pk)}} \cos ^2 (\omega\_{\text{L}} t) \,dt } = \sqrt{ \frac{1} {T\_\text{L}} \int\_{0}^{T\_\text{L}} \frac {V^2\_{\text{L(pk)}}} {2} \ \left[ \cos(2\omega\_{\text{L}} t) + 1 \right] \,dt } = \frac {V\_{\text{L(pk)}}} {\sqrt{2}}\\] --- name: S21 @@ -655,10 +655,10 @@ - Apparent power is a measure of the voltage and current required to drive an AC circuit - The definition of apparent power is therefore simply -\\[ \left| S \right| = V\_{RMS}I\_{RMS} \\] +\\[ \left| S \right| = V\_\text{RMS}\cdot I\_\text{RMS} \\] - Apparent power required to drive an AC circuits that has inductors and/or capacitors is greater than real power consumed by this circuit - The ratio between the real power and apparent power is defined as the power factor of an AC circuit -\\[ p.f. = \frac {P} {\left| S \right|} \\] +\\[ \mathit{p.f.} = \frac {P} {\left| S \right|} \\] - It is important for an electrical circuit to have a power factor of 1 (or close to 1) - Higher power factors minimizes the voltage and current that is required to drive an AC circuit @@ -685,11 +685,11 @@ .left-column-s[ - Consider the inductive load in ['Example 1'](#S17), which only results in reactive power (i.e., the average of p(t) over a time period, Tp should be zero) - From our analysis we know that -\\[ v\_{L(t)} = V\_{L(pk)} \ cos (1000 \pi t) \quad \text{and} \quad i\_{L(t)} = V\_{L(pk)} \ cos (1000 \pi t - \pi/2) / \omega\_{L} L\\] +\\[ v\_{\text{L}}(t) = V\_{\text{L(pk)}} \cos (1000 \pi t) \quad \text{and} \quad i\_{\text{L}}(t) = \frac{V\_{\text{L(pk)}} \cos (1000 \pi t - \frac{\pi}{2})} {\omega\_{\text{L}} L}\\] - Instantaneous power in the inductive load in ['Example 1'](#S17) is therefore -\\[ p\_{L(t)} = \frac {V^2\_{L(pk)}} {\omega\_{L} L} \ cos (1000 \pi t) \ cos (1000 \pi t - \pi/2) = \frac {V^2\_{L(pk)}} {2\omega\_{L} L} \ sin (2000 \pi t) \\] +\\[ p\_{\text{L}}(t) = \frac {V^2\_\text{L(pk)}} {\omega\_{\text{L}} L} \cos (1000 \pi t) \cos \left(1000 \pi t - \tfrac{\pi}{2}\right) = \frac {V^2\_\text{L(pk)}} {2\omega\_{\text{L}} L} \sin (2000 \pi t) \\] - Real and reactive power delivered to the inductive load in ['Example 1'](#S17) are -\\[ P = \frac{1} {T\_L}\int\_{0}^{T\_L} p\_{L(t)}\,dt \ = 0 \quad \text{and} \quad Q = \frac {V^2\_{L(pk)}} {2\omega\_{L} L} = \frac {V^2\_{L(RMS)}} {\omega\_{L} L} \\] +\\[ P = \frac{1} {T\_\text{L}}\int\_{0}^{T\_\text{L}} p\_{\text{L}}(t)\,dt \ = 0 \quad \text{and} \quad Q = \frac {V^2\_\text{L(pk)}} {2\omega\_{\text{L}} L} = \frac {V^2\_\text{L(RMS)}} {\omega\_{\text{L}} L} \\] ] .right-column-s[ @@ -703,10 +703,10 @@ - As engineers we tend to use simplified expressions to calculate electrical quantities - In previous courses you may have learnt that RMS of a voltage or a current is related to its peak as -\\[ V\_{pk} = \sqrt{2} V\_{RMS} \quad \text{and} \quad I\_{pk} = \sqrt{2} I\_{RMS} \\] +\\[ V\_\text{pk} = \sqrt{2} V\_\text{RMS} \quad \text{and} \quad I\_\text{pk} = \sqrt{2} I\_\text{RMS} \\] - These RMS relationships **only hold valid for perfect sinusoidal** voltages and currents - Similarly, you may have learnt that power is a function of RMS voltage and/or current as -\\[ P = V\_{RMS} I\_{RMS} = I^2\_{RMS}R = V^2\_{RMS}/R \\] +\\[ P = V\_\text{RMS} I\_\text{RMS} = I^2\_\text{RMS}R = \frac{V^2\_\text{RMS}}{R} \\] - These power relationships **only hold valid for ideal resistors** - In practice, **perfect sinusoidal** sources do not exists and there are components other than resistors that consume real power (e.g., LEDs) - In these situations, fundamental relationships we derived help us determine P, S, Q and RMSs @@ -751,7 +751,7 @@ - The functionality of the voltage sensor circuitry is to step-down the voltage to be measured to a safer level that can be passed through the signal conditioning circuitry to the microcontroller - The most common approach is to use a voltage divider to implement the voltage sensor - The voltage divider is designed to step-down the voltage to be measured to the required level -\\[ v\_{vs(t)} = v\_{L(t)} \ R\_b/(R\_a + R\_b) \\] +\\[ v\_\text{vs}(t) = v\_{\text{L}}(t) \ \frac{R\_\text{b}}{R\_\text{a} + R\_\text{b}} \\]

@@ -779,9 +779,9 @@ - In the labs you will be guided to determine a more suitable peak-peak amplitude - We need to consider the highest vL to be measured measured (i.e., 15.4V) to ensure Vvs(pk-pk) ≤ 1V - Using this information we can derive the relation -\\[ V\_{vs(pk-pk)} = V\_{L(pk-pk)} \ R\_b/(R\_a + R\_b) \quad \Rightarrow \quad 1 \geq 15.4\times 2\sqrt{2} \ R\_b/(R\_a + R\_b) \quad \Rightarrow \quad R\_a \geq 41.4 R\_b\\] +\\[ V\_\text{vs(pk-pk)} = V\_\text{L(pk-pk)} \ \frac{R\_\text{b}}{R\_\text{a} + R\_\text{b}} \quad \Rightarrow \quad 1 \geq 15.4\times 2\sqrt{2} \ \frac{R\_\text{b}}{R\_\text{a} + R\_\text{b}} \quad \Rightarrow \quad R\_\text{a} \geq 41.4 R\_\text{b}\\] - The power dissipated as loss in Ra & Rb can be expressed as -\\[ P\_{vs-loss} = V^2\_{L(RMS)}/(R\_a + R\_b) \\] +\\[ P\_\text{vs-loss} = \frac{V^2\_\text{L(RMS)}}{R\_\text{a} + R\_\text{b}} \\] - To determine appropriates values for Ra & Rb we need to minimize Pvs-loss while making sure sufficiently large signal-to-noise ratio (SNR) and low sensitivity to the environment - For UG work, avoid using resistance values greater than 500kΩ to minimize sensitivity @@ -821,7 +821,7 @@ - The most common approach is to insert a small a current sense resistor in the path of current flow - Current sense resistor should be sufficiently small so it does not impact the load current - The voltage across the current sense resistor is proportional to the current through it since -\\[ v\_{is(t)} = i\_{L(t)} R\_s \\] +\\[ v\_{\text{is}}(t) = i\_{\text{L}}(t)\cdot R\_\text{s} \\] - Alternatively, [hall-effect sensors](https://www.allegromicro.com/en/insights-and-innovations/technical-documents/hall-effect-sensor-ic-publications/non-intrusive-hall-effect-current-sensing-techniques-for-power-electronics) (AC or DC) or [current transformers](https://www.electronics-tutorials.ws/transformer/current-transformer.html) (AC only) can be used
@@ -851,10 +851,10 @@ - We need to consider the highest iL to be measured measured to ensure Pis-loss ≤ 50mW - Highest IL(RMS) is at lowest VL(RMS) and highest VA specified (i.e., IL(RMS) = 7.5VA/13.6V = 0.55ARMS) - Using this information we can derive the relation -\\[ P\_{is-loss} = I^2\_{L(RMS)} R\_s \quad \Rightarrow \quad 0.05 \geq 0.55^2 R\_s \quad \Rightarrow \quad R\_s \leq 165 m\Omega \\] +\\[ P\_\text{is-loss} = I^2\_\text{L(RMS)}\cdot R\_\text{s} \quad \Rightarrow \quad 0.05 \geq 0.55^2 R\_\text{s} \quad \Rightarrow \quad R\_\text{s} \leq 165\, \text{m}\Omega \\] - If Rs is choosen as 160mΩ, Vis measured at both highest and lowest iL are -\\[ V\_{is(pk-pk)-highest} = 0.55\times 2\sqrt{2}\times 0.16 \approx 250mV \\] -\\[ V\_{is(pk-pk)-lowest} = 0.16\times 2\sqrt{2}\times 0.16 \approx 72mV\\] +\\[ V\_\text{is(pk-pk)-highest} = 0.55\times 2\sqrt{2}\times 0.16 \approx 250\, \text{mV} \\] +\\[ V\_\text{is(pk-pk)-lowest} = 0.16\times 2\sqrt{2}\times 0.16 \approx 72\, \text{mV}\\] - To determine an appropriate value for Rs we need to minimize Pvs-loss, size and cost while making sure sufficiently large signal-to-noise ratio (SNR) --- diff --git a/presentations/AnalogL6/presentation.html b/presentations/AnalogL6/presentation.html index 750f105..237c333 100644 --- a/presentations/AnalogL6/presentation.html +++ b/presentations/AnalogL6/presentation.html @@ -255,7 +255,7 @@ # Resistors - The DC resistance of a conductor made using a material with a resistivity, ρ, has a cross-sectional area, A, and a length, l, is given by, -\\[ R\_{dc} = \frac{\rho l}{A} \\] +\\[ R\_\text{dc} = \frac{\rho\cdot l}{A} \\] - A resistor is thus made using a conductor that has specific length and a cross-sectional area, which gives the required resistance - The conductor is typically arranged as a helix to reduce the size of the resistor - As a practical resistor uses a certain length of wire,typically in a helix arrangement, it not only has resistance but also has some inductance @@ -401,7 +401,7 @@ # Capacitors - The capacitance of a capacitor made using two conducting plates, where each plate has an area, A, separated by, d, and uses insulation material between the plates with a permittivity, εrε0, is given by, -\\[ C = \frac{\epsilon\_r \epsilon\_0 A}{d} \\] +\\[ C = \frac{\epsilon\_\text{r} \epsilon\_0 A}{d} \\] - A capacitor is thus made using conducting plates that has specific area and a separation, which gives the required capacitance - The plates typically arranged like a multilayer "wrap" to reduce the size of the capacitor - A practical capacitor not only has capacitance but also has some inductance and resistance diff --git a/presentations/DigitalL1/presentation.html b/presentations/DigitalL1/presentation.html index 7968885..3b234d9 100644 --- a/presentations/DigitalL1/presentation.html +++ b/presentations/DigitalL1/presentation.html @@ -988,7 +988,7 @@ # Example: Reading Input & Driving LED (PI) .questions[ -Develop a program to read the input from a push-button and control an LED. As shown by the Proteus schematic below, one end of the push-button is connected PB7 on ATmega328P while the other end is connected to the ground. The pull-up resistor, `\( R_1 \)`, ensures the voltage at PB7 is pulled to 5V (i.e. VCC supplied to the MCU) when the push-button is released. The filter capacitor, `\( C_1 \)`, is used for debouncing. When the push-button is pressed it creates 0V at PB7, when released PB7 will be 5V. LED is connected to PB5 through a current limiting resistor, `\( R_2 \)`. Generating 5V at PB5 will create a current to flow turning-on the LED (i.e. `\( I_{LED} = \left ( 5 - V_{f} \right ) / R_2 \)` where `\( V_f \approx 2V\)` for a yellow LED). Setting PB5 to 0V will turn-off the LED. +Develop a program to read the input from a push-button and control an LED. As shown by the Proteus schematic below, one end of the push-button is connected PB7 on ATmega328P while the other end is connected to the ground. The pull-up resistor, `\( R_1 \)`, ensures the voltage at PB7 is pulled to 5V (i.e. VCC supplied to the MCU) when the push-button is released. The filter capacitor, `\( C_1 \)`, is used for debouncing. When the push-button is pressed it creates 0V at PB7, when released PB7 will be 5V. LED is connected to PB5 through a current limiting resistor, `\( R_2 \)`. Generating 5V at PB5 will create a current to flow turning-on the LED (i.e. `\( I_\text{LED} = \left ( 5 - V_\text{f} \right ) / R_2 \)` where `\( V_\text{f} \approx 2\, \text{V}\)` for a yellow LED). Setting PB5 to 0V will turn-off the LED. ] .center[ diff --git a/presentations/DigitalL2/presentation.html b/presentations/DigitalL2/presentation.html index c6b41b1..a24d2aa 100644 --- a/presentations/DigitalL2/presentation.html +++ b/presentations/DigitalL2/presentation.html @@ -712,7 +712,7 @@ - The UBRR0 value defines the prescaler applied to used to the system clock (fosc) to obtain the UART clock (i.e. UART clock = (fosc / (UBRR0 + 1)) - Under normal operation the UART clock needs to be 16 times the baud rate and therefore -\\[ \text{Baud Rate} = \frac{f\_{osc}} {16 \times \left( UBRR0 + 1 \right) } \quad \text {or} \quad UBRR0 = \frac {f\_{osc}} {\left( \text {Baud Rate} \right) \times 16} - 1\\] +\\[ \text{Baud Rate} = \frac{f\_\text{osc}} {16 \times \left( \mathtt{UBRR0} + 1 \right) } \quad \text {or} \quad \mathtt{UBRR0} = \frac {f\_\text{osc}} {\left( \text {Baud Rate} \right) \times 16} - 1\\] --- name: S29 diff --git a/presentations/DigitalL3/presentation.html b/presentations/DigitalL3/presentation.html index 71af05e..96528a8 100644 --- a/presentations/DigitalL3/presentation.html +++ b/presentations/DigitalL3/presentation.html @@ -357,7 +357,7 @@ # The Sampling Process - The size of the time intervals the signal is split into, referred to as sample time, is dependent on the sampling frequency (also called sampling rate), measured in hertz -\\[ t\_{sample} = \frac{1}{f\_{sample}} \\] +\\[ t\_\text{sample} = \frac{1}{f\_\text{sample}} \\] - Higher sampling rates allow the original analog signal to be captured more accurately - However this requires faster ADC hardware, and more memory to store the digital data - To accurately capture a signal the sampling rate must be greater than the Nyquist frequency @@ -401,7 +401,7 @@ - Total sampling time - This is the total time taken to make a single ADC reading and is therefore the sum of both the acquisition time and conversion time - The maximum sampling rate/frequency is limited by the minimum total sampling time -\\[ f\_{sample(max)} = \frac{1}{t\_{acquisition(min)} + t\_{conversion(min)}} \\] +\\[ f\_\text{sample(max)} = \frac{1}{t\_\text{acquisition(min)} + t\_\text{conversion(min)}} \\] - We will learn more about the acquisition process and the conversion process soon --- @@ -418,7 +418,7 @@ - This specifies the voltage which the input signal is compared to (e.g. 5V) and therefore signals larger than the reference voltage cannot be accurately converted - Step size (Vstep) - This is the smallest signal that can be determined by the ADC and is a function of both the resolution and the reference voltage -\\[ V\_{step} = \frac{V\_{ref}}{2^{resolution}} \\] +\\[ V\_\text{step} = \frac{V\_\text{ref}}{2^\text{resolution}} \\] --- @@ -530,7 +530,7 @@ - The acquisition time must be long enough to allow the sample and hold capacitor to charge - This is dependent on the source impedance (Rsignal) of the signal being measured - The capacitor is fully charged after approximately 5 time constants (τ) - \\[ \tau = (R\_{signal} + R\_{sample}) C\_{sample} \\] + \\[ \tau = (R\_\text{signal} + R\_\text{sample}) C\_\text{sample} \\] - The conversion time is dependent on the resolution and the cycle time - One cycle is required per bit of resolution - Shorter cycle times will result in faster conversions, but the minimum cycle time will be limited by the ADC hardware capability, as well as the clock speed of the MCU @@ -821,7 +821,7 @@ - It is measured in Least-Significant-Bits (LSB) - Given that one LSB is equal one step size, we can determine how many volts the converted reading might differ from the actual value -\\[ V\_{\text{Absolute Error}} = V\_{\text{step}} \times LSB\_{\text{Absolute Error}} \\] +\\[ V\_{\text{Absolute Error}} = V\_{\text{step}} \times \mathtt{LSB}\_{\text{Absolute Error}} \\] \\[ V\_{\text{ADC}} - V\_{\text{Absolute Error}} \leqslant V\_{\text{Actual}} \leqslant V\_{\text{ADC}} + V\_{\text{Absolute Error}} \\] diff --git a/presentations/DigitalL4/presentation.html b/presentations/DigitalL4/presentation.html index 460529e..fd4f748 100644 --- a/presentations/DigitalL4/presentation.html +++ b/presentations/DigitalL4/presentation.html @@ -266,7 +266,7 @@ - The gain of the passive RC filter, Gvf, is 1 in your design - The analog signal at the ADC, Vvf, is therefore -\\[ V\_{vf} = G\_{vs} G\_{vo} V\_{AC} + V\_{off} \\] +\\[ V\_\text{vf} = G\_\text{vs} G\_\text{vo} V\_\text{AC} + V\_\text{off} \\] --- @@ -283,7 +283,7 @@ - The gain of the passive RC filter, Gif, is 1 in your design - The analog signal at the ADC, Vif, is therefore -\\[ V\_{if} = G\_{is} G\_{io} I\_{L} + V\_{off} \\] +\\[ V\_\text{if} = G\_\text{is} G\_\text{io} I\_\text{L} + V\_\text{off} \\] --- @@ -298,7 +298,7 @@ - Alternatively Vvf can be continuously sampled over a few periods to take samples of Vvf every 0.1ms - Need zero crossing detector to correctly align the Vif samples taken after this with the Vvf samples - From the ADC data we can estimate the AC source voltage at ith sample point since -\\[ V\_{AC}[i] = \left( ADC0Value[i] \times 5/1024 - V\_{off} \right) / \left( G\_{vs} G\_{vo} \right) \\] +\\[ V\_\text{AC}[i] = \frac {\mathtt{ADC0Value}[i] \times \frac{5}{1024} - V\_\text{off}} {G\_\text{vs} G\_\text{vo}} \\] --- @@ -313,7 +313,7 @@ - Alternatively Vif can be continuously sampled over a few periods to take samples of Vif every 0.1ms - Need zero crossing detector to correctly align the Vif samples with the Vvf samples - From the ADC data we can estimate the AC load current at ith sample point since -\\[ I\_{L}[i] = \left( ADC1Value[i] \times 5/1024 - V\_{off} \right) / \left( G\_{is} G\_{io} \right) \\] +\\[ I\_\text{L}[i] = \frac {\mathtt{ADC1Value}[i] \times \frac{5}{1024} - V\_\text{off}} {G\_\text{is} G\_\text{io}} \\] --- name: S6 @@ -410,13 +410,13 @@ - [Recall](#S7) that we have already learnt how to obtain the peak of a signal - Assuming this signal is sinusoidal, the peak value is related to the RMS value as given by -\\[ RMS = \frac {Peak} {\sqrt{2}} \\] +\\[ \text{RMS} = \frac {\text{Peak}} {\sqrt{2}} \\] - The assumption of a sinusoidal signal is not always correct, especially in a practical design, as Vac and IL are often distorted sinusoidal signals - The distortions in the signals lead to significant errors in the RMS estimate when using this method - We can improve the accuracy by developing software to implement the RMS formula given by -\\[ V\_{AC\_{rms}} = \sqrt {\frac {1} {T\_p} \int\_{0}^{T\_p} {V\_{AC}^2 dt}} \quad \text{OR} \quad I\_{L\_{rms}} = \sqrt {\frac {1} {T\_p} \int\_{0}^{T\_p} {I\_{L}^2 dt}}\\] +\\[ V\_\text{AC(RMS)} = \sqrt {\frac {1} {T\_\text{p}} \int\_{0}^{T\_\text{p}} {V\_\text{AC}^2 \,dt}} \quad \text{or} \quad I\_\text{L(RMS)} = \sqrt {\frac {1} {T\_\text{p}} \int\_{0}^{T\_\text{p}} {I\_\text{L}^2 \,dt}}\\] --- name: S11 @@ -446,7 +446,7 @@ - If we have taken N ADC samples at regular Δtsample intervals over one time period of the signal, the time period Tp = NΔtsample - We can square each VAC or IL sample and use Riemann sum to numerically evaluate the RMS as given by -\\[ V\_{AC\_{rms}}^2 = \frac {1}{N \Delta t\_{sample}} \sum\_{i=0}^{N-1} V\_{AC}^2[i] \Delta t\_{sample} \quad \text{OR} \quad I\_{L\_{rms}}^2 = \frac {1}{N \Delta t\_{sample}} \sum\_{i=0}^{N-1} I\_L^2[i] \Delta t\_{sample}\\] +\\[ V\_\text{AC(RMS)}^2 = \frac {1}{N \Delta t\_\text{sample}} \sum\_{i=0}^{N-1} V\_\text{AC}^2[i] \cdot \Delta t\_\text{sample} \quad \text{or} \quad I\_\text{L(RMS)}^2 = \frac {1}{N \Delta t\_\text{sample}} \sum\_{i=0}^{N-1} I\_\text{L}^2[i] \cdot \Delta t\_\text{sample}\\] --- @@ -505,13 +505,13 @@ - [Recall](#S10) that we have already learnt how to obtain the RMS of VAC and IL - Assuming VAC and IL are sinusoidal, the power is related to their RMS values and the power factor angle as given by -\\[ P = V\_{AC\_{rms}} I\_{L\_{rms}} cos(\theta) \\] +\\[ P = V\_\text{AC(RMS)} I\_\text{L(RMS)} \cos(\theta) \\] - The assumption of a sinusoidal signal is not always correct, especially in a practical design, as Vac and IL are often distorted sinusoidal signals - The distortions in the signals lead to significant errors in the power estimate when using RMSs and the power factor angle - We can improve the accuracy by developing software to implement the power formula given by -\\[ P = \frac {1} {T\_p} \int\_{0}^{T\_p} {V\_{AC} I\_{L} dt} \\] +\\[ P = \frac {1} {T\_\text{p}} \int\_{0}^{T\_\text{p}} {V\_\text{AC} I\_\text{L} \,dt} \\] --- name: S15 @@ -523,7 +523,7 @@ - Samples of VAC as well as IL are at regular Δtsample intervals - We can multiply each VAC sample with corresponding IL sample to numerically evaluate power as given by -\\[ P = \frac {1}{N \Delta t\_{sample}} \sum\_{i=0}^{N-1} V\_{AC}[i] I\_L[i] \Delta t\_{sample} = \frac {1}{N } \sum\_{i=0}^{N-1} V\_{AC}[i] I\_L[i]\\] +\\[ P = \frac {1}{N \Delta t\_\text{sample}} \sum\_{i=0}^{N-1} \left( V\_\text{AC}[i] \cdot I\_\text{L}[i] \cdot \Delta t\_\text{sample} \right) = \frac {1}{N} \sum\_{i=0}^{N-1} \left( V\_\text{AC}[i]\cdot I\_\text{L}[i] \right)\\] - Since the two ADC channels are sampled one after the other, there is a time delay between each sample of VAC and its corresponding IL sample - This can lead to a significant error in power calculation in the form of a phase-shift @@ -542,13 +542,13 @@ .left-column[ - The missing VAC and IL samples can be approximated using the average of the samples from either side (i.e. linear approximation) -\\[ \bar{V}\_{AC}[i] = \left( V\_{AC}[i] + V\_{AC}[i+1] \right) / 2 \\] -\\[ \bar{I}\_{L}[i] = \left( I\_{L}[i-1] + I\_{L}[i] \right) / 2 \\] +\\[ \bar{V}\_\text{AC}[i] = \frac {V\_\text{AC}[i] + V\_\text{AC}[i+1]} {2} \\] +\\[ \bar{I}\_\text{L}[i] = \frac {I\_\text{L}[i-1] + I\_\text{L}[i]} {2} \\] - How can we estimate the 11th sample of VAC and the -1th sample of IL? - Power can now be evaluated as given by -\\[ P = \frac {1}{2N} \sum\_{i=0}^{N-1} \left[ V\_{AC}[i] \bar{I}\_L[i] + \bar{V}\_{AC}[i] I\_L[i] \right] \\] +\\[ P = \frac {1}{2N} \sum\_{i=0}^{N-1} \left[ V\_\text{AC}[i] \cdot \bar{I}\_\text{L}[i] + \bar{V}\_\text{AC}[i] \cdot I\_\text{L}[i] \right] \\] ] diff --git a/presentations/DigitalL5/presentation.html b/presentations/DigitalL5/presentation.html index 3c4871f..6e7051c 100644 --- a/presentations/DigitalL5/presentation.html +++ b/presentations/DigitalL5/presentation.html @@ -258,8 +258,8 @@ - We also want to monitor activities, and want to determine for how long or how often they occur - As an example consider having to measure how long a button is pressed for - All microcontrollers have a notion of time based on its clock, as each clock period is a function of the system clock frequency -\\[ T\_{system\\\_clk} = \frac{1}{f\_{system\\\_clk}} \\] -- Timers are peripherals which enable us to convert the `\(T_{system\_clk}\)` either into actions in real time or to measure events in real time +\\[ T\_\mathtt{system\\\_clk} = \frac{1}{f\_\mathtt{system\\\_clk}} \\] +- Timers are peripherals which enable us to convert the `\(T_\mathtt{system\_clk}\)` either into actions in real time or to measure events in real time --- @@ -268,7 +268,7 @@ # Timing Without Timer Peripherals - The microcontroller processor also has a notion of time from the system clock since the duration of each execution cycle is also -\\[ T\_{cpu\\\_clk} = \frac{1}{f\_{cpu\\\_clk}} \\] +\\[ T\_\mathtt{cpu\\\_clk} = \frac{1}{f\_\mathtt{cpu\\\_clk}} \\] - We could implement timing in software by using for example a 'dummy' block of code that uses up execution cycles - This is at the expense of taking up the processor time - We also need to know exactly how many clock cycles it took to execute the block of code used for timing @@ -388,13 +388,13 @@ - Prescaler - The clock divider which divides the system clock to create the timer clock -\\[ f\_{timer\\\_clk} = \frac{f\_{system\\_clk}}{\text{Prescaler}} \\] +\\[ f\_\mathtt{timer\\\_clk} = \frac{f\_\mathtt{system\\\_clk}}{\text{Prescaler}} \\] - Bits - The number of bits allocated to the count register -\\[ 0 \leqslant \text{count} < 2^{bits} \\] +\\[ 0 \leqslant \text{count} < 2^\text{bits} \\] - Resolution - This is the minimum time interval the timer can measure and is equal to one timer clock period -\\[ \text{Resolution} = \frac{1}{f\_{timer\\_clk}} \\] +\\[ \text{Resolution} = \frac{1}{f\_\mathtt{timer\\\_clk}} \\] --- @@ -404,7 +404,7 @@ - Range - This is the maximum time interval the timer can measure -\\[ \text{Range} = \text{Resolution} \times \left( 2^{bits} - 1 \right) \\] +\\[ \text{Range} = \text{Resolution} \times \left( 2^\text{bits} - 1 \right) \\] - Top - The count value at which the count is reset - Top must be less than or equal to the maximum possible count value which can be stored with the available bits @@ -720,7 +720,7 @@ - We often want to produce a periodically pulsating signals that has a fixed time period (Tp) - The pulsating signal is high (logic 1) for a certain portion of Tp and this time is called the on-time (Ton) - For the remainder of Tp the pulsating signal is low (logic 0) and this time is called the off-time (Toff) -\\[ T\_{p} = T\_{on} + T\_{off} \\] +\\[ T\_\text{p} = T\_\text{on} + T\_\text{off} \\] - In many application we control the duration of Ton to control the “pulse width” - These signals are known as pulse-width modulated (PWM) signals @@ -735,7 +735,7 @@ - Vsupply can be any voltage ranging from a few volts to thousands of volts - Pulsating Vsupply can be turned in to a DC signal by passing it through an analog low-pass filter - The DC signal can be controlled using Ton/Tp, which is referred to as the duty-cycle (D) -\\[ V\_{DC} = V\_{supply} \times T\_{on}/T\_{p} = D V\_{supply} \\] +\\[ V\_\text{DC} = V\_\text{supply} \times \frac{T\_\text{on}}{T\_\text{p}} = D \cdot V\_\text{supply} \\] --- name: S30 @@ -748,8 +748,8 @@ - We can use this property to set Ton of the PWM, by setting the output state of OCnA/OCnB to low when every time a compare match is achieved - The output state of OCnA/OCnB can be configured to be set to high when the count value resets - Since we have to add 1 when calculating periods, this results in a PWM output where -\\[ T\_{p} = \text{Resolution} \times \left( \text{Top} + 1 \right) = \left( \text{Top} + 1 \right) / f\_{timer\\\_clk}\\] -\\[ T\_{on} = \text{Resolution} \times \left( \text{Compare} + 1 \right) = \left( \text{Compare} + 1 \right) / f\_{timer\\\_clk}\\] +\\[ T\_\text{p} = \text{Resolution} \times \left( \text{Top} + 1 \right) = \frac{\text{Top} + 1}{f\_\mathtt{timer\\\_clk}}\\] +\\[ T\_\text{on} = \text{Resolution} \times \left( \text{Compare} + 1 \right) = \frac{\text{Compare} + 1}{f\_\mathtt{timer\\\_clk}}\\] - The compare value can be changed between 0 and Top to change the duty-cycle between 0% and 100% --- From 6e49fae5bcb7d53cbcc56be1530c8da47b19ea83 Mon Sep 17 00:00:00 2001 From: James Date: Sat, 20 Aug 2022 11:01:14 +1200 Subject: [PATCH 2/7] Create CNAME --- CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 CNAME diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..70890c1 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +209.jamesnzl.xyz \ No newline at end of file From 84cba6b1b77133aa0b45cb40b3e17b078bdcb15f Mon Sep 17 00:00:00 2001 From: James Date: Sat, 20 Aug 2022 11:02:31 +1200 Subject: [PATCH 3/7] Update CNAME --- CNAME | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CNAME b/CNAME index 70890c1..6368283 100644 --- a/CNAME +++ b/CNAME @@ -1 +1 @@ -209.jamesnzl.xyz \ No newline at end of file +cs209.jamesnzl.xyz \ No newline at end of file From 62ce3b5777a0c57a72d62e633f409b9e038899c3 Mon Sep 17 00:00:00 2001 From: James Date: Sat, 20 Aug 2022 11:21:36 +1200 Subject: [PATCH 4/7] chore: :fire: delete `CNAME` delete CNAME to avoid merging it upstream --- CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 CNAME diff --git a/CNAME b/CNAME deleted file mode 100644 index 6368283..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -cs209.jamesnzl.xyz \ No newline at end of file From 362d7d39aa7aaa51100b2ba2be263ce442ab3fa3 Mon Sep 17 00:00:00 2001 From: James Date: Sat, 20 Aug 2022 11:35:15 +1200 Subject: [PATCH 5/7] fix(AnalogL1): :speech_balloon: fix `\` character being typeset --- presentations/AnalogL1/presentation.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presentations/AnalogL1/presentation.html b/presentations/AnalogL1/presentation.html index 268b8f8..2a2982f 100644 --- a/presentations/AnalogL1/presentation.html +++ b/presentations/AnalogL1/presentation.html @@ -559,7 +559,7 @@ - At node KCL1: `\( \quad I_\text{in} - I_{1} - I_{2} = 0 \)` - From loop KVL1: `\( \quad V_\text{in} - V_{1} - V_{3} = 0 \quad \Rightarrow \quad V_\text{in} = I_{1}R_{1} + (I_{1} + I_{2})R_{3} \)` - From loop KVL2: `\( \quad V_{1} - V_{2} = 0 \quad \Rightarrow \quad I_{1}R_{1} = I_{2}R_{2} \)` -- Solving the 2 KVL equations and substituting circuit parameters we get `\( I_{1} = I_{2} = 0.5\,\text{A} \ \, \text{\&} \ \, I_{\text{in}} = 1\,\text{A} \)` +- Solving the 2 KVL equations and substituting circuit parameters we get `\( I_{1} = I_{2} = 0.5\,\text{A} \ \ \text{&} \ \ I_{\text{in}} = 1\,\text{A} \)` - Could have used a circuit transformation to combine R1 & R2 in parallel and simplified the analysis --- From 06071ef8f50243268a21656905ef59270f3c45ff Mon Sep 17 00:00:00 2001 From: James Date: Sat, 20 Aug 2022 11:55:31 +1200 Subject: [PATCH 6/7] fix(DigitalL4): :lipstick: fix slide overflow --- presentations/DigitalL4/presentation.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/presentations/DigitalL4/presentation.html b/presentations/DigitalL4/presentation.html index fd4f748..a2943a1 100644 --- a/presentations/DigitalL4/presentation.html +++ b/presentations/DigitalL4/presentation.html @@ -298,7 +298,7 @@ - Alternatively Vvf can be continuously sampled over a few periods to take samples of Vvf every 0.1ms - Need zero crossing detector to correctly align the Vif samples taken after this with the Vvf samples - From the ADC data we can estimate the AC source voltage at ith sample point since -\\[ V\_\text{AC}[i] = \frac {\mathtt{ADC0Value}[i] \times \frac{5}{1024} - V\_\text{off}} {G\_\text{vs} G\_\text{vo}} \\] +\\[ V\_\text{AC}[i] = \tfrac {\mathtt{ADC0Value}[i] \times \frac{5}{1024} - V\_\text{off}} {G\_\text{vs} G\_\text{vo}} \\] --- @@ -313,7 +313,7 @@ - Alternatively Vif can be continuously sampled over a few periods to take samples of Vif every 0.1ms - Need zero crossing detector to correctly align the Vif samples with the Vvf samples - From the ADC data we can estimate the AC load current at ith sample point since -\\[ I\_\text{L}[i] = \frac {\mathtt{ADC1Value}[i] \times \frac{5}{1024} - V\_\text{off}} {G\_\text{is} G\_\text{io}} \\] +\\[ I\_\text{L}[i] = \tfrac {\mathtt{ADC1Value}[i] \times \frac{5}{1024} - V\_\text{off}} {G\_\text{is} G\_\text{io}} \\] --- name: S6 From f6ee3f34f6624f7927b398152350e8ecd737282a Mon Sep 17 00:00:00 2001 From: James Date: Sat, 20 Aug 2022 11:59:12 +1200 Subject: [PATCH 7/7] fix(DigitalL4): :lipstick: slightly reduce image size to add bottom margin --- presentations/DigitalL4/presentation.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/presentations/DigitalL4/presentation.html b/presentations/DigitalL4/presentation.html index a2943a1..c25f92f 100644 --- a/presentations/DigitalL4/presentation.html +++ b/presentations/DigitalL4/presentation.html @@ -291,7 +291,7 @@ # ADC Data Representing Voltage -.center[] +.center[] - In this lecture, lets assume a 50Hz Vvf at ADC0 is sampled and converted to an ADC value every 2ms - Note that project specifications limits maximum sampling rate to 10kHz and therefore if repeatedly a sample of Vvf is taken followed by a sample of Vif then each Vvf sample will be 0.2ms apart @@ -306,7 +306,7 @@ # ADC Data Representing Current -.center[] +.center[] - Similar to Vvf lets assume a 50Hz Vif at ADC1 is sampled and converted to an ADC value every 2ms - Project specifications limits maximum sampling rate to 10kHz and therefore if repeatedly a sample of Vvf is taken followed by a sample of Vif then each Vif sample will be 0.2ms apart