Typical accuracy
| Source | Accuracy | Drift per day |
|---|---|---|
| MCU internal RC oscillator | ±1% – ±5% | — |
| Ceramic resonator | ±0.5% | — |
| Crystal (XO, untrimmed) | ±20 – ±50 ppm | ~1 ppm |
| Crystal (trimmed) | ±10 ppm | ~1 ppm |
| TCXO (temp compensated) | ±0.5 – ±2 ppm | ~0.1 ppm |
| OCXO (oven) | ±0.01 – ±0.1 ppm | 1 – 10 ppb/day |
| GPS disciplined | ~1 × 10⁻¹¹ | Tracks GPS |
| Rubidium atomic | ~5 × 10⁻¹¹ | ~1 × 10⁻¹¹/month |
| Cesium atomic | ~1 × 10⁻¹² | ~1 × 10⁻¹⁴ |
| Optical atomic clock (lab) | ~10⁻¹⁸ | Research |
Useful conversions
| 1 ppm at 32.768 kHz | 0.0328 Hz → ~2.6 seconds/month drift |
|---|---|
| 20 ppm at 16 MHz | 320 Hz — enough to break serial at high baud rates |
| For UART at 115200 | Need < 2.5% error — any decent crystal works; RC oscillator too loose |
Error sources
- Temperature: XO parabolic curve around 25 °C; TCXO compensates via varactor + thermistor.
- Aging: crystals drift ~1–5 ppm in the first year, slower after.
- Voltage: VCC variation pulls frequency slightly.
- Load capacitance: mismatched board capacitance shifts frequency from datasheet spec.
- Mechanical shock: large crystals can fracture; MEMS resonators are more robust.
Worked examples
Clock drift: ppm means parts per million of elapsed time. A 20 ppm crystal gains or loses up to 20 × 10-6 × 86,400 s = 1.73 s per day, or about 52 s per 30-day month. A 2 ppm TCXO is ten times better, at about 5 s per month. A real-time clock built on a 32.768 kHz crystal is typically specified at ±20 ppm at 25 °C and drifts further as the temperature moves away from that point.
UART baud error: a 16 MHz AVR with the standard divider (16 samples per bit) at 115,200 baud computes 16,000,000 / (16 × 115,200) = 8.68, rounds to 9, and so runs at 111,111 baud, an error of −3.55%. Using the double-speed mode (8 samples per bit) gives 17.36, rounds to 17, and runs at 117,647 baud, an error of +2.1%. The sending and receiving errors add, and a total beyond roughly 2 to 3% starts corrupting characters. The crystal itself is not the problem here; the integer divider is. A 18.432 MHz crystal gives an exact 115,200.
Choosing a clock source
- Internal RC is fine for blinking LEDs and timing that does not matter, but not for UART at high speeds, USB, CAN or long-term timekeeping.
- A crystal is the default for serial links, USB (which needs about 0.25% or better; check the MCU datasheet) and general timing.
- Use a TCXO when temperature swings are large and you need better than a few ppm, such as GNSS receivers and radio frequency references.
- Load capacitance is part of the spec. A crystal rated for 12 pF load needs CL = (C1 × C2) / (C1 + C2) + Cstray. With 3 pF of stray capacitance, two 18 pF capacitors give 9 + 3 = 12 pF. Wrong values shift frequency by tens of ppm.