---
title: "Capstone: a weather-balloon radio link"
heading: Planning the downlink from a high-altitude balloon, the radio horizon that grows with altitude, a free-space link budget from a 25 mW transmitter to a ground station's Yagi, the margin to keep, and finding whether the horizon or the power budget limits the range, checked in Python
eyebrow: D9 · Lesson 9 · Capstone
xp: 80
---

::: hook
Hobbyists and schools launch weather balloons that climb to 30 km with a small tracker sending its position on 433 MHz. The question before launch is how far away the ground station can still hear it. Two things could stop the link: the curve of the Earth, which hides the balloon below the horizon, and the power budget, which runs out when the signal falls below the receiver's sensitivity. This capstone works out both, with the radio horizon of the troposphere and the Friis equation of lesson 3, and decides which one wins.
:::

::: play
- The received power at a ground station from a balloon at altitude h, against ground distance: 14 dBm into a 2.15 dBi dipole, received on a 9 dBi Yagi at 433 MHz (slant range taken as √(d² + h²)).
- The dashed line is the receiver's −130 dBm sensitivity plus a 10 dB margin; the marker is the radio horizon for the balloon's altitude and a 10 m mast.
- At 30 km the horizon comes first: the power budget would reach further than the Earth's curve allows.
:::

```sim plot
view: graph
x: d = 1..2000 log
y: P = -140..-40
slider: h = 1..40 step 0.5 = 30
slider: p = 0..30 step 1 = 14
plot: p + 2.15 + 9 - 20*log(4*pi*sqrt((d*1000)^2 + (h*1000)^2)*433e6/299792458) | samples: 400 | label: received power, dBm (d in km, h in km)
plot: -120 + 0*d | dashed | color: ch3 | label: sensitivity plus margin
marker: x = (sqrt(2*4/3*6371e3*h*1000) + sqrt(2*4/3*6371e3*10))/1000 | label: radio horizon
readout: radio horizon, km = (sqrt(2*4/3*6371e3*h*1000) + sqrt(2*4/3*6371e3*10))/1000 | digits: 4
readout: power-limited range, km = 299792458/433e6/(4*pi)*10^((p + 2.15 + 9 + 120)/20)/1000 | digits: 4
```

::: predict
## A balloon at 30 km sends to a ground station with a 10 m mast. Taking radio waves' gentle bending into account, about how far is the radio horizon?

- [ ] 30 km
- [ ] About 200 km
- [x] About 727 km
- [ ] About 7000 km

::: reveal
Each antenna sees to $\sqrt{2kR_Eh}$ with the effective Earth radius $kR_E$ = (4/3) × 6371 km: √(2 × 8495 km × 30 km) = 714 km from the balloon and √(2 × 8495 km × 0.01 km) = 13 km from the mast, 727 km in all. The 25 mW link budget alone would reach 997 km with 10 dB to spare, so the horizon sets the limit.
:::
:::

::: nameit
## The radio horizon

The atmosphere's density falls with height, which bends radio waves slightly back toward the ground. The standard correction treats the Earth as $k$ = 4/3 times its real size, so an antenna at height h sees to

$$d \approx \sqrt{2kR_Eh}$$

and two antennas see each other out to the sum of their horizons. At 30 km that's 714 km; at 1 km only 130 km.

## The budget

From lesson 3, $P_r = P_t + G_t + G_r - 20\log_{10}(4\pi r/\lambda)$, and the link closes with margin M while $P_r \ge S_\min + M$. Solving for the range,

$$r_\text{power} = \frac{\lambda}{4\pi}10^{(P_t + G_t + G_r - S_\min - M)/20}$$

## Which limit wins

The link's reach is the smaller of the radio horizon and the power-limited range. A high balloon is usually horizon-limited; a low one, or a weak transmitter, power-limited. One catch: a vertical dipole has a null straight up, so the signal fades when the balloon is nearly overhead, the closest it ever gets.
:::

