Re: ARDUINO MEGA

Hello I’m learning Arduino and found it very interesting. I built a real clock timer. The clock display looks perfect but my problem is TIMING. I used TimerOne library. Here are some parts of my code:

#include <TimerOne.h>

Timer1.initialize(1000000); // 1000000 usec timing
Timer1.stop();
Timer1.attachInterrupt(run_Clock);

void run_Clock(void)
{
clock++;
}

The clock displays seconds, minutes and hours in 12-hour format and 24-hour format. I let it run but it’s quite slow. After few hours my arduino timer is late of few seconds. Can anybody help me with this please… Thanks a lot.

Here are some parts of my code:

Here's some part of my answer: post all of your code. In code tags. And don't hijack unrelated threads.

Why don’t you use a Real Time clock?

http://www.ebay.com/itm/DS1302-Real-Time-Clock-Module-with-CR2032-3V-Battery-For-AVR-ARM-PIC-SMD-HE-/141081719032?pt=LH_DefaultDomain_0&hash=item20d92030f8
Look you can take out the IC and build your won connected to the arduino : ) or just use it as it gets to you.
Then you’ll have time, date and some bytes of memory for storage : ) and since it runs with a battery, you’ll never lose your time setup… cool, no?

but my problem is TIMING.

The forum gets this question every so often... For example: http://forum.arduino.cc/index.php?topic=121088.0

Essentially, while the Arduino has a reasonably accurate resonator, it is not as accurate as a precision quartz/watch crystal. For under $20, you can add a very accurate time base: http://www.adafruit.com/products/255

For constant year in, year out accuracy there are solutions that include GPS or Internet Time Servers. My clock: http://www.hackster.io/rayburne/5-billion-arduino-gps-clock-for-25

Ray

mrburnette: My clock: http://www.hackster.io/rayburne/5-billion-arduino-gps-clock-for-25

Where do you get your Chinese parts? Ebay?

tsunamy_boy:

mrburnette: My clock: http://www.hackster.io/rayburne/5-billion-arduino-gps-clock-for-25

Where do you get your Chinese parts? Ebay?

Dude the hyperlinks in the Build lists on that link has all the sources... both U.S. and China... Repeated here for completeness: Display: http://www.ebay.com/itm/141147721733 OR http://www.adafruit.com/products/1480#Technical_Details (different pinout, same controller)

Pro Mini http://www.ebay.com/itm/Redesign-Pro-Mini-atmega328-3-3V-8M-Replace-ATmega128-Arduino-Compatible-Nano-/200914924969 OR https://www.sparkfun.com/products/11112

GPS http://www.ebay.com/itm/RYG25AI-u-blox-NEO-6M-5Hz-high-performance-GPS-antenna-module-battery-EEPROM-/181326135522 OR http://www.adafruit.com/products/746

Oh, sorry, i didn't notice it was clickable :roll_eyes: