---
title: Current and heating lab
heading: Resistance by integration, battery and sensor fits, and a wire that heats itself
eyebrow: B4 · Lesson 14 · Current and heating lab
xp: 50
---

::: hook
The formula $R = \frac{\rho L}{A}$ needs a uniform conductor, and real ones taper, spread into the ground, or heat up and change their own resistance. Measurements need fitting: a battery's EMF and internal resistance come from a line through noisy points, and a thermistor's β from two readings. In this lab you'll compute resistance by adding thin slices, fit a battery and a thermistor, and find the current at which a wire's heating runs away, because hotter copper resists more and so heats faster still.
:::

::: play
- A bare copper wire in still air carries a current. The curve is how far its temperature rises, counting that copper's resistance grows 0.39% per degree.
- Raise the current: the rise grows faster than $I^2$, and at the runaway current in the readout it grows without limit. Above that, no steady temperature exists until something melts.
- Thicken the wire or improve the cooling, and the runaway current rises as $d^{3/2}$ and $\sqrt h$.
:::

```sim plot
view: graph
x: I = 0..80 A
y: T = 0..150 °C
slider: d = 1..3 step 0.1 = 1.5 mm
slider: h = 5..50 step 1 = 15 W/m²·K
plot: step(1 - 0.0039*I^2*1.72e-8/(pi*(d/2000)^2*h*pi*d/1000))*(I^2*1.72e-8/(pi*(d/2000)^2*h*pi*d/1000))*1.0195/(1 - 0.0039*I^2*1.72e-8/(pi*(d/2000)^2*h*pi*d/1000) + 1e-9) | label: temperature rise | samples: 800
readout: runaway current, A = sqrt(pi*(d/2000)^2*h*pi*d/1000/(1.72e-8*0.0039)) | digits: 3
```

::: predict
## A copper wire's temperature rise at 15 A works out to 31 °C if its resistance stayed fixed at its 20 °C value. Counting that copper's resistance rises with temperature, what is the actual rise?

- [ ] 31 °C exactly
- [x] About 36 °C
- [ ] About 62 °C
- [ ] It can't settle at all

::: reveal
About 36 °C. The warmer wire resists more and so heats more, which warms it further, but at 15 A each round of feedback is smaller than the last, so it settles: 35.9 °C for a 1.5 mm wire with h = 15 W/m²·K, starting in 25 °C air. The feedback only diverges above about 43 A, the runaway current.
:::
:::

::: nameit
## Resistance by slices

When the cross-section changes along a conductor, add thin slices in series: $R = \int\frac{\rho\,dx}{A(x)}$. When current spreads out from an electrode, add thin shells: for a hemisphere of radius a in soil, $R = \int_a^\infty\frac{\rho\,dr}{2\pi r^2} = \frac{\rho}{2\pi a}$, and 90% of it lies within 10a, so the soil close to the electrode decides its resistance.

## Fitting a line

A battery's terminal voltage falls as $V = \mathcal E - Ir$. Measured at several currents, the points scatter, and **least squares** finds the line that minimizes the sum of squared misses: the intercept is $\mathcal E$ and minus the slope is r.

## Thermistors

An NTC thermistor follows $R = R_{25}\exp\left[\beta\left(\frac1T - \frac{1}{298.15}\right)\right]$ with T in kelvin. Two readings give $\beta = \frac{\ln(R_1/R_2)}{1/T_1 - 1/T_2}$, and inverting gives $\frac1T = \frac{1}{298.15} + \frac{\ln(R/R_{25})}{\beta}$.

## Self-heating and runaway

A wire making $I^2\frac{\rho}{A}$ per meter and losing $h\pi d\,\Delta T$ settles where they balance. With $\rho = \rho_0(1 + \alpha(T - 20))$ the balance is still linear in T, so the steady rise is

$$\Delta T = \frac{K\,(1 + \alpha(T_a - 20))}{1 - \alpha K}, \qquad K = \frac{I^2\rho_0}{Ah\pi d},$$

which blows up as $\alpha K \to 1$, at the runaway current $I = \sqrt{\frac{Ah\pi d}{\rho_0\alpha}}$. Fixed-point iteration, $T \leftarrow T_a + \text{heating}(T)/\text{cooling}$, converges below runaway and diverges above it.
:::

::: example
## A carbon cone 5 cm long tapers from 1 mm to 3 mm in radius (ρ = 0.01 Ω·m). What is its resistance, and what would a rod of the average radius give?