::: example
## At 100 km slant range, what does the ground station receive? What's the power-limited range?

::: solution
1. **Wavelength.**
   $$\lambda = 0.692\ \text{m}$$
2. **Path loss.**
   $$\begin{aligned} L &= 20\log_{10}\frac{4\pi \times 10^5}{0.692} \\ &= 125.2\ \text{dB} \end{aligned}$$
3. **Received power.**
   $$\begin{aligned} P_r &= 14 + 2.15 + 9 - L \\ &= -100.0\ \text{dBm} \end{aligned}$$
4. **Path loss the budget allows.**
   $$\begin{aligned} L_\text{max} &= 14 + 2.15 + 9 \\ &\quad + 130 - 10 \\ &= 145.15\ \text{dB} \end{aligned}$$
5. **Power-limited range.** That loss is reached at
   $$\begin{aligned} r &= \frac{\lambda}{4\pi}\,10^{145.15/20} \\ &= 997\ \text{km} \end{aligned}$$

**Answer:** the ground station receives −100.0 dBm at 100 km, and the power-limited range is 997 km.
:::
:::

::: example
## What if the balloon transmitted 0 dBm from an isotropic antenna to a 2.15 dBi ground antenna with a −120 dBm receiver?

::: solution
1. **The budget.**
   $$\begin{aligned} L_\text{max} &= 0 + 0 + 2.15 \\ &\quad + 120 - 10 \\ &= 112.15\ \text{dB} \end{aligned}$$
2. **Where it runs out.**
   $$\begin{aligned} r &= \frac{0.692}{4\pi}\,10^{112.15/20}\ \text{m} \\ &= 22.3\ \text{km} \end{aligned}$$
3. **Which limit wins.** Now power limits the link long before the 727 km horizon.

**Answer:** the link runs out at 22.3 km, limited by power.
:::
:::

::: example
## What does the ground station receive from the balloon at 500 km, and what margin is left over the −130 dBm sensitivity?

::: solution
1. **Path loss.**
   $$\begin{aligned} L &= 20\log_{10}\frac{4\pi \times 5 \times 10^5}{0.692} \\ &= 139.2\ \text{dB} \end{aligned}$$
2. **Received power.**
   $$\begin{aligned} P_r &= 14 + 2.15 + 9 - L \\ &= -114.0\ \text{dBm} \end{aligned}$$
3. **Margin.**
   $$-114.0 + 130 = 16\ \text{dB}$$
   That's 6 dB more than the planned 10 dB margin.
4. **What sets the limit.** At that range the horizon decides, since the power budget still has room.

**Answer:** the ground station receives −114.0 dBm, 16 dB above the sensitivity.
:::
:::

::: check
kind: python

## Compute the radio horizon and the power budget, and decide which limits the link.

```python starter
import numpy as np

RE = 6371e3      # Earth's radius, m
K = 4/3          # standard refraction: radio sees an Earth 4/3 as large

def horizon(h1, h2):
    # Radio horizon in meters between antennas at heights h1 and h2 (m): the sum of
    # sqrt(2*K*RE*h) for each.
    return 0.0

def received_dbm(pt_dbm, gt_dbi, gr_dbi, f_hz, r_m):
    # Friis in decibels: Pt + Gt + Gr - 20*log10(4*pi*r/lambda).
    return pt_dbm

def power_range(pt_dbm, gt_dbi, gr_dbi, f_hz, smin_dbm, margin_db):
    # The free-space range (m) at which the received power equals smin + margin.
    return 0.0

def link_range(alt, h_ground, pt_dbm, gt_dbi, gr_dbi, f_hz, smin_dbm, margin_db):
    # The link's reach in meters: the smaller of the radio horizon and the power-limited range,
    # and which one limits it, as ("horizon" or "power", range).
    return ("power", 0.0)
```

