Page 1 of 1

How accurate is 8 MHz internal oscillator?

Posted: Fri Feb 28, 2020 8:30 pm
by zervanus
Hello. I am planning to use that https://dstike.com/products/dstike-esp32-watch-devkit esp32 devkit as diy wrist. I need to keep time without NTP (as i want autonomous watch) and without RTC (as it seems, that this devkit doesn't have it). In latest datasheet I can't find any information about it's accuracy, but on the old ones I've found, that it has 1% accuracy https://cdn.sparkfun.com/datasheets/IoT ... eet_en.pdf. So as I understand it will inaccurate for about 24(hours)*60(min in hour)*1/100(accuracy)=14.4 min per day! Am I right? Why it is so inaccurate, for example my Casio wrist accuracy is +-1sec/day.
So how accurate this oscillator, the previous info was removed in nowadays documentation, so, maybe, that information was wrong.

Re: How accurate is 8 MHz internal oscillator?

Posted: Sat Feb 29, 2020 9:43 am
by ESP_Sprite
You are right that the internal oscillator isn't very useful for timekeeping on it's own. Normally, you'd add a 32KHz watch crystal to the ESP32 to get that feature; it's a shame the developer of this watch didn't do this. (Note that your Casio also uses the same 32KHz watch crystal to get its accuracy.) You may still be able to bodge one in if GPIO32&33 are unused, though; I'd try that first.

Re: How accurate is 8 MHz internal oscillator?

Posted: Sat Feb 29, 2020 2:43 pm
by zervanus
I've already find, that those internal oscillators was inside esp's chip, while there is external 40MHz crystal oscillator above the chip, still being part of ESP32
c18a47eb203aa56dbafd6de23040d7a8fb39cd7b.jpg
c18a47eb203aa56dbafd6de23040d7a8fb39cd7b.jpg (560 KiB) Viewed 8959 times
https://www.espressif.com/sites/default ... nes_en.pdf - check out that document (section 2.1.4.1). As I see every esp32 module must have 40MHz crystal oscillator with accuracy +-10ppm and it is 0.00001*24*60*60=0,816 sec/day. Pretty good, but will I have any problems with it?

Re: How accurate is 8 MHz internal oscillator?

Posted: Sat Feb 29, 2020 10:08 pm
by ESP_krzychb
zervanus wrote:
Sat Feb 29, 2020 2:43 pm
As I see every esp32 module must have 40MHz crystal oscillator with accuracy +-10ppm and it is 0.00001*24*60*60=0,816 sec/day. Pretty good, but will I have any problems with it?
Hi zervanus,
It's accuracy is much better but as for wrist watch you may want to put ESP32 in sleep mode when this oscillator in not avialable, see https://docs.espressif.com/projects/esp ... _time.html.

Re: How accurate is 8 MHz internal oscillator?

Posted: Sat Jun 20, 2020 2:38 am
by jgustavoam
Hi , this is my suggestion.
Generate 32768 Hz with LED PWM. And then connect this pin to RTC External Clock input.
It's possible? I think so. It's accurate? I don't know.

Arduino Code :

Code: Select all

long  frequencia = 32768;        // frequencia em Hz
long  canal = 1;                  // canal gerador de sinal
long  resolBits = 2;              // bits de resolucao
long  duty = 2;                  // Duty Cycle 50%

void freqAdjust ()
{
  pinMode(18, OUTPUT);                          // GPIO_18 as Output
  ledcAttachPin(18, canal);                     // GPIO_18 attached to PWM Channel
  ledcSetup(canal, frequencia, resolBits);      // Channel  , freq  ,  bit resolution
  ledcWrite(canal, dutyCycle);                  // Enable frequency with dutty cycle
}

Re: How accurate is 8 MHz internal oscillator?

Posted: Sat Jun 20, 2020 11:21 am
by ESP_Sprite
@ jgustavoam Perhaps the issue here is not clear... from what I know, when running normally, the ESP32 will try to keep time using the 40MHz crystal, which is stable enough and should give no issues with extreme drift. The issue only slows up when you put the ESP32 into deep sleep. In that mode, the 40MHz crystal doesn't run anymore (and the LEDC doesn't either) so the RTC uses either an (imprecise) internal clock reference, or an external 32KHz reference. As a watch probably doesn't have a very large battery, I don't think you can get around putting the ESP32 into deep sleep mode, though, so to do precise timekeeping in a watch, you want that 32KHz crystal.