::: solution
1. **The cone.**
   $$\begin{aligned} R &= \frac{\rho L}{\pi ab} \\ &= \frac{0.01 \times 0.05}{\pi \times 0.001 \times 0.003} \\ &= 53.1\ \Omega \end{aligned}$$
2. **A rod of the average radius.** The average radius is 2 mm:
   $$\begin{aligned} R &= \frac{0.01 \times 0.05}{\pi \times 0.002^2} \\ &= 39.8\ \Omega \end{aligned}$$
   25% low.
3. **Why the narrow end dominates.** Resistance goes as $\frac{1}{r^2}$, so each millimeter near the 1 mm end resists nine times more than one near the 3 mm end.

**Answer:** the cone has 53.1 Ω, and a rod of the average radius would give 39.8 Ω, 25% low.
:::
:::

::: example
## A battery reads 12.62, 12.41, 12.18, 11.99 and 11.77 V at 0, 0.5, 1, 1.5 and 2 A. What are its EMF and internal resistance?

::: solution
1. **Fit a line.** The least-squares line through these points has intercept 12.618 V and slope −0.424 V/A.
2. **Read off the battery.** So $\mathcal E$ = 12.62 V and $r$ = 0.424 Ω.
3. **Loss at 2 A.** That internal resistance wastes 1.7 W inside the battery.
4. **Why fit all five.** Two points would also give a line, but fitting all five averages out the reading errors, which is why battery testers step through several loads.

**Answer:** the EMF is 12.62 V and the internal resistance is 0.424 Ω.
:::
:::

::: example
## A 10 kΩ thermistor reads 32.65 kΩ in ice water and 680 Ω in boiling water. What is its β, and what temperature does 3.588 kΩ mean?

::: solution
1. **β from the two readings.**
   $$\begin{aligned} \beta &= \frac{\ln(32\,650/680)}{1/273.15 - 1/373.15} \\ &= \frac{3.872}{0.000981} \\ &= 3946\ \text{K} \end{aligned}$$
2. **Temperature for 3.588 kΩ.** Using the nominal β of 3950:
   $$\begin{aligned} \frac1T &= \frac{1}{298.15} + \frac{\ln 0.3588}{3950} \\ &= 0.0030945 \end{aligned}$$
   so T = 323.15 K, which is 50.0 °C.
3. **How good the model is.** The β model is good to about a degree over 0 to 100 °C; for better accuracy, three readings fit the three-term Steinhart–Hart equation.

**Answer:** β is 3946 K, and 3.588 kΩ means 50.0 °C.
:::
:::

::: check
kind: python

## Step 1. Write `cone_R(rho, L, a, b, n)` that adds n midpoint slices of a cone tapering from radius a to radius b over length L, and `spread_R(rho, a, r, n)` that adds n hemispherical shells, evenly spaced in ln r, from radius a out to r.

```python starter
import numpy as np
import math

def cone_R(rho, L, a, b, n):
    return rho * L / (math.pi * ((a + b) / 2)**2)

def spread_R(rho, a, r, n):
    return rho / (2 * math.pi * a)

print(cone_R(0.01, 0.05, 0.001, 0.003, 1000), spread_R(100, 0.5, 5, 2000))
```

```python solution
import numpy as np
import math

def cone_R(rho, L, a, b, n):
    dx = L / n
    x = (np.arange(n) + 0.5) * dx
    r = a + (b - a) * x / L
    return float(np.sum(rho * dx / (np.pi * r**2)))

def spread_R(rho, a, r, n):
    s = np.linspace(math.log(a), math.log(r), n + 1)
    sm = (s[1:] + s[:-1]) / 2
    rr = np.exp(sm)
    return float(np.sum(rho / (2 * np.pi * rr**2) * rr * (s[1] - s[0])))

print(cone_R(0.01, 0.05, 0.001, 0.003, 1000), spread_R(100, 0.5, 5, 2000))
```

```python tests
import math
c = cone_R(0.01, 0.05, 0.001, 0.003, 1000)
assert abs(c - 0.01 * 0.05 / (math.pi * 0.001 * 0.003)) < 1e-4, f"The cone measures ρL/(πab) = 53.05 Ω; got {c:.4f}."
s = spread_R(100, 0.5, 5, 2000)
assert abs(s - 100 / (2 * math.pi) * (1 / 0.5 - 1 / 5)) < 1e-4, f"Out to 10a the shells add to 28.65 Ω; got {s:.4f}."
assert abs(s / (100 / (2 * math.pi * 0.5)) - 0.9) < 1e-6, "Within 10a lies 90% of the electrode's resistance."
```

