Ard Micros Resolution
DodaTech
1 min read
In this tutorial, you'll learn about Arduino micros() Resolution Not Fine Enough. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
The Problem
micros() returns values that jump by 4 µs increments instead of 1 µs.
Quick Fix
Wrong
unsigned long us = micros(); // Jumps by 4 on 16 MHz AVR
micros() increments by 4 each time on 16 MHz AVR.
Right
unsigned long start = micros();
// Short operation
delayMicroseconds(10);
unsigned long elapsed = micros() - start;
Serial.print("Elapsed us: ");
Serial.println(elapsed);
// Expected: ~10-14 µs (varies due to 4 µs resolution)
Elapsed us: 12 (within expected range for 10 µs delay).
Prevention
micros() has 4 µs resolution on 16 MHz AVR (Timer0 prescaler). On 8 MHz boards, resolution is 8 µs. For finer resolution: use direct timer counter reads (TCNT0/1), use a board with higher clock speed (Teensy, Due), or use an external high-resolution timer.
DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro