Go Down

Topic: DS1302 RTC acting weird (Read 269 times) previous topic - next topic

Delta_G

DS3231.

That's the one I used. 

Hey sorry about earlier, I got confused between this thread and another where they were using Wire and SoftI2C at the same time and were running into issues that Wire would have solved.  For some reason I got the two threads confused and didn't know what I was talking about. 
If at first you don't succeed, up - home - sudo - enter.

Lumis

I suggest to use a standard I2C RTC module like the DS1307 or (much better) DS3231.

These are readily available and are what most people use, so there is much more help available if you run into trouble.
yeah I heard that... I have already ordered DS3231. But shipping to my country sometimes takes more than 1 month so I thought to play around with DS1302 while waiting because it's the only module what local store can offer.

tigger

The DS1302 is a real time clock but works with a trickle charger for battery back up. Unless you specifically want that feature, most folk start with the DS1307 or the more accurate DS3231. DS1307 is available in DIP8, but the 3231 comes in a SOIC package - just use a SOC to DIP adaptor
There are libraries for both for example DS1307RTC (the DS1307 and DS3231 are pretty much interchangeable with these libraries if you just want the basic times and dates)
You will also need the Wire.h library for comms and TimeLib.h to really get at the functions.
If you really want to get down to basics and work without a specific clock library, have a look athttp://tronixstuff.com/2014/12/01/tutorial-using-ds1307-and-ds3231-real-time-clock-modules-with-arduino/
Have a look at Paul Stoffregens Github repository (look for DS1307RTC library)
Jack Christensen has a TimeZone library if you want daylight saving etc.
Just using the DS1307RTC library and one of the examples like ReadTime or SetTime will get you started
The TimeLib library takes the time from the RTC - nice combination

Delta_G

The TimeLib library takes the time from the RTC - nice combination
Yup, use the setSyncProvider method and you never have to think about the RTC again.  Just pretend that the time library is accurate now. 
If at first you don't succeed, up - home - sudo - enter.

Go Up