- 3DRAG + MOTORFISH: How to prevent step losses in 3D printerPosted 3 weeks ago
- Motorfish: The stepper does not misses a step (the Firmware)Posted 4 weeks ago
- Motorfish: The stepper does not misses a stepPosted 4 weeks ago
- “Maker Faire Rome – The European edition” returns to the Gazometro OstiensePosted 3 months ago
- Single-chip saturation meterPosted 4 months ago
- Raspberry Pi Relay BoardPosted 5 months ago
- PCB CAD, A SELECTION GUIDEPosted 5 months ago
- Automatic dispenser for catsPosted 6 months ago
- Do you have a mask? RASPBERRY Pi SEES ITPosted 6 months ago
- RFID based Attendance system using Arduino and External EEPROMPosted 6 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.