DS1307 reading time

Hello,
I am having issues making a clock. Mainly the clock part. I was wondering if anybody has an reccomendations for a 1307 RTC library. there are so many and I don't know which to use.

I just want to be like, this is the time in the void setup and then in the loop just read the time and display it on a 7 segment using other code.

I use this GitHub - davidhbrown/RealTimeClockDS1307: Yet another DS1307 Real-Time Clock library for Arduino (obsolete) library and am very happy with it, though I'm not so happy with the accuracy of the DS1307 (mine looses 7.6 seconds per day but have found a clunk way to improve it).

reccomendations for a 1307 RTC library. there are so many and I don't know which to use

Have you actually tried any of them?
Experiment.

Pete

Riva:
I use this GitHub - davidhbrown/RealTimeClockDS1307: Yet another DS1307 Real-Time Clock library for Arduino (obsolete) library and am very happy with it, though I'm not so happy with the accuracy of the DS1307 (mine looses 7.6 seconds per day but have found a clunk way to improve it).

Unhappy with it? Is there a better RTC? I thought that in order for it to be called a RTC, it had to be accurate.
do you use a seperate chip?

The DS1307 does not contain a crystal to provide the clock pulses. Its accuracy is entirely dependent upon the accuracy of the external 32.768kHz crystal that is used to generate the clock signal.
If you want more accuracy you could try the DS3234 (SPI) or DS3231 (I2C) which use an internal temperature controlled crystal oscillator. They are specified as being within two parts per million which is a bit less than plus or minus three seconds per month.

Pete

Okay thank you!

As el_supremo says the DS3231 is a very accurate RTC I have six of them now and am very happy with them. Compared to the DS1307 the DS3231 does not have the few bytes of memory but it does have temperature and 2x definable alarms.

By the time you buy that hardware and get the code to set/reset it it is cheaper to do a GPS... the time signal only needs 1 or 2 sats... works for me...

Doc

Docedison:
By the time you buy that hardware and get the code to set/reset it it is cheaper to do a GPS... the time signal only needs 1 or 2 sats... works for me...

I would love to have GPS accuracy in my clocks but they don't pick-up a signal in the house. I even have a problem picking up MSF radio time signal in some places.

Bad Luck Mine will get basic time almost anywhere, what about a radio kink to a place where the GPS does?... might even have other things to use a "time Code"... as a matter of fact that might well solve a ports issue i have with my Uno... Offload the gps functions and use a nordic radio to "Broadcast" a time code to whatever needed it, I have 2 clock displays now one scrolling and one for my console.Sure would leave me a lot more time for managing the other stuff If I did it that way, I bought a couple of Mini-pro's for $10.00 ea last week. Perfect idea... better I think than trying to get it all working on a Mega as I had intended.

Doc

Riva:
I use this GitHub - davidhbrown/RealTimeClockDS1307: Yet another DS1307 Real-Time Clock library for Arduino (obsolete) library and am very happy with it, though I'm not so happy with the accuracy of the DS1307 (mine looses 7.6 seconds per day but have found a clunk way to improve it).

Yeah, I've mucked around with a bunch of them, and that's the one I eventually settled on as well. The DS1307 library that Adafruit uses (forked from JeeLabs) is a decent start, but I seem to remember running into limitations fairly quickly. IIRC the time setting code was weird? It's been a while.

The DS3231 is nice and relatively straightforward plugin replacement for the 1307, but depending on your budget, the 1307 and supporting crystal/battery/etc can be had for under $2. If you're designing a new PCB, swapping a TH 1307 for a SMD 3231 is no big deal, but if you need to adapt it to protoboard and have to buy a $15 Chronodot or similar, the price differential starts to add up. The 1307 is accurate enough for most applications. Within reason.

Hmmm, good to know. I'm looking at making a watch so it kinda needs to be pretty accurate

Riva:

Docedison:
By the time you buy that hardware and get the code to set/reset it it is cheaper to do a GPS... the time signal only needs 1 or 2 sats... works for me...

I would love to have GPS accuracy in my clocks but they don't pick-up a signal in the house. I even have a problem picking up MSF radio time signal in some places.

If you have electric service inside the house then you have a bedrock-solid pulse source that a Hall sensor should be able to pick up.

I've never done anything with hall effect sensors. I don't understand them. What do they do?

funkyguy4000:
I've never done anything with hall effect sensors. I don't understand them. What do they do?

Sense magnets. You supply power and ground, they provide a signal. Some of them are just high/low when they see any magnetic field, some are pole specific, others are one pole on until it sees the other pole.

Hmm interesting. I've heard of them in applications like joysticks and such on sparkfun but i've never bothered to look into what they are.

Not exactly a library, but I wrote a complete implementation for the DS1307 using I2C a few weeks ago. Of course, it's more for learning since it's not optimized to use the inbuilt hardware of the Atmega. If interested, here's the link to the post:

funkyguy4000:
I've never done anything with hall effect sensors. I don't understand them. What do they do?

They sense magnetic fields. When current moves through a conductor (like wire) it makes a field. Alternating current makes the field change directions.

Hall sensors have an axis to them so you might have to get that aligned. They also come in different packages; some are purely on/off and some you can get analog readings through.

In the US the AC is 60 cycles per second and used to drive clocks since before even transistors. It's also just right to upset heart signals which is why a plugged in radio dropped in the tub is usually lethal.
In Europe the AC is 50 cycle which I have read does not fibrillate hearts.

Note: your power line may be 'dirty'/have spikes but those can be coded for. X10 control systems will also add small waves to the power line, those are the things that use house power as control lines for various devices.

GoForSmoke:
If you have electric service inside the house then you have a bedrock-solid pulse source that a Hall sensor should be able to pick up.

I use my mains ring for networking and this may upset things.

Yea I've read on the X10's
As interesting as they are, I don't think i'll be needing those anytime soon unless I'm going to sense like the earths field. And in that, I'd need a massive low pass filter and a very accurate sensor.