::: right
Right. Both are integrals of $\frac{\rho\,dx}{A}$ along the current's path; only the shape of A changes.
:::
:::

::: check
kind: python

## Step 2. Write `fit_battery(I, V)` that fits $V = \mathcal E - Ir$ to measured arrays by least squares with `np.linalg.lstsq`, returning `(emf, r)`.

```python starter
import numpy as np

def fit_battery(I, V):
    return float(V[0]), 0.0

I = np.array([0.0, 0.5, 1.0, 1.5, 2.0])
V = np.array([12.62, 12.41, 12.18, 11.99, 11.77])
print(fit_battery(I, V))
```

```python solution
import numpy as np

def fit_battery(I, V):
    A = np.vstack([np.ones_like(I), -I]).T
    emf, r = np.linalg.lstsq(A, V, rcond=None)[0]
    return float(emf), float(r)

I = np.array([0.0, 0.5, 1.0, 1.5, 2.0])
V = np.array([12.62, 12.41, 12.18, 11.99, 11.77])
print(fit_battery(I, V))
```

```python tests
import numpy as np
E, r = fit_battery(np.array([0.0, 0.5, 1.0, 1.5, 2.0]), np.array([12.62, 12.41, 12.18, 11.99, 11.77]))
assert abs(E - 12.618) < 1e-9 and abs(r - 0.424) < 1e-9, f"The fit gives 12.618 V and 0.424 Ω; got {E:.4f} and {r:.4f}."
E2, r2 = fit_battery(np.array([0.1, 0.4, 0.8]), np.array([3.68, 3.62, 3.54]))
assert abs(E2 - 3.7) < 1e-9 and abs(r2 - 0.2) < 1e-9, "Points exactly on a line give it back exactly."
```

::: right
Right. Least squares weighs every reading, so a single misread voltage moves the answer far less than it would in a two-point estimate.
:::
:::

::: check
kind: python

## Step 3. Write `fit_beta(T1, R1, T2, R2)` returning β from two readings (temperatures in °C), and `therm_T(R, R25, beta)` returning the temperature in °C for a reading R.

```python starter
import math

def fit_beta(T1, R1, T2, R2):
    return 3950.0

def therm_T(R, R25, beta):
    return 25.0

print(fit_beta(0, 32650, 100, 680), therm_T(3588, 10000, 3950))
```

```python solution
import math

def fit_beta(T1, R1, T2, R2):
    return math.log(R1 / R2) / (1 / (T1 + 273.15) - 1 / (T2 + 273.15))

def therm_T(R, R25, beta):
    return 1 / (1 / 298.15 + math.log(R / R25) / beta) - 273.15

print(fit_beta(0, 32650, 100, 680), therm_T(3588, 10000, 3950))
```

```python tests
b = fit_beta(0, 32650, 100, 680)
assert abs(b - 3946.07) < 0.01, f"The two readings give β = 3946.1 K; got {b:.2f}."
assert abs(therm_T(10000, 10000, 3950) - 25) < 1e-9, "At its rated resistance a thermistor reads 25 °C."
assert abs(therm_T(3588, 10000, 3950) - 50.0013) < 1e-3, f"3.588 kΩ means 50.0 °C; got {therm_T(3588, 10000, 3950):.4f}."
```

::: right
Right. Working in kelvin is essential: the β model is exponential in $\frac1T$, and Celsius would put a division by zero at the freezing point.
:::
:::

::: check
kind: python

## Step 4. Write `wire_T(I, d, h, Ta, n)` that finds a bare copper wire's steady temperature by fixed-point iteration, n times: $T \leftarrow T_a + \frac{I^2\rho_0(1 + \alpha(T - 20))}{Ah\pi d}$, with $\rho_0$ = 1.72 × 10⁻⁸ Ω·m and α = 0.0039 /°C. Also write `runaway_I(d, h)` returning the current at which the iteration stops converging.

```python starter
import math

def wire_T(I, d, h, Ta, n=200):
    A = math.pi * (d / 2)**2
    return Ta + I**2 * 1.72e-8 / (A * h * math.pi * d)

def runaway_I(d, h):
    return float('inf')

print(wire_T(15, 0.0015, 15, 25), runaway_I(0.0015, 15))
```

