S158 of 56
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S15 · Lesson 8 · Sensor lab

A least-squares calibration with its nonlinearity, a second-order system's step response and its parameters from a flush test, exact bridge outputs for quarter, half and full bridges, and a Steinhart–Hart thermistor fit against the simpler B model

Lessons 1 to 7 described sensors one formula at a time. Real instruments are characterized from data: a calibration run, a step test, a table of resistances. In this lab you'll write the calculations an instrument engineer runs on such data: fit a calibration line and quote its nonlinearity, find a catheter's natural frequency and damping from a flush test and check them against the step response they imply, compute exact bridge outputs, and fit a thermistor curve accurate to hundredths of a degree.

  • The curve is the step response of a second-order sensor, such as a catheter and transducer, with the natural frequency and damping ratio on the sliders.
  • Light damping rings and overshoots; the successive peaks shrink by a fixed ratio, from which a flush test reads the damping.
  • Damping near 0.7 gives the fastest response that barely overshoots.

Predict

A flush test shows each peak 0.3 times the one before, 50 ms apart. A step of pressure applied to the same system would overshoot by about

Name it

What the lab computes

  • Calibration: the least-squares line through (input, output) pairs, S=∑(x−x¯)(y−y¯)/∑(x−x¯)2 and b=y¯−Sx¯, and the nonlinearity: the largest deviation from the line as a percentage of the output span S(xmax⁡−xmin⁡).
  • Second-order dynamics: the underdamped step response 1−e−ζωnt[cos⁡ωdt+ζ1−ζ2sin⁡ωdt] with ωd=ωn1−ζ2, and from a flush test's peak ratio d and damped frequency fd: ζ=−ln⁡d/4π2+ln2⁡d, fn=fd/1−ζ2.
  • Bridges: with excitation V and fractional change x, a quarter bridge gives V[(1+x)/(2+x)−12], a half bridge with opposing arms Vx/2, and a full bridge with two pairs of opposing arms Vx.
  • Thermistors: the Steinhart–Hart equation 1/T=a+bln⁡R+c(ln⁡R)3 (T in kelvins), fitted exactly through three calibration points, against the two-parameter B model 1/T=1/T0+ln⁡(R/R0)/B.

Check

Write calibrate(xs, ys) returning (sensitivity, offset, nonlinearity in percent of span).

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write step2(fn, z, t), the underdamped step response, and flush_fit(d, fd) returning (ζ, fn) from a flush test's peak ratio and damped frequency.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write bridge(V, x, kind) for kind "quarter", "half" or "full", returning the exact output voltage.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write sh_fit(points) returning Steinhart–Hart's (a, b, c) through three (resistance, °C) points, and sh_temp(R, abc) returning °C.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Why does a least-squares calibration quote a smaller nonlinearity than a line drawn through the endpoints?