Skip to content

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.
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

### What is micros() resolution on different boards?

Uno/Mega (16 MHz): 4 µs. Pro Mini 8 MHz: 8 µs. Due (84 MHz): ~0.01 µs. ESP32 (240 MHz): ~1 µs.

How can I get 1 µs resolution on Uno?

Read Timer0 counter directly: TCNT0 gives 0-255 at 4 µs per step. Or use Timer1 (16-bit) for ~0.5 µs resolution.

Is micros() accurate for short measurements?

Yes, but the granularity is 4 µs. Measurements under 4 µs may show 0 or 4 depending on timing.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro