Embedded Electronics and Machine Design for Robotics in Numbers: Buck and Boost Converters, ADC and DAC Resolution, Timers, Baud Rates and Interrupts, Mesh Analysis, Failure Theories, Welds and Fatigue
ADC, DAC, Timers, Baud Rates and Interrupts
An N-bit ADC with reference V_ref has 2ᴺ codes and a step (LSB) of V_ref/2ᴺ: for N = 12 and V_ref = 3.3 V, LSB = 0.806 mV; an input of 1.65 V gives code 2048; the quantisation error is ±½ LSB = ±0.40 mV; and the ideal signal-to-quantisation-noise ratio of a full-scale sine is 6.02N + 1.76 = 74 dB. The sampling rate must exceed twice the highest signal frequency (Nyquist) and an anti-alias filter precedes the converter. A DAC inverts it: Vout = V_ref × code/2ᴺ; an 8-bit R-2R DAC on 5 V with code 10110010₂ = 178 gives 5 × 178/256 = 3.477 V. A microcontroller combines a CPU, flash and RAM, GPIO, timers/PWM, ADC, serial ports (UART, SPI, I²C) and an interrupt controller on one chip. Timers: with a 16 MHz clock, a prescaler of 64 and an 8-bit timer the overflow period is 64 × 256/16 × 10⁶ = 1.024 ms; for an exact 1 ms tick use compare-match mode with OCR = f_clk/(prescaler × f_tick) − 1 = 249. UART baud rate: UBRR = f_clk/(16 × baud) − 1 = 16 × 10⁶/(16 × 9600) − 1 = 103.17, rounded to 103 giving an actual baud of 9615 (error 0.16%, within the usual 2–3% tolerance). Interrupts: the CPU finishes the current instruction, saves the context, vectors to the ISR (interrupt service routine) and returns; a 12-cycle entry at 16 MHz is 0.75 µs of latency. Keep ISRs short, use volatile shared variables, and mind priorities and nesting.
| Quantity | Formula | Value here |
|---|---|---|
| 12-bit ADC step, 3.3 V | V_ref/2ᴺ | 0.806 mV |
| Ideal SNR | 6.02N + 1.76 | 74 dB |
| Compare value for 1 ms | f/(pre × f_tick) − 1 | 249 |
| Baud error at UBRR = 103 | (actual − 9600)/9600 | 0.16% |
An N-bit ADC with reference V_ref has 2ᴺ codes and a step (LSB) of V_ref/2ᴺ: for N = 12 and V_ref = 3.3 V, LSB = 0.806 mV; an input of 1.65 V gives code 2048; the quantisation error is ±½…
Kirchhoff's Laws and Network Solution
Kirchhoff's current law (KCL): the algebraic sum of currents at a node is zero; voltage law (KVL): the algebraic sum of voltage drops around any closed loop is zero. Mesh analysis writes KVL for each independent loop. Two meshes share R₂ = 4 Ω, with a 10 V source and R₁ = 2 Ω in mesh 1 and R₃ = 6 Ω in mesh 2: mesh 1: (R₁ + R₂)I₁ − R₂I₂ = 10 → 6I₁ − 4I₂ = 10; mesh 2: −R₂I₁ + (R₂ + R₃)I₂ = 0 → −4I₁ + 10I₂ = 0. The second gives I₂ = 0.4I₁; substituting, 6I₁ − 1.6I₁ = 10, so I₁ = 2.2727 A and I₂ = 0.9091 A. The current in R₂ is I₁ − I₂ = 1.3636 A, and its drop is 5.455 V; the check by node analysis (the voltage V_x at the junction: (V_x − 10)/2 + V_x/4 + V_x/6 = 0) gives V_x(1/2 + 1/4 + 1/6) = 10/2, so V_x = 5.455 V, the same as R₂'s drop. Mesh analysis is preferred when there are fewer meshes than nodes; node analysis when there are fewer nodes. Thévenin's theorem reduces everything seen from two terminals to V_th in series with R_th: For maximum power transfer the load equals R_th. Superposition applies to linear networks only, and dependent sources add a constraint equation.
| Quantity | Equation | Value |
|---|---|---|
| Mesh 1 current | 6I₁ − 4I₂ = 10 | 2.2727 A |
| Mesh 2 current | −4I₁ + 10I₂ = 0 | 0.9091 A |
| Current in R₂ | I₁ − I₂ | 1.3636 A |
| Voltage across R₂ | 4(I₁ − I₂) | 5.455 V |
Kirchhoff's current law (KCL): the algebraic sum of currents at a node is zero; voltage law (KVL): the algebraic sum of voltage drops around any closed loop is zero. Mesh analysis writes…
Failure Theories, Welded Joints and Dynamic Loading
A ductile part under a combined stress state must be checked against a failure theory, not the yield strength alone. For principal stresses σ₁ = 100 MPa, σ₂ = −40 MPa and yield strength S_y = 250 MPa: the maximum principal stress theory gives n = 250/100 = 2.50 (unsafe for ductile materials); the maximum shear stress (Tresca) theory uses σ₁ − σ₂ = 140: n = 1.79; the distortion energy (von Mises) theory uses σ′ = √(σ₁² − σ₁σ₂ + σ₂²) = 124.9 MPa: n = 2.00. Von Mises is the best fit to ductile tests and Tresca the conservative one; brittle materials use the maximum principal stress or Mohr–Coulomb. Welded joints: a transverse or parallel fillet weld of leg h has a throat of 0.707h and fails in shear on the throat: P = 0.707 h L τ_allow = 0.707 × 6 × 100 × 80 = 33.9 kN for h = 6 mm, L = 100 mm and τ = 80 MPa; eccentric loads add a torsional shear τ = Tr/J on top of the direct shear. Bolted and riveted joints are checked in shear, bearing and tension of the plate. Dynamic loading: for fully reversed or fluctuating stress the endurance limit S_e (about 0.5 S_u for steel, reduced by surface, size and reliability factors) governs. With σ_a = 80 MPa and σ_m = 100 MPa, S_e = 200 MPa and S_u = 500 MPa the Goodman line gives 1/n = σ_a/S_e + σ_m/S_u = 0.4 + 0.2, so n = 1.67; the more conservative Soderberg line with S_y = 300 gives 1.36. Stress concentrations (K_t) multiply the alternating stress and are the usual fatigue origin; shot-peening and good fillets help.
| Theory (σ₁ = 100, σ₂ = −40, S_y = 250) | Equivalent stress (MPa) | Factor of safety |
|---|---|---|
| Maximum principal stress | 100 | 2.50 |
| Tresca (maximum shear) | 140 | 1.79 |
| von Mises (distortion energy) | 124.9 | 2.00 |
| Goodman fatigue, σ_a = 80, σ_m = 100 | S_e = 200, S_u = 500 | 1.67 |
A ductile part under a combined stress state must be checked against a failure theory, not the yield strength alone. For principal stresses σ₁ = 100 MPa, σ₂ = −40 MPa and yield strength S_y…
Key takeaways
- Buck: V_o = D V_in and ΔI = (V_in − V_o)D/(Lf); boost: V_o = V_in/(1 − D); SMPS efficiency is 85–95%, far above a linear regulator.
- An N-bit ADC has step V_ref/2ᴺ and ideal SNR 6.02N + 1.76 dB; timer compare value = f_clk/(prescaler × f_tick) − 1; UBRR = f_clk/(16 × baud) − 1.
- Mesh analysis writes KVL per loop; node analysis writes KCL per node; use whichever gives fewer equations.
- Failure theories: Tresca uses σ₁ − σ₃, von Mises uses √(σ₁² − σ₁σ₂ + σ₂²); von Mises fits ductile data best.
- Fillet weld strength = 0.707 h L τ; the Goodman line gives 1/n = σ_a/S_e + σ_m/S_u.
Practice questions (24)
Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.
A buck converter steps 24 V down to 5 V in continuous conduction. The duty cycle (three decimals) is:
Numerical answer — type the value.
Show answer
Answer: 0.208
V_o = D V_in, so D = 5/24 = 0.208. A boost converter would use D = 1 − V_in/V_o.The peak-to-peak inductor ripple current of a buck converter (24 V in, 5 V out, D = 0.2083, L = 100 µH, f = 100 kHz) in amperes (two decimals) is:
Numerical answer — type the value.
Show answer
Answer: 0.40
ΔI = (V_in − V_o)D/(Lf) = 19 × 0.2083/(100 × 10⁻⁶ × 10⁵) = 3.958/10 = 0.396 A. Doubling L or f would halve it.A 12-bit ADC with a 3.3 V reference has a step size (LSB) in millivolts (three decimals) of:
Numerical answer — type the value.
Show answer
Answer: 0.806
LSB = 3.3/4096 = 0.806 mV. Dividing by 4095 (the number of steps) would give a negligible difference; the quantisation error is half this.
Show the other 21 questions
Each additional bit of ADC resolution improves the ideal signal-to-quantisation-noise ratio by about:
Show answer
Answer: D — 6 dB
SNR = 6.02N + 1.76 dB, so each bit halves the step and adds 20 log₁₀ 2 = 6.02 dB.A microcontroller with a 16 MHz clock and a timer prescaler of 64 is set for a 1 ms periodic interrupt in compare-match mode. The OCR value is:
Numerical answer — type the value.
Show answer
Answer: 249
Timer clock = 16 MHz/64 = 250 kHz, so 1 ms is 250 counts; the register is loaded with 250 − 1 = 249 because counting starts from zero.A two-mesh circuit obeys 6I₁ − 4I₂ = 10 and −4I₁ + 10I₂ = 0 (amperes). The current I₁ (four decimals) is:
Numerical answer — type the value.
Show answer
Answer: 2.2727
From the second equation I₂ = 0.4I₁; then 6I₁ − 1.6I₁ = 10, so I₁ = 10/4.4 = 2.2727 A and I₂ = 0.9091 A.The principal stresses are σ₁ = 100 MPa and σ₂ = −40 MPa with yield strength 250 MPa. The factor of safety by the von Mises theory (two decimals) is:
Numerical answer — type the value.
Show answer
Answer: 2.00
σ′ = √(100² + 100 × 40 + 40²) = √15 600 = 124.9 MPa; n = 250/124.9 = 2.00. Tresca gives 1.79, lower and so more conservative.Which failure theory is the most conservative for a ductile material under biaxial stress with σ₁ > 0 > σ₂?
Show answer
Answer: B — Maximum shear stress (Tresca)
Tresca's equivalent stress σ₁ − σ₂ = 140 exceeds von Mises' 124.9 and the principal stress 100 for this state, so its factor of safety is smallest of the three for ductile yielding.A single parallel fillet weld with a 6 mm leg, a length of 100 mm and an allowable shear stress of 80 MPa on the throat (0.707h) carries a load in kN (one decimal) of:
Numerical answer — type the value.
Show answer
Answer: 33.9
P = 0.707 × 6 × 100 × 80 = 33 936 N = 33.9 kN. Using the leg length instead of the throat would overstate the strength by 41%.A shaft has σ_a = 80 MPa, σ_m = 100 MPa, endurance limit 200 MPa and ultimate strength 500 MPa. The Goodman factor of safety (two decimals) is:
Numerical answer — type the value.
Show answer
Answer: 1.67
1/n = 80/200 + 100/500 = 0.4 + 0.2 = 0.6, so n = 1.67. Using the Soderberg line with S_y = 300 gives 1.36, more conservative.Which statements are correct?
Show answer
Answer: A — An interrupt service routine should be short; C — A switch-mode supply is more efficient than a linear regulator for a large input–output difference; D — Mesh analysis writes Kirchhoff's voltage law around independent loops
Von Mises (or Tresca) is the preferred criterion for ductile metals; the maximum principal stress theory suits brittle materials. The other three statements are standard.A 10 V source drives 2 Ω and 3 Ω resistors in a single series loop. The loop current, in A, is ____.
Numerical answer — type the value.
Show answer
Answer: 2
KVL: 10 = (2 + 3)I, so I = 2 A. The tempting 8.33 A uses the parallel combination 1.2 Ω. Substituting the answer back into the relation confirms it.A 10-bit ADC has a 5 V reference and output code = floor(V_in/V_ref × 1024). The code for an input of 2.5 V is ____.
Numerical answer — type the value.
Show answer
Answer: 512
2.5/5 × 1024 = 512, the mid-scale code. The tempting 511 uses 1023 steps (2.5/5 × 1023 = 511.5, truncated). Substituting the answer back into the relation confirms it.An ideal boost converter in continuous conduction has 5 V input and a duty cycle of 0.6. Its output voltage, in V, is ____.
Numerical answer — type the value.
Show answer
Answer: 12.5
V_o = V_in/(1 − D) = 5/0.4 = 12.5 V. The tempting 8.33 V uses 1/D. Substituting the answer back into the relation confirms it.For a brittle material such as cast iron under static loading, the failure theory usually applied is the
Show answer
Answer: A — maximum principal (normal) stress theory
Brittle materials fail by separation when the largest normal stress reaches the ultimate strength (Rankine). Tresca and von Mises, the tempting choices, model yielding of ductile metals.A component has yield strength 250 MPa and a working stress of 100 MPa. Its factor of safety is ____.
Numerical answer — type the value.
Show answer
Answer: 2.5
FOS = 250/100 = 2.5. The tempting 0.4 inverts the ratio; a factor of safety below 1 would mean failure. Substituting the answer back into the relation confirms it.Mesh analysis of a planar circuit writes one equation for each mesh by applying
Show answer
Answer: D — Kirchhoff’s voltage law around the mesh
Mesh currents are the unknowns and KVL around each mesh supplies the equations. KCL at nodes, the tempting choice, is the basis of nodal analysis.A two-mesh circuit obeys 3I₁ − I₂ = 5 and −I₁ + 2I₂ = 0 (amperes). The mesh current I₂, in A, is ____.
Numerical answer — type the value.
Show answer
Answer: 1
From the second equation I₁ = 2I₂; then 6I₂ − I₂ = 5 gives I₂ = 1 A (I₁ = 2 A). The tempting 2 reports I₁. Substituting the answer back into the relation confirms it.A 16 MHz timer with prescaler 8 runs in clear-on-compare mode and toggles nothing else; the compare value N gives a period of (N + 1) ticks. For a 1 kHz interrupt rate, N is ____.
Numerical answer — type the value.
Show answer
Answer: 1999
16 MHz/8 = 2 MHz, so 2000 ticks per ms and N = 2000 − 1 = 1999. The tempting 2000 forgets that counting from 0 to N takes N + 1 ticks.A shaft surface is in pure shear of 50 MPa. Its von Mises equivalent stress, in MPa to one decimal place, is ____.
Numerical answer — type the value.
Show answer
Answer: 86.6
σ_vm = √(σ² + 3τ²) = √3 × 50 = 86.6 MPa. The tempting 100 MPa is the Tresca equivalent 2τ. Substituting the answer back into the relation confirms it.A buck converter steps 12 V down to 5 V at 100 kHz in continuous conduction. The inductance that limits the peak-to-peak inductor ripple to 0.5 A, in µH to one decimal place, is ____.
Numerical answer — type the value.
Show answer
Answer: 58.3
D = 5/12, so L = (V_in − V_o)D/(fΔI) = 7 × 0.4167/(10⁵ × 0.5) = 58.3 µH. The tempting 140 µH uses V_in − V_o without the duty cycle.A ductile part (yield strength 300 MPa) has plane principal stresses σ₁ = 120 MPa and σ₂ = −60 MPa. By the von Mises theory, its factor of safety, to two decimal places, is ____.
Numerical answer — type the value.
Show answer
Answer: 1.89
σ_vm = √(σ₁² − σ₁σ₂ + σ₂²) = √(14 400 + 7200 + 3600) = 158.7 MPa, so FOS = 300/158.7 = 1.89. The tempting 2.5 uses σ₁ alone (300/120), ignoring the opposite-sign σ₂.A three-mesh circuit obeys 10I₁ − 2I₂ = 12, −2I₁ + 8I₂ − 3I₃ = 0 and −3I₂ + 9I₃ = 6 (amperes). The middle mesh current I₂, in A to two decimal places, is ____.
Numerical answer — type the value.
Show answer
Answer: 0.67
Substituting I₁ = (12 + 2I₂)/10 and I₃ = (6 + 3I₂)/9 into the middle equation gives 6.6I₂ = 4.4, so I₂ = 0.67 A (I₁ = 1.33 A, I₃ = 0.89 A). The tempting 0 assumes the middle mesh, having no source, carries no current.A successive-approximation ADC is clocked at 125 kHz and needs 13 ADC clock cycles per conversion. The maximum conversion rate, in samples per second to the nearest integer, is ____.
Numerical answer — type the value.
Show answer
Answer: 9615
Conversion time = 13/125 kHz = 104 µs, so the rate is 9615 samples/s. The tempting 12 500 assumes one cycle per bit for 10 bits.