```python solution
import numpy as np

RE = 6371e3
K = 4/3

def horizon(h1, h2):
    return np.sqrt(2*K*RE*h1) + np.sqrt(2*K*RE*h2)

def received_dbm(pt_dbm, gt_dbi, gr_dbi, f_hz, r_m):
    lam = 299792458/f_hz
    return pt_dbm + gt_dbi + gr_dbi - 20*np.log10(4*np.pi*r_m/lam)

def power_range(pt_dbm, gt_dbi, gr_dbi, f_hz, smin_dbm, margin_db):
    lam = 299792458/f_hz
    budget = pt_dbm + gt_dbi + gr_dbi - smin_dbm - margin_db
    return lam/(4*np.pi)*10**(budget/20)

def link_range(alt, h_ground, pt_dbm, gt_dbi, gr_dbi, f_hz, smin_dbm, margin_db):
    hz = horizon(alt, h_ground)
    pw = power_range(pt_dbm, gt_dbi, gr_dbi, f_hz, smin_dbm, margin_db)
    return ("horizon", hz) if hz < pw else ("power", pw)
```

```python tests
assert abs(horizon(30000, 10) - 726953) < 50, f"From 30 km up to a 10 m mast the radio horizon is 727 km; got {horizon(30000, 10)/1000:.1f} km."
assert abs(received_dbm(14, 2.15, 9, 433e6, 100e3) - (-100.03)) < 0.02, f"At 100 km on 433 MHz, 14 dBm with 2.15 and 9 dBi antennas arrives at -100.0 dBm; got {received_dbm(14, 2.15, 9, 433e6, 100e3):.2f}."
_r = power_range(14, 2.15, 9, 433e6, -130, 10)
assert abs(_r - 996.8e3) < 1e3, f"The power budget alone reaches 997 km; got {_r/1000:.1f} km."
assert abs(received_dbm(14, 2.15, 9, 433e6, _r) - (-120)) < 1e-6, "At the power-limited range the signal should sit exactly at the threshold plus margin."
_k, _d = link_range(30000, 10, 14, 2.15, 9, 433e6, -130, 10)
assert _k == "horizon" and abs(_d - 726953) < 50, f"At 30 km the link is limited by the horizon at 727 km; got {_k} at {_d/1000:.1f} km."
_k2, _d2 = link_range(30000, 10, 0, 0, 2.15, 433e6, -120, 10)
assert _k2 == "power" and abs(_d2 - 22.32e3) < 100, f"With 0 dBm, no antenna gain at the balloon and a -120 dBm receiver, power limits it to about 22 km; got {_k2} at {_d2/1000:.1f} km."
```

::: right
Right. At 30 km the horizon stops the link at 727 km, short of the 997 km the power budget would allow; a weaker link is power-limited at 22 km.
:::
:::

::: check
given: h = 1 | 10 | 30; m = 2 | 10 | 30
answer: (sqrt(2*4/3*6371e3*h*1000) + sqrt(2*4/3*6371e3*m))/1000
unit: km
tolerance: 0.5%

## A balloon at {h} km talks to a ground antenna {m} m up. How far apart can they be before the radio horizon cuts them off?

::: right
Right. $\sqrt{2kR_Eh_1} + \sqrt{2kR_Eh_2}$ = {answer} km.
:::

::: misses
- [(sqrt(2*6371e3*h*1000) + sqrt(2*6371e3*m))/1000] Use the 4/3 effective Earth radius for radio.
- [sqrt(2*4/3*6371e3*h*1000)/1000] Add the ground antenna's own horizon.
- [any] Not yet. Sum the two horizons.
:::
:::

::: check
given: p = 10 | 14 | 20; g = 2.15 | 9 | 15; s = -120 | -130 | -137; f = 144 | 433 | 868
answer: 299792458/(f*1e6)/(4*pi)*10^((p + g + 2.15 - s - 10)/20)/1000
unit: km
tolerance: 0.5%

