1.67 clock offset #3966
Replies: 1 comment
-
Posted at 2014-07-17 by @gfwilliams It sounds a lot like you're still working off the internal oscillator... That kind of accuracy is what you'd expect from it. Can you try copying and pasting this into the console?
If the watch crystal is working properly, it should return 'LSE', but if not it'd return 'LSI'. The fading shouldn't interfere with the RTC at all... You're using setInterval there, which should be absolutely fine - but you can now actually use the Date class and clock module if you want to. It means that you don't have to keep track of time every second if you don't want to, and you get the day of the week/etc too:
As far as the non-linear fading, I'm not sure. Is it not just that the light you're using is itself non-linear? For instance I believe that if you have an LED, pulsing it at 10% duty cycle will probably generate more than 10% of the light that you'd get by running it at 100% duty cycle. You might also find that specifying a frequency when using Posted at 2014-07-17 by Alex Hi Gordon, Thanks for the answer, I'll test this as soon as I have time! Regards. Alex Posted at 2014-07-17 by Alex (on a sidenote, the forum isn't remembering notify by email?) Posted at 2014-07-17 by Alex Hi Gordon, It's returning LSE, also I clocked it again, 8 seconds on 3 minutes. There's also a HM-10 on these espruino's, would that matter? Its only a serial connection right? Regards, Alex Posted at 2014-07-18 by @gfwilliams Ok, that's good then. Hm10 won't be an issue. Can you check the value from getTime and see if that wanders off, or whether it's just setInterval? Posted at 2014-07-18 by @gfwilliams Just wondering, is it possible that the crystal you're using is 32000hz and not 32768hz? I just assumed that all 32khz crystals were the latter (because of how they'd be used), but maybe not... 8 secs in 3 minutes is very close to the difference between the two crystals. If it's accurately losing that much time you could just correct it in the value you give to setInterval. Posted at 2014-07-21 by Alex Hi Gordon, I'm yet to test the getTime function but I ordered these crystals: Unless they gave me the wrong ones It should be 32768hz.. Posted at 2014-07-21 by @gfwilliams Yes, those look perfect. It'd definitely be interesting to see whether Does it seem like Espruino's internal clock is running too quickly, or too slowly? Posted at 2014-07-21 by Alex Hi Gordon, I tried getTime with one of them. Here are the results:
In case its not clear: HH-mm-ss getTime(). getTime() does seem to be OK, 4 minutes take 232 seconds, which is what the getTime() tells us and what I clocked on a stopwatch. I soldered on a new crystal (same batch) with these results. I'll check the other espruino.. Posted at 2014-07-21 by Alex Here is the other one, v1.65
Also not correct, yet it shows in the getTime(), same as my stopwatch. It seems to be much worse after I upload the code and type save(). If I just upload the code and manually call onInit() it it better. Here is the manually called onInit of the 1.67:
This one is LSI again, I don't know why... Time is spot - on though! Posted at 2014-07-21 by Alex It seems to sometimes forget it is LSE. Sometimes when I plug it in, it says LSI, then I reset it (with the button) and it is LSE again. When it was LSI the timing was correct. Any ideas? Either I'm a sucky (though very consistent :)) solderer or something somewhere is wrong... Posted at 2014-07-22 by @gfwilliams I think it can take a few seconds to switch over to LSE - the oscillator takes a while to stabilise and Espruino runs off of LSI until it has. If it fails to start the oscillator (note that you can't use C15 for anything as that is an oscillator pin) then it'll stay with LSI, so that could be what's happening in some cases? So you're saying that the time from Posted at 2014-07-22 by @gfwilliams This is definitely some issue with Espruino... My guess is that when the intervals changed (with the 32 bit switch) something got messed up. I'll look into it and should hopefully get a fix in for the 1v68 version. Posted at 2014-07-22 by @gfwilliams Ok, fixed. You can try out a pre-release build (once it has built) in an hour or so at: http://www.espruino.com/binaries/git/commits/b7e330060a3c0d7ff1fe56583cd0e57caa749849 Just go there, copy the link address of the binary, and paste it into the 'advanced flasher' text box in the Web IDE's settings page. Posted at 2014-07-22 by Alex Hi Gordon, Thanks for the fix! I'll wait for 1.68 before trying it out since I'll be on holidays anyway. Glad you found it so quickly! Regards |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-07-16 by Alex
Hi All,
I have two espruino's both with:
http://www.espruino.com/Clocks
The 32Khz Watch Crystal soldered onto it. I tried the clock example from that page as well as my own implementation and there is quite a big drift: depending on which espruino I use, 1 - 3 seconds on the minute.
Did anyone else notice this?
The program I want to use this for is a simple light switch. On in the morning, off in the afternoon.
Would the fading interfere with the clock?
Regards,
Alex
PS. also the fading isn't linear.. it seems to be faster and slower during the fading cycle.
Beta Was this translation helpful? Give feedback.
All reactions