This pesky watchdog RC oscillator is at the limit of its 10% tolerance already at room temperature. i was looking to bringing it to more like 5% (it stems from an internak 128 kHz RC oscillator) and the whole -40 ... 125 deg Celsius operating range. Can this reliably be done by reading the temperature of the MCU and applying an algorithm ? Any such working algorithm ?

The calibration is actually the adjusting of the number of cycles (of say, 125ms) the watchdog will run for. i.e. for 12.5 seconds I would run the watchdog timer 100 times, nominally. How do I temperature-compensate the 100 figure ?

  • 1
    You could run a calibration routine whereby you run a timer at the same time as the watchdog timer and then compare the difference between the two... For example run the timer for 1 second and count how many times the watchdog interrupts in that period.
    – Majenko
    Commented Jan 29, 2019 at 12:38
  • I think that just measuring the actual frequency at room temperature will be enough to calibrate to a reasonable amount. I don't think you'd get much more precision using temperature dependent calibration. If you want more precision I'd suggest adding an RTC. For example the DS3231.
    – Gerben
    Commented Jan 29, 2019 at 16:17

2 Answers 2


Your description is pretty detailed but you've missed to tell, which device you are talking about.

I assume you are talking about the ATmega 328P in an Arduino Uno.
AFAIK you can only calibrate the so called Calibrated internal RC oscillator, which is used for the main operations.
You cannot calibrate the Internal 128kHz RC oscillator from the watchdog.

I think you might have some overhead from your sleep/wake cycles.
Instead of sleeping 100 times to get from 125ms to 12.5s you could sleep for 8s + 4s + 0.5s. Thus sleeping only 3 times. Which might save you some battery life.


We've been using the WDT delta as a temperature sensing method:


Point being that once you have those calibration constants, you could use them use them to correct for WDT variation. OR you might be able to get away with a much shorter interval than the 1sec we use, with the micros reading as your WDT correction factor more directly.

  • "The other big limitation is that you can only do this trick on a voltage regulated system, because RC oscillators are affected by the applied voltage," - this is a nice finding from that article, good thing I have ditched the WDT; otherwise it seems to be concerned with that Silabs temperature sensor.
    – kellogs
    Commented Feb 25, 2019 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.