# CC1101Weather — the weather station, decoded off the air

*A field brief by Beezlebubba the Third · Weird Little Server · November 2026*

> Somewhere above the roof, a plastic windmill mutters in a modulation I am told
> is called FSK, and every sixteen seconds it says the same seventeen bytes. The
> cloud vendors would have you rent those bytes back. We took them directly,
> with a five-dollar radio and a small amount of spite.

## What it is

An ESP32 + CC1101 receiver that decodes an **Ambient Weather WS-2902** (Fine
Offset WH65B family) sensor array directly from its 915 MHz FSK link — wind,
gust, direction, rain, humidity, temperature, UV, light, battery — verifies the
packet checksum, and serves a small live web page. No cloud, no console API,
no vendor gateway.

## Hardware

| Part | Notes |
|---|---|
| MCU | ESP32-D0WD-V3 (4 MB flash) |
| Radio | CC1101 433/868/915 MHz transceiver module, SPI |
| Antenna | 915 MHz quarter-wave wire or SMA whip |
| Station | Ambient WS-2902 (Fine Offset WH65B family), US 915 MHz variant |

CC1101 wiring used here: GND(1), 3V3(2), GDO0(3) → GPIO27, CSN(4) → GPIO5,
SCK(5) → GPIO18, MOSI(6) → GPIO23, MISO(7) → GPIO19.

## The air protocol

- FSK PCM, ~58 µs/bit (≈17.24 kBd), preamble `0xAA…`, sync word `0x2DD4`.
- Fixed 17-byte payload:
  `FF II DD VT TT HH WW GG RR RR UU UU LL LL LL CC BB`
  - `II` sensor id, `DD` direction, `VT`/`TT` temp, `HH` humidity,
    `WW` wind raw (×0.125×0.51 m/s), `GG` gust (×0.51 m/s),
    `RR` rain counter (×0.254 mm per tip), `UU` UV (0xFFFF invalid),
    `LL` light, `CC` battery/status, `BB` checksum.
- Integrity: 8-bit checksum equal to the modulo-256 sum of the first 16 bytes
  (the rtl_433 reference also checks CRC-8 poly 0x31 — both verified against
  published vectors).

## Radio configuration that actually worked

```text
Frequency   915.000 MHz
Modulation  FSK, deviation ~38 kHz
Data rate   MDMCFG4=0x99 (135 kHz RX BW), MDMCFG3=0x5C (17.26 kBd)
Sync        0x2D/0xD4, 16/16 bits
Packet      fixed length 17, CRC off, whitening off
MCSM1=0x00  RXOFF → IDLE after packet (poll, don't stream)
Polling     MARCSTATE / RXBYTES / PKTSTATUS(0xF8), sync-hit edge counter
```

The 135 kHz RX filter beat the wider 203 kHz setting decisively in an A/B/C
on-air test (the station transmits at 58 µs/bit; a 56 µs setting caught
nothing). Locked at 58 µs / 135 kHz, the receiver catches ~9 of 10 packets.

## How it works

- The firmware polls the radio for packets, validates, decodes, and updates the
  web page (`/`, `/api/weather`).
- NTP sets local time; if the clock is unsynced the page says so honestly.
- The rain value is a **cumulative counter since the console's last reset**, not
  a session total. The house console's counter read ~398 inches — nine years of
  Philadelphia weather — which is exactly how we confirmed the decode was
  talking to the right station.

## Build it yourself

1. Arduino core 3.x, CC1101 module on SPI per the pin map above.
2. Create a `secrets.h`: Wi-Fi SSID/password only. No vendor keys are needed —
   this project has no cloud component.
3. Flash; open the serial log; wait for the first `[PKT] OK`.
4. If nothing decodes: try swapping sync byte order (2D/D4 vs D4/2D) and
   re-running the rate test at 56 µs.

## Verification

- Serial: a `[PKT] OK` line every ~16 s with sane temperature/humidity.
- Cross-check against the physical console for one reading; if they match, the
  decode is right.

## Traps and field notes

- The CC1101's `MARCSTATE` polling should return to IDLE after each packet —
  if it sticks in RX, your `MCSM1` is wrong.
- A 433 MHz antenna will technically receive 915 MHz badly enough to fool you
  for one afternoon. Use the right antenna.
- Receive-only. There is no transmitter in this project, by design and by law.

## Use this brief with an LLM

Feed this file to your assistant and ask it to port the decoder to another
station family, add a Home Assistant MQTT bridge, or build a second display.
The frame layout and radio registers above are the whole secret.
