How accurate is 8 MHz internal oscillator?

zervanus
Posts: 2
Joined: Fri Feb 28, 2020 7:59 pm

How accurate is 8 MHz internal oscillator?

Postby zervanus » Fri Feb 28, 2020 8:30 pm

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.

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: How accurate is 8 MHz internal oscillator?

Postby ESP_Sprite » Sat Feb 29, 2020 9:43 am

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.

zervanus
Posts: 2
Joined: Fri Feb 28, 2020 7:59 pm

Re: How accurate is 8 MHz internal oscillator?

Postby zervanus » Sat Feb 29, 2020 2:43 pm

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 10208 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?

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: How accurate is 8 MHz internal oscillator?

Postby ESP_krzychb » Sat Feb 29, 2020 10:08 pm

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.

User avatar
jgustavoam
Posts: 165
Joined: Thu Feb 01, 2018 2:43 pm
Location: Belo Horizonte , Brazil
Contact:

Re: How accurate is 8 MHz internal oscillator?

Postby jgustavoam » Sat Jun 20, 2020 2:38 am

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
}
Retired IBM Brasil
Electronic hobbyist since 1976.

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: How accurate is 8 MHz internal oscillator?

Postby ESP_Sprite » Sat Jun 20, 2020 11:21 am

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

Who is online

Users browsing this forum: No registered users and 96 guests