```python solution
import math

def wire_T(I, d, h, Ta, n=200):
    A = math.pi * (d / 2)**2
    T = Ta
    for _ in range(n):
        T = Ta + I**2 * 1.72e-8 * (1 + 0.0039 * (T - 20)) / (A * h * math.pi * d)
    return T

def runaway_I(d, h):
    A = math.pi * (d / 2)**2
    return math.sqrt(A * h * math.pi * d / (1.72e-8 * 0.0039))

print(wire_T(15, 0.0015, 15, 25), runaway_I(0.0015, 15))
```

```python tests
import math
T = wire_T(15, 0.0015, 15, 25)
assert abs(T - 60.9269) < 1e-3, f"At 15 A the wire settles at 60.93 °C, 35.9 °C above the air; got {T:.4f}."
I = runaway_I(0.0015, 15)
assert abs(I - 43.152) < 1e-2, f"The runaway current is 43.15 A; got {I:.3f}."
assert wire_T(0.8 * I, 0.0015, 15, 25, 2000) < 1000 < wire_T(1.1 * I, 0.0015, 15, 25, 200), "Below runaway the iteration settles; above it, it climbs without limit."
```

::: right
Right. At 15 A the feedback adds about 5 °C to the fixed-resistance answer. At 90% of the runaway current it multiplies the rise by $\frac{1}{1 - 0.81} = 5.3$, which would carry this wire past copper's melting point: a warning against running conductors near their limit.
:::
:::

::: check
kind: parts
given: rho = 50 | 200; a = 0.3 | 1; r = 3 | 5

## A hemispherical ground electrode of radius {a} m sits in {rho} Ω·m soil.

::: part
answer: rho/(2*pi*a)
unit: Ω
tolerance: 0.5%

### What is its resistance to remote earth?

::: misses
- [rho/(4*pi*a)] That's a full sphere buried deep; a hemisphere has only half the area to spread into.
- [any] $R = \frac{\rho}{2\pi a}$.
:::
:::

::: part
answer: (1 - 1/r)*100
unit: %
tolerance: 0.5%

### What percentage of that lies within {r} times its radius?

::: misses
- [any] $\frac{\rho}{2\pi}\left(\frac1a - \frac{1}{ra}\right)$ over the total.
:::
:::
:::

::: check
given: d = 1 | 2 | 4; h = 10 | 30
answer: sqrt(pi*(d/2000)^2*h*pi*d/1000/(1.72e-8*0.0039))
unit: A
tolerance: 0.5%

## What is the runaway current of a bare copper wire {d} mm across, cooled at h = {h} W/m²·K?

::: right
Right. $\sqrt{\frac{Ah\pi d}{\rho_0\alpha}}$, growing as $d^{3/2}$: area for current grows as $d^2$, surface for cooling only as d.
:::

::: misses
- [sqrt(pi*(d/2000)^2*h*pi*d/1000/1.72e-8)] Include the temperature coefficient: runaway happens where $\alpha K = 1$.
- [any] Set $\alpha K = 1$.
:::
:::

::: explain
## Why does a wire with a positive temperature coefficient have a runaway current, while one with a constant resistance doesn't?

::: model
With a constant resistance the heat made grows as $I^2$ but doesn't depend on temperature, while the heat lost grows in proportion to the temperature rise, so for any current the wire finds a temperature where they balance. When resistance rises with temperature, a warmer wire makes more heat, so the heating line also tilts upward with temperature. As long as its slope is less than the cooling line's, they still cross and the wire settles. At the runaway current the two slopes become equal: each degree of warming adds as much heat as it carries away, so no balance exists and the temperature climbs until something gives way.
:::
:::

::: practice

::: check
given: rho = 0.005 | 0.02; L = 2 | 8; a = 0.5 | 1; b = 2 | 4
answer: rho*(L/100)/(pi*(a/1000)*(b/1000))
unit: Ω
tolerance: 0.5%

## Resistance of a {L} cm cone tapering from {a} mm to {b} mm, ρ = {rho} Ω·m?

::: misses
- [any] $\frac{\rho L}{\pi ab}$.
:::
:::

::: check
given: R = 2000 | 20000; b = 3435 | 3950
answer: 1/(1/298.15 + ln(R/10000)/b) - 273.15
unit: °C
tolerance: 0.5%

## A 10 kΩ thermistor with β = {b} K reads {R} Ω. What temperature is that?

::: misses
- [any] $\frac1T = \frac{1}{298.15} + \frac{\ln(R/R_{25})}{\beta}$, in kelvin.
:::
:::
:::
