Yesterday after soldering 3V backup battery holder to my PyBoard and playing with RTC I explored an issue. RTC in my PyBoard is much slower my PC system clock. Error is about 2-3% which is not really good for data logger. What's worse is that this level of error is beyond what can be corrected with RTC.calibration(). After asking a question on MicroPython forum I was told that it's a known issue since PyBoard lite uses internal resonator instead of crystal. And this resonator is quite inaccurate. Indeed feature table confirms that:
https://store.micropython.org/pyb-features
There are a few options I can deal with it:
- Buy and use regular PyBoard
- Buy external crystal oscillator
- Write a few scripts to "stretch" timestamps based on reference times during log postprocessing
I think I'll go with option number 3. Because it's cheaper, my datalogger doesn't require continuous clock precision. Eventual is fine. Also since I'm going to measure current once every 5 to 60 seconds (didn't decide on frequency yet) precise clock is not that important at all.
I'm going to write two scripts:
- First one to setup first time reference point (take system time from PC, set PyBoard's RTC, save this timestamp to file on PyBoard)
- Second one to read clock time from PyBoard, compare with PC time and write difference into another file
- Third script is to use results of first two scripts to adjust timestamps in logs after they've been downloaded
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.