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

Sections B1.1 and B2.3 of the Robotics and Automation paper name SMPS, analog-to-digital and digital-to-analog conversion, interrupt handling and the components of a microcontroller, and the failure theories, welded joints and dynamic loading in machine design; Section A.2 names Kirchhoff's laws and network solution; the earlier chapters describe them without a worked case. A buck converter from 24 V to 5 V runs at duty cycle 0.208 with a ripple current of 0.40 A in a 100 µH inductor at 100 kHz; a 12-bit ADC on 3.3 V has a step of 0.806 mV and a signal-to-noise ratio of 74 dB; a 16 MHz microcontroller with a prescaler of 64 needs a compare value of 249 for a 1 ms interrupt; a two-mesh circuit carries 2.273 A and 0.909 A; and a 6 mm fillet weld 100 mm long carries 33.9 kN.
Overview

Switch-Mode Power Supplies: Buck and Boost Converters

1 min read

A switch-mode supply chops the input with a transistor at a high frequency and smooths it with an inductor and capacitor, wasting little power because the switch is either fully on or fully off. In a buck (step-down) converter in continuous conduction the output is V_o = D V_in, with D the duty cycle: for 24 V to 5 V, D = 5/24 = 0.208. The inductor ripple current is ΔI = (V_in − V_o) D/(L f) = 19 × 0.2083/(100 × 10⁻⁶ × 10⁵) = 0.40 A (peak-to-peak) for L = 100 µH and f = 100 kHz; the output voltage ripple with C = 100 µF is ΔV = ΔI/(8fC) = 4.95 mV. Doubling the frequency halves both: a higher f allows smaller L and C, at the cost of switching loss. For 10 W out at 90% efficiency the input power is 11.1 W. A boost (step-up) converter has V_o = V_in/(1 − D): D = 0.5 doubles 12 V to 24 V, and as D → 1 the gain grows without bound in theory (parasitics limit it). A buck–boost inverts: V_o = −V_in D/(1 − D). The flyback adds a coupled inductor for isolation. In discontinuous conduction the formulas change, and feedback (PWM controller with an error amplifier) holds V_o constant against load and input changes. Compared with a linear regulator, which wastes (V_in − V_o)I as heat, the SMPS reaches 85–95% efficiency but adds switching noise.

ConverterOutputExample
BuckV_o = D V_in24 V → 5 V, D = 0.208
BoostV_o = V_in/(1 − D)12 V → 24 V, D = 0.5
Buck–boost−V_in D/(1 − D)Inverting
Inductor ripple(V_in − V_o)D/(Lf)0.40 A

A switch-mode supply chops the input with a transistor at a high frequency and smooths it with an inductor and capacitor, wasting little power because the switch is either fully on or fully…

ADC, DAC, Timers, Baud Rates and Interrupts

1 min read

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.

QuantityFormulaValue here
12-bit ADC step, 3.3 VV_ref/2ᴺ0.806 mV
Ideal SNR6.02N + 1.7674 dB
Compare value for 1 msf/(pre × f_tick) − 1249
Baud error at UBRR = 103(actual − 9600)/96000.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

1 min read · 1 part

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.

QuantityEquationValue
Mesh 1 current6I₁ − 4I₂ = 102.2727 A
Mesh 2 current−4I₁ + 10I₂ = 00.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

2 min read · 1 part

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 stress1002.50
Tresca (maximum shear)1401.79
von Mises (distortion energy)124.92.00
Goodman fatigue, σ_a = 80, σ_m = 100S_e = 200, S_u = 5001.67
🎯 Von Mises against Tresca in pure shear
For σ = 100 MPa and τ = 50 MPa the von Mises equivalent stress is √(σ² + 3τ²) = √(10 000 + 7500) = 132 MPa. In pure shear, yielding by Tresca occurs at τ = σ_y/2 = 0.5σ_y and by von Mises at τ = σ_y/√3 = 0.577σ_y, so von Mises is the less conservative of the two by about 15%. A shaft in combined bending and torsion is checked by the equivalent moment √(M² + T²) for the maximum-shear theory and √(M² + 0.75T²) for the distortion-energy theory.

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.

  1. 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.
  2. 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.
  3. 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
  1. Each additional bit of ADC resolution improves the ideal signal-to-quantisation-noise ratio by about:

    1. 3 dB
    2. 1 dB
    3. 12 dB
    4. 6 dB
    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.
  2. 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.
  3. 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.
  4. 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.
  5. Which failure theory is the most conservative for a ductile material under biaxial stress with σ₁ > 0 > σ₂?

    1. Maximum principal stress
    2. Maximum shear stress (Tresca)
    3. Maximum strain energy
    4. Distortion energy (von Mises)
    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.
  6. 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%.
  7. 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.
  8. Which statements are correct?

    1. An interrupt service routine should be short
    2. The maximum principal stress theory is the preferred criterion for ductile metals
    3. A switch-mode supply is more efficient than a linear regulator for a large input–output difference
    4. Mesh analysis writes Kirchhoff's voltage law around independent loops
    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.
  9. 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.
  10. 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.
  11. 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.
  12. For a brittle material such as cast iron under static loading, the failure theory usually applied is the

    1. maximum principal (normal) stress theory
    2. maximum shear stress (Tresca) theory
    3. maximum strain energy theory
    4. distortion energy (von Mises) theory
    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.
  13. 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.
  14. Mesh analysis of a planar circuit writes one equation for each mesh by applying

    1. the maximum power transfer theorem
    2. Kirchhoff’s current law at each node
    3. Norton’s theorem
    4. Kirchhoff’s voltage law around the mesh
    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.
  15. 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.
  16. 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.
  17. 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.
  18. 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.
  19. 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 σ₂.
  20. 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.
  21. 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.