- TOTEM: learning by experimentingPosted 7 days ago
- Google Assistant Voice Controlled Switch – NodeMCU IOT ProjePosted 4 weeks ago
- Water Softener Salt Level MonitorPosted 4 weeks ago
- Sparkly Air SensorPosted 4 weeks ago
- Ultra sonic distance finder with live statusPosted 1 month ago
- Windows interface to have total control over lampsPosted 1 month ago
- Smart AquariumPosted 1 month ago
- Wearable ProjectionPosted 1 month ago
- Write programs with the Arduino Web EditorPosted 1 month ago
- PRO MIDI 1284P developer’s boardPosted 2 months ago
Accurate clock just using an Arduino
I started this as an academic exercise, but ended up with a very accurate clock. After running for 5 days, it had not lost or gained any time.
The main issue with using just an Arduino is that its internal clock speed is not 100% accurate. Hence if you just rely on this then the count of the milliseconds elapsed will be out by a small percentage and the clock you are creating will either loose or gain time. My approach was to test the accuracy of the Arduino I was using and determine how many milliseconds it lost or gained per hour. All that was then needed was to program a speed adjustment to add or deduct this difference from the internally tracked milliseconds each hour.
My other concern was whether the Arduino clock was consistently inaccurate, but as indicated, the clock I programmed has maintained very accurate time over 5 days so it appears that the inaccuracy is consistent.
The second issue is that the internal millis() function resets itself every 50 days or so and you cannot manipulate the millisecond count. Hence, the answer was to replace the millis() interrupt using a counter that I could manipulate and that would count the milliseconds from midnight, resetting each day removing any run time restrictions.