TimeRTC Question

Hello,

Arduino newb with an (easy I hope) TimeRTC question.

I'd like to have a time clock on the arduino for keeping track of time as well as using the alarms for relay control. I've got the Time library downloaded. When I compile the TimeRTC sketch example and upload to the Ardiuno (Uno). Everythign runs great and prints back to the serial monitor.

The problem I'm having is the TimeRTC is starting back over at 5:00 minutes. It hit's 4:59 and then rolls back to 0:00. With this going on, I'll never get past 5 minutes of the day/time I set.

I've played with the code and can get the time to set etc. Just noticed the rollover problem last night when I left the serial monitor while working on something else.

Is this how the TimeRTC example is supposed to function and I need more programming to get an actual clock? Or, Is there possibly a problem with how I've got the example loaded?

Thanks for your time in advance.

Do you have DS1307 (or compatible) RTC hardware connected to your Arduino?

If not, use the TimeSerial example instead of the TimeRTC example in the Time library.

-transfinite

Thanks for taking the time to reply.

I don't have any DS1307 hardware connected to the arduino. The sketch is loading the basic DS1307RTC library that comes with the Time library.

#include <Time.h>
#include <DS1307.h>

My understanding was that the TimeRTC sketch combined with the Time and DS1307 library would function as a time keeping clock without any hardware required. If my lack of knowledge here is the culprit, please feel free to say so.

I just want to make sure it's my lack of knowledge and not something else thats causing it to roll over at 5 minutes..

Perhaps I wasn't clear. The Time library comes with a number of examples. One of them is TimeRTC.pde which only works correctly with DS1307 compatible hardware. One of the other examples is TimeSerial.pde which does not require any additional hardware to function as a time keeping clock. If you do not have DS1307 hardware connected to your Arduino, you should use that example to implement a software clock. You will have to set or sync the clock every time the Arduino is reset. The Time library comes with an example written in Processing that will sync the clock to the current date and time.

As an experiment, I tried the TimeRTC.pde without any additional hardware, and I also saw it roll over after 5 minutes. Using TimeSerial.pde, it keep correct time after it was synced.

-transfinite

transfinite, thanks for your assistance. TimeSerial.pde is functioning as you described If I send a time by TXXXXXXXXXX .

I'm now trying to synch the TimeSerial.pde using the SyncArduinoClock.pde in Processing. Below is the error output I'm receiving from Processing when running the sketch. The only thing I am changing in the sketch is setting the portindex = 3 (Arduino's on COM3)

Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
processing.app.debug.RunnerException: ArrayIndexOutOfBoundsException: 3

  • at processing.app.Sketch.placeException(Sketch.java:1543)*
  • at processing.app.debug.Runner.findException(Runner.java:582)*
  • at processing.app.debug.Runner.reportException(Runner.java:558)*
  • at processing.app.debug.Runner.exception(Runner.java:498)*
  • at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)*
  • at processing.app.debug.EventThread.handleEvent(EventThread.java:255)*
  • at processing.app.debug.EventThread.run(EventThread.java:89)*
    Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: 3
  • at SyncArduinoClock.setup(SyncArduinoClock.java:47)*
  • at processing.core.PApplet.handleDraw(Unknown Source)*
  • at processing.core.PApplet.run(Unknown Source)*
  • at java.lang.Thread.run(Thread.java:619)*

I'm running Java Version 6 Update 20 (build 1.6.0_20-b02) in Windows 7 if that helps. If anyone has any input on the above errors, it's would be greatly appreciated.

transfinite, thank you again for your time.