## A {f} MHz transmitter sends {p} dBm from a 2.15 dBi dipole to a {g} dBi antenna, whose receiver needs {s} dBm plus a 10 dB margin. What's the power-limited range?

::: right
Right. $(\lambda/4\pi)10^{(P_t + G_t + G_r - S_\min - M)/20}$ = {answer} km.
:::

::: misses
- [299792458/(f*1e6)/(4*pi)*10^((p + g + 2.15 - s)/20)/1000] Leave the 10 dB margin in the budget.
- [any] Not yet. Solve the Friis equation for the range.
:::
:::

::: check
given: d = 10 | 50 | 200; h = 5 | 20 | 30
answer: sqrt(d^2 + h^2)
unit: km
tolerance: 0.5%

## A balloon is {h} km up and {d} km away along the ground. Treating the ground as flat, how far is it in a straight line?

::: right
Right. $\sqrt{d^2 + h^2}$ = {answer} km.
:::

::: misses
- [d + h] It's the hypotenuse, not the sum.
- [any] Not yet. Pythagoras.
:::
:::

::: check
kind: parts
given: d = 50 | 200 | 500; P = 10 | 14; G = 6 | 9

## The balloon (433 MHz, λ = 0.692 m) sends {P} dBm from a 2.15 dBi antenna to a {G} dBi ground antenna {d} km away.

::: part
answer: 20*log(4*pi*d*1000/0.692)
unit: dB
tolerance: 0.5%

### What is the path loss?

::: misses
- [any] $20\log_{10}(4\pi d/\lambda)$.
:::
:::

::: part
answer: P + 2.15 + G - 20*log(4*pi*d*1000/0.692)
unit: dBm
tolerance: 0.5%

### What power arrives?

::: misses
- [any] $P_t + G_t + G_r - L$.
:::
:::
:::

::: check
kind: parts
given: h = 10 | 20 | 30; m = 2 | 10

## The balloon flies at {h} km, and the ground antenna is on a {m} m mast. Using $d \approx \sqrt{2Rh}$ for each end with R = 6371 km (no refraction):

::: part
answer: sqrt(2*6371e3*h*1000)/1000 + sqrt(2*6371e3*m)/1000
unit: km
tolerance: 0.5%

### How far is the radio horizon?

::: misses
- [any] Sum of both ends' horizons.
:::
:::

::: part
answer: sqrt(2*6371e3*m)/1000
unit: km
tolerance: 0.5%

### How much of that does the mast contribute?

::: misses
- [any] $\sqrt{2Rh_\text{mast}}$.
:::
:::
:::

::: explain
## Why is a high-altitude balloon link usually limited by the horizon and not by power?

::: model
Free-space path loss grows only with the square of distance, so each doubling of range costs just 6 dB, and a small transmitter with modest antennas and a sensitive receiver can in principle close a link over hundreds or even thousands of kilometers. The curvature of the Earth sets a hard cutoff instead: beyond the radio horizon the balloon is simply out of sight, and the signal drops by tens of decibels as it has to diffract around the bulge. A balloon at 30 km has a horizon of about 700 kilometers, so a link budget good for 1000 km doesn't help beyond it. Only for low altitudes or weak links does the power budget run out first.
:::
:::

::: practice

::: check
given: h = 0.1 | 40; m = 1 | 100
answer: (sqrt(2*4/3*6371e3*h*1000) + sqrt(2*4/3*6371e3*m))/1000
unit: km
tolerance: 0.5%

## Radio horizon: {h} km and {m} m?

::: misses
- [any] Sum of $\sqrt{2kR_Eh}$.
:::
:::

::: check
given: d = 1 | 500; h = 1 | 40
answer: sqrt(d^2 + h^2)
unit: km
tolerance: 0.5%

## Slant range: {d} km along the ground, {h} km up?

::: misses
- [any] $\sqrt{d^2 + h^2}$.
:::
:::
:::
