Timing, Clocks, and Crystals
Every second your device counts is a claim about a piece of quartz — and quartz is a little bit wrong.
🎯 By the end you'll understand
What a part per million means in seconds per day, per month and per year, and how to turn a timing requirement into a specification you can buy. The real differences between an on-chip RC oscillator, a 32.768 kHz tuning-fork crystal, and a MEMS oscillator, in accuracy, current, cost, start-up time and shock sensitivity. How load capacitance sets a crystal's exact frequency, what happens when you get it wrong, and why a tuning-fork crystal's error follows a parabola in temperature. Why calibrating an RC oscillator at boot helps less than it appears to. And the decision Beacon actually makes — which is not to fit a crystal at all — with the arithmetic that justifies it and the trigger that would reverse it.
KEY INSIGHTAsk what the time is for before you buy accuracy
"Accurate timekeeping" is not a requirement. "Two reports from the same tag must be orderable and ageable to within one report interval after thirty days without contact" is a requirement — and it has a price in microamps, pins and rupiah that you can look up. Most timing over-specification comes from never writing the second sentence.
A tag on a warehouse shelf is supposed to report once a minute. After a week the operations dashboard starts flagging it as unreliable: sometimes two reports arrive 58 seconds apart, sometimes 63, and the timestamps the tag itself puts on its data have drifted so far from the gateway's clock that events look like they happened in the wrong order. Nothing has failed. The firmware asked to sleep for 60 seconds and the chip's internal RC oscillator, which is several per cent off and moves with temperature, delivered whatever 60 seconds meant that afternoon. The engineer's instinct is to add a 32.768 kHz crystal. That is a defensible answer, and it costs two pins that were also the ADC channels, about a microamp against an eight-microamp sleep budget, and a start-up delay at every cold boot. The better question is whether the tag needed to know the time at all, or whether the gateway that receives its reports already does.
Timing requirements come in three flavours and they have wildly different costs. Interval accuracy — "roughly once a minute" — tolerates per cent-level error and needs no hardware. Elapsed-time accuracy — "this reading is 14 minutes old" — accumulates, so it needs parts per million or a periodic re-sync. Rendezvous accuracy — "be awake at 14:03:00 ± 1 s" — is the expensive one, because the error between synchronisations must stay smaller than the window. Identify which one you actually have, because the third is what makes people buy crystals for products that only needed the first.
DEFINITIONWhat a part per million actually costs you
Frequency error is quoted in parts per million because the absolute number is meaningless without the interval it accumulates over. The conversion is arithmetic you should be able to do without a calculator:
1 ppm = 1 µs per second = 86.4 ms per day = 2.59 s per 30 days = 31.5 s per year.
So a typical ±20 ppm watch crystal drifts 1.73 s per day, ≈ 52 s per month, and about 10.5 minutes per year. A ±5 ppm MEMS part manages 13 s per month. An uncalibrated on-chip RC oscillator at ±5 % — that is 50,000 ppm — is off by 4,320 s per day, or 36 hours per month. The three numbers span four orders of magnitude and about two orders of magnitude in price, which is why the requirement has to be written before the part is chosen.
| Requirement | Error budget | Needed accuracy with no re-sync | What that buys |
|---|---|---|---|
| Report roughly once a minute; the dashboard flags a tag only after three missed intervals | ±10 % of 60 s | ±100,000 ppm | Anything with a few percent of accuracy — the on-chip RC only just clears this one. |
| Order and age reports to within one interval after 30 days offline | 60 s in 30 days | ≈ ±23 ppm | A 32.768 kHz crystal, just. A ±20 ppm part has 15 % margin, which is not much once temperature is added. |
| Wake into an agreed ±1 s listening window, re-synchronised daily | 1 s in 86,400 s | ≈ ±11 ppm | A good crystal or a MEMS oscillator, plus a daily synchronisation that costs radio time. |
| Same window, re-synchronised weekly | 1 s in 604,800 s | ≈ ±1.6 ppm | A temperature-compensated part. This is where timing stops being cheap. |
Notice how sharply the cost climbs with the interval between synchronisations. That is the single most useful lever in the whole subject: every re-synchronisation resets the accumulated error to zero, so a cheap clock plus a frequent sync often beats an expensive clock plus none. The cost moves from the BOM to the radio's duty cycle, which on a battery device is a trade you can actually evaluate — Lesson 4.3 will price radio time in microamps.
COMPARISONRC, quartz, MEMS: the real menu
| On-chip RC | 32.768 kHz tuning-fork crystal | MEMS oscillator | TCXO | |
|---|---|---|---|---|
| Accuracy | ±2–10 % untrimmed; a few tenths of a per cent if calibrated, and only at the calibration temperature | ±10 to ±50 ppm initial tolerance, plus a temperature parabola of about −20 ppm at the ends of a 0–45 °C range | ±1 to ±10 ppm across temperature, compensated internally | ±0.1 to ±2 ppm |
| Current | Included; nothing extra | ≈ 1 µA for the oscillator circuit | ≈ 1 µA for a low-power 32 kHz part | Hundreds of µA to mA for a high-frequency part |
| Cost | Free | Low — the crystal plus two capacitors | Roughly ten times the crystal | Higher again |
| Start-up | Microseconds | 200 ms to over a second — a tuning fork has tens of kΩ of motional resistance and very little energy to build up | A few milliseconds | Milliseconds to tens of ms |
| Shock and vibration | Immune | A tuning fork is a mechanical resonator with a real fork inside it: drops and impacts shift it, and severe ones crack it | Substantially more robust — a genuine argument for a device that gets knocked about | Depends on the resonator inside |
| Board cost | None | Two pins, two capacitors, and a keep-out around a high-impedance node | One pin if the part is a single-ended oscillator, plus its own supply and decoupling | Same, larger |
Two entries in that table are routinely underestimated. Start-up time matters enormously on a device that boots often: if a tag cold-boots and must wait a second for its watch crystal to stabilise before it can even schedule its first sleep, that second is spent at active current. And shock sensitivity is not a theoretical concern for an asset tag — the whole point of Beacon is that it is attached to equipment that gets moved, which is why R3 specifies a motion-wake accelerometer in the first place. A device designed to detect being knocked about, whose time reference is a tiny quartz fork, is at least worth a moment's thought.
Beacon's ESP32-C3-MINI-1 contains a 40 MHz crystal, selected and matched by Espressif as part of the module. That crystal is what sets the radio's carrier accuracy, and Bluetooth Low Energy has a real requirement there — the transmitter's centre frequency must sit within ±150 kHz of nominal, which at 2.44 GHz is about ±61 ppm. Meeting that with a bare chip means specifying, buying and laying out a crystal correctly, then testing it. Meeting it with a pre-certified module means buying the module. That is one of the quieter reasons module-based designs win at low volume, and it is a different problem from the sleep clock this lesson is really about. The two are constantly confused: the 40 MHz crystal runs the radio and the CPU, and it is powered down in deep sleep; the sleep clock is a separate, far slower oscillator whose only job is to count until the next wake.
HOW IT WORKSLoad capacitance, pulling, and the temperature parabola
A crystal is a mechanical resonator, and the oscillator circuit around it — almost always a Pierce configuration, an inverting amplifier with the crystal in its feedback path and a capacitor from each crystal pin to ground — does not simply "read" its frequency. It runs the crystal slightly off its series resonance, at a point determined by the capacitance the circuit presents to it. That capacitance is a specification on the crystal's datasheet, called load capacitance CL, and the crystal is only the frequency printed on it when it sees that load.
CL = (C1 · C2) / (C1 + C2) + Cstray, where C1 and C2 are the two capacitors to ground and Cstray is everything else — pin capacitance, pad and trace capacitance, typically 3–5 pF. For the common CL = 12.5 pF part with 5 pF of stray, you need (C1·C2)/(C1+C2) = 7.5 pF, so C1 = C2 = 15 pF. Note that the stray capacitance is a third of the budget and is set by your layout, which is why "the same circuit" on a different board can run at a different frequency.
Get the load wrong and the frequency moves. The sensitivity comes from the crystal's equivalent circuit — a motional capacitance C₁ of a few femtofarads in parallel with a shunt capacitance C₀ of a picofarad or two:
Δf/f between two load capacitances is approximately (C₁/2) · [1/(C₀ + CL,actual) − 1/(C₀ + CL,spec)]. Take a typical tuning-fork crystal with C₁ ≈ 3 fF and C₀ ≈ 1.5 pF, specified for CL = 12.5 pF but actually loaded with 9 pF because someone fitted 12 pF capacitors and the layout's stray was lower than assumed:
Δf/f = 1.5 × 10−15 × [1/(10.5 pF) − 1/(14 pF)] = 1.5 × 10−15 × 2.38 × 1010 = +36 ppm.
The clock now runs fast by 36 ppm — 3.1 s per day, 93 s per month — which is worse than the ±20 ppm part you paid for, produced entirely by two capacitors that were one standard value out. Near 12.5 pF this crystal's trim sensitivity is about 10 ppm per picofarad, and that figure is on the datasheet precisely so you can check your arithmetic. Less load capacitance always means a higher frequency; more means lower.
Then temperature moves it again. A 32.768 kHz tuning-fork crystal has a characteristic parabolic temperature response, quite unlike the S-curve of the AT-cut crystals used at megahertz frequencies:
Δf/f = −β · (T − T₀)², with β ≈ 0.034 ppm/°C² and a turnover temperature T₀ of 25 °C, both with their own tolerances (β is usually specified as 0.034 ± 0.006, T₀ as 25 ± 5 °C). It peaks at room temperature and falls away in both directions. Over R9's specified 0–45 °C environment: at 0 °C, −0.034 × 25² = −21 ppm; at 45 °C, −0.034 × 20² = −14 ppm.
This adds to the initial tolerance, it does not replace it. A crystal bought as "±20 ppm" and trimmed correctly is a ±20 ppm part at 25 °C; across Beacon's environment it is a ±41 ppm part, and the specification you should have written was the combined figure. This is exactly the kind of two-line datasheet arithmetic that Lesson 1.6 warned separates people who read datasheets from people who look at the big number on the front page.
SEE ITThe drift simulator: thirty days of being slightly wrong
Choose Beacon's sleep clock, the temperature it lives at, how often it gets re-synchronised, and what the timing is actually required to deliver. The plot shows accumulated timing error over thirty days on a logarithmic scale — the selected source in colour, the alternatives faint — with the saw-tooth that each re-synchronisation produces. The readouts price the choice in microamps, rupiah and pins.
Three experiments. One: leave the source on the uncalibrated RC and step through the three requirements. The same clock passes "roughly once a minute" with almost nothing to spare and fails "wake into a ±1 s window" within about half a minute of being set. Two: choose the calibrated RC and slide the temperature away from 25 °C. Calibration at boot removes the chip-to-chip error and nothing else, so a tag installed on a warm machine gives back most of what the calibration won — a genuinely useful thing to know before you rely on it. Three: select the crystal, then the same crystal with load capacitors one standard value too small, and watch a 36 ppm shift undo most of the accuracy you paid for. Then turn on daily re-synchronisation and notice that the RC with a daily sync beats the mis-loaded crystal with none — which is the lesson's real argument.
IN PRACTICEThe ESP32-C3's two sleep clocks
The C3 offers a choice for its RTC slow clock — the oscillator that keeps counting while everything else is powered down — and the choice is made in menuconfig, not in code.
RC_SLOW_CLK — the internal RC oscillator, and the default
Nominally around 136 kHz on the C3. You will see "150 kHz" quoted constantly, because that was the original ESP32's figure and it has been copied forward for years; check the datasheet for the chip you are actually using. It costs nothing, starts instantly, and is worth a few per cent of accuracy before calibration.
Calibration against the main crystal, and its limit
ESP-IDF measures the slow oscillator against the accurate 40 MHz crystal and uses the ratio to convert your requested sleep duration into RTC ticks. This removes the chip-to-chip spread very effectively — and it is a measurement taken at one moment, at one temperature, at one supply voltage. The chip then sleeps for a minute during which the temperature and the battery voltage both move, and the RC moves with them. Calibration converts a large constant error into a smaller variable one; it does not make an RC oscillator into a crystal.
XTAL32K — an external 32.768 kHz crystal on GPIO0 and GPIO1
Better accuracy for roughly a microamp, and here is the cost that does not appear in any timing datasheet: on the ESP32-C3, XTAL_32K_P and XTAL_32K_N are GPIO0 and GPIO1. Both are ADC1 channels, so a watch crystal consumes two of the five analogue-capable pins on a part with twenty-two GPIOs — and on Beacon the collision is more direct than that, because GPIO1 is already the divider's enable output. Fitting a crystal does not just cost an ADC channel; it evicts a pin that has a job. On a 35 × 25 mm board with a module, two sensors, USB, a button, an LED and a battery divider, that is a real constraint rather than a footnote.
An external oscillator instead of a crystal
ESP-IDF also supports driving XTAL_32K_P from an external 32.768 kHz oscillator through a series capacitor, leaving GPIO1 free. That is how a MEMS part is wired, and it is the option to remember if you ever need the accuracy but cannot spare both pins.
Bluetooth Low Energy has a field called sleep clock accuracy, and connections negotiate it in bands running from ±500 ppm down to ±20 ppm — which makes it look as though a BLE device needs a good sleep clock. It applies to connections, where two devices must open receive windows at agreed moments and a sloppy clock forces wider windows and more current. Beacon does not form connections: canon fixes it as non-connectable advertising, three packets per burst, deep-sleeping in between. There is no connection event to be late for, so the sleep clock's accuracy never reaches the radio at all. What does reach the radio is the module's 40 MHz crystal, which sets carrier frequency accuracy, and Espressif has already specified that for you. Conflating the two is how designs acquire a 32 kHz crystal they do not need.
BEACONBeacon's clock decision: the gateway keeps the time
Now the decision, made properly. Beacon's canon payload is fourteen bytes: company id, firmware version, sequence number, temperature, humidity, battery millivolts, flags, moved flag, CRC. Read that list again and notice what is missing. There is no timestamp field. The tag never tells anyone what time it is, because the architecture already decided that the gateway — a Raspberry Pi Zero 2 W with a network connection and a real clock — stamps each report as it arrives. The tag's job is to produce a report roughly once a minute and to number it so that gaps are visible.
Against that architecture, run the three requirements from the top of this lesson:
| Requirement | Does Beacon have it? | Consequence |
|---|---|---|
| Interval accuracy — report roughly once a minute | Yes. R4 fixes report latency after motion at ≤ 2 s; the periodic report only has to be "about" every 60 s so the dashboard can flag a genuinely silent tag | A ±5 % clock delivers 57–63 s. The dashboard's missing-tag rule is written in intervals, not seconds, and tolerates it easily. |
| Elapsed-time accuracy — the tag ages its own data | No. There is no timestamp in the payload and the gateway stamps on receipt | The tag's own notion of elapsed time is never transmitted, so its error is never observable. |
| Rendezvous accuracy — wake into an agreed window | No. Canon puts OTA behind holding the button at wake, not behind a scheduled listening window | Nothing on the tag has to be awake at an agreed absolute moment. The expensive requirement was designed away rather than paid for. |
Beacon does not fit a 32.768 kHz crystal. It runs its sleep timer from the ESP32-C3's internal RC oscillator, calibrated by ESP-IDF against the module's 40 MHz crystal.
What that saves: about 1 µA against an 8 µA sleep floor — a 12 % reduction in the sleep term, worth roughly 3 % of overall battery life once the 30 µA active term is counted. Two GPIOs, both of them ADC-capable, on a part where pins are the binding constraint. A crystal, two capacitors and their placement on a 35 × 25 mm board. A few thousand rupiah out of R5's IDR 150,000. And several hundred milliseconds of start-up at every cold boot.
What that costs: the interval between reports wanders by a few per cent, so a tag's reports arrive at 57–63 s rather than 60.0 s. The dashboard must express its rules in report counts rather than wall-clock seconds — "three intervals missed" rather than "180 seconds silent" — which is a one-line change in a Python subscriber and no change at all to the tag.
The trigger that reverses it, written on the sheet so the next revision does not have to rediscover the argument: "No 32 kHz crystal. Sleep timing from the calibrated internal RC. Revisit if a future revision adds on-tag timestamping, a scheduled listening window, or a synchronised multi-tag measurement — any of which takes GPIO0/GPIO1 for the crystal and evicts the divider-enable output."
One refinement worth knowing about, because it costs nothing and recovers most of what was given up. The gateway sees each tag's sequence number and its own arrival time. Over a few hundred reports it can fit a straight line through those pairs and estimate that tag's actual report period — 60.7 s, say, rather than 60.0 s — and from then on it knows, per tag, both when the next report is due and how to convert a sequence number into an elapsed time. The tag's clock error has not gone away; it has been measured by the side of the system that has a good clock and plenty of compute. That is the general pattern worth carrying out of this lesson: accuracy is a system property, and it can be bought with hardware at the sensor or with arithmetic at the receiver, whichever is cheaper. For twenty-five battery tags reporting to one always-powered gateway, it is emphatically the arithmetic.
WEAKNESSWhere this bites
A 32.768 kHz crystal on a schematic reads as competence. It is also two pins, a microamp, four component placements, a high-impedance node that needs a guard and a keep-out in layout, a start-up delay, a mechanical resonator on a device designed to be knocked about, and a load-capacitance calculation that people get wrong often enough that "my RTC gains a minute a week" is one of the most common questions on any embedded forum. If the product's requirements do not name a timing accuracy, the crystal is not an upgrade; it is an unexamined cost with a failure mode attached. Write the requirement first. Sometimes it comes back "yes, and ±10 ppm", and then you fit the crystal with confidence and check the load capacitors twice.
Calibrating an RC oscillator against an accurate reference genuinely removes the part-to-part spread, and the improvement is dramatic enough that it is easy to stop there. What it cannot remove is drift with temperature and supply voltage, and both of those change after the calibration — a tag installed beside a machine that warms up over a shift, on a battery that sags as it discharges, is running on a correction measured under conditions that no longer exist. If the requirement genuinely needs sub-per-cent timing, recalibrate periodically rather than once, and measure the residual error over the full temperature range on real units rather than assuming a specification exists. Espressif does not publish a temperature coefficient for the slow RC oscillator, which is itself a message about how tightly you should rely on it.
"±20 ppm" on a purchase order is an initial tolerance at 25 °C. The tuning-fork parabola then adds up to −21 ppm at 0 °C and −14 ppm at 45 °C, so across R9's environment the same part is a ±41 ppm device — and if the load capacitors are also one standard value out, a further ±36 ppm on top of that. Three specifications that each look small combine into a part that is twice as bad as the one you thought you bought. The habit that prevents it is to write the error budget as a sum of named terms — initial tolerance, temperature, load error, ageing — and to require that the sum, not any single term, meets the requirement. Ageing, incidentally, is the fourth term and is typically a few ppm in the first year; it matters for products that must hold accuracy for a decade and not for a 30-day pilot.
KEY INSIGHTHow this connects
- Passive Components for Real: Resistors, Capacitors, Inductors (1.4) — the two load capacitors are ordinary ceramics with ordinary tolerances and ordinary temperature coefficients, and a C0G part is specified for this job while an X7R part is not. A 10 % capacitor on a crystal is a 5 ppm error you did not budget.
- Reading a Datasheet Without Getting Fooled (1.6) — this lesson is that lesson applied to one component: the front-page number is the initial tolerance at 25 °C, and the parabola, the load specification, the drive level and the ageing figure are all further inside.
- Beacon's Schematic v0: The Front-End Comes Together (2.9) — next: every decision from this stage assembled into one sheet and reviewed part by part, including this one, which appears on the schematic as a note explaining why something is absent.
Forward, the sleep timer becomes real firmware in Lesson 3.7's state machine and gets measured in Lesson 4.3's power budget, where the microamp saved here is one line in a table of about a dozen. The gateway's line-fitting trick belongs to Lesson 4.7's MQTT design. And in Stage 6 the pilot supplies the honest answer: thirty days of real report arrival times from twenty-five tags will show exactly how much the internal RC actually wandered in a real warehouse, which is a better number than any datasheet could have given.
GLOSSARYKey terms introduced
- Parts per million (ppm)
- Fractional frequency error × 106. One ppm is 86.4 ms per day, 2.59 s per 30 days, 31.5 s per year.
- Load capacitance, CL
- The capacitance a crystal must see to run at its marked frequency: (C1·C2)/(C1+C2) plus 3–5 pF of layout stray. Getting it wrong pulls the frequency at roughly 10 ppm per picofarad near 12.5 pF.
- Pulling
- The deliberate or accidental shift of a crystal's frequency by changing its load capacitance. Less load means a higher frequency.
- Turnover temperature
- The peak of a tuning-fork crystal's parabolic temperature curve, nominally 25 ± 5 °C. Error falls away as −β(T − T₀)² with β ≈ 0.034 ppm/°C², so accuracy is best at room temperature and worse in both directions.
- Pierce oscillator
- The standard on-chip crystal circuit: an inverting amplifier with a feedback resistor, the crystal in the feedback path, and one load capacitor from each crystal pin to ground.
- RC_SLOW_CLK
- The ESP32-C3's internal low-power oscillator used for sleep timing — around 136 kHz nominal, several per cent accurate, free, instant to start, and calibrated against the main crystal by ESP-IDF.
- Sleep clock accuracy (SCA)
- A Bluetooth Low Energy connection parameter, negotiated in bands from ±500 ppm to ±20 ppm, that determines how wide a receive window must be. It applies to connections, not to non-connectable advertising.
- Re-synchronisation
- Resetting a device's accumulated timing error from an external reference. Frequent re-sync substitutes for clock accuracy, moving the cost from the bill of materials to radio time.
ACTIVE RECALLCheck your understanding
Answer in your own words first, then reveal.
1A product must wake into a ±0.5 s listening window and synchronises once a week. What clock accuracy does that demand, and what would you propose instead?›
A week is 604,800 s, so 0.5 s of allowable error is 0.5/604,800 = 0.83 ppm. That is beyond an ordinary crystal (±20 ppm initial, plus a temperature parabola worth tens of ppm) and beyond most MEMS parts; it means a temperature-compensated oscillator, which costs money, board area and current, and even then leaves little margin for ageing.
The better proposal is to attack the interval rather than the accuracy. Synchronise daily instead of weekly and the requirement becomes 0.5/86,400 = 5.8 ppm, which a good crystal or a MEMS part meets. Synchronise hourly and it becomes 139 ppm, which a calibrated RC oscillator can manage with no extra hardware at all. Alternatively, widen the window: opening the receiver for ±5 s instead of ±0.5 s costs radio-on time but removes an entire component class from the BOM. Both levers are cheaper than parts per million, and the choice between them is a power-budget calculation, not a component search.
2A colleague's board keeps time about 90 seconds fast per month. It uses a ±20 ppm 32.768 kHz crystal specified for CL = 12.5 pF with 12 pF load capacitors fitted. Diagnose it.›
Ninety seconds per month is 90/2.59 ≈ 35 ppm fast — well outside the crystal's ±20 ppm specification, and fast rather than slow, which is the diagnostic clue: less load capacitance means a higher frequency.
Two 12 pF capacitors in series give 6 pF, plus perhaps 3 pF of layout stray, for an actual load of about 9 pF against a specified 12.5 pF. Using Δf/f ≈ (C₁/2)·[1/(C₀+CL,actual) − 1/(C₀+CL,spec)] with C₁ ≈ 3 fF and C₀ ≈ 1.5 pF: 1.5 × 10−15 × (1/10.5 pF − 1/14 pF) = +36 ppm. That accounts for the whole error.
The fix is capacitors sized for the actual stray: C1 = C2 = 2 × (12.5 − Cstray). With 3 pF of stray that is 19 pF, so 18 or 20 pF C0G parts. And measure rather than assume — the stray term depends on the layout, so the honest procedure is to fit a value, measure the frequency error on a real board, and adjust once. Also check the capacitors are C0G: an X7R part's capacitance moves with temperature and DC bias (Lesson 1.4), which would put a temperature coefficient on top of the crystal's own parabola.
3Justify Beacon's decision not to fit a 32.768 kHz crystal. What exactly would have to change for that decision to flip?›
The justification is architectural, not electrical. Beacon's fourteen-byte payload contains a sequence number and no timestamp: the gateway stamps reports on arrival, so the tag's own notion of elapsed time is never transmitted and its error is never observable. Nothing requires the tag to be awake at an agreed absolute moment either — canon puts OTA behind holding the button at wake, not behind a scheduled listening window. That leaves only interval accuracy, "report roughly once a minute", which a several-per-cent clock satisfies with a hundredfold margin. The saving is about 1 µA against an 8 µA sleep floor, two ADC-capable pins — GPIO0 and GPIO1 are XTAL_32K_P and XTAL_32K_N on the C3, and GPIO1 is already Beacon's divider-enable output — four placements on a 35 × 25 mm board, a few thousand rupiah, and several hundred milliseconds of crystal start-up at every cold boot.
Three changes would flip it, and all three are architectural rather than incremental: putting a timestamp in the payload, so the tag's elapsed-time error becomes visible in the data; adding a scheduled listening window, so the tag must rendezvous; or adding any synchronised multi-tag measurement, where two tags' clocks must agree. Any of those makes the crystal necessary and takes GPIO0 and GPIO1 with it, which in turn evicts the divider's enable output onto another pin and costs an ADC channel. That is why the reason is written on the schematic rather than just decided.
4Beacon's dashboard reports "tag missing" whenever 180 seconds pass with no message. A tag runs 4 % slow. What happens, and where is the actual bug?›
At 4 % slow the reports arrive every 62.4 s rather than 60 s, so three intervals take 187 s. A single lost packet — which happens routinely at 10 m through a plaster wall, R2's own scenario — pushes the gap to 125 s, and two lost packets to 187 s. The dashboard therefore raises "tag missing" on a healthy tag whenever two consecutive advertisements are not received, and the false-alarm rate scales with radio conditions rather than with anything wrong.
The bug is in the dashboard, not the tag. The rule was written in wall-clock seconds against a nominal interval the tag never promised. The correct rule is expressed in intervals measured for that specific tag: the gateway already sees sequence numbers and arrival times, so it can fit each tag's actual period — 62.4 s in this case — and flag a tag only after, say, three of its intervals have passed. That is a few lines of Python and it costs nothing, whereas fixing the same problem in hardware costs a crystal, two pins and a microamp on every one of twenty-five units. It is the clearest illustration in this stage of a general rule: before adding a component to make hardware match an assumption, check whether the assumption was worth holding.