DS-1307 Real Time Clock

SAborn

Senior Member
I had put a kit form of the DS-1307 RTC together a while ago for another group.
Due to discussions in another thread i had posted some of the data from the kit.
This generated a little interest in the information so here is the full kit data altogether. (see PDF File)

The DS-1307 is a wonderful little chip and dispite some timing errors reported on the forum i have not yet encounted such problems, once the chip is written to and correctly setup.

It requires I2C protocol to operate and hence only compatable with the 18X and above with I2C functions.

It do have a SQW/OUT (square wave out) pin that can be set to several frequencys including a 1Hz signal, and you do not need I2C to read this pin, so once programmed it can be used as a time base with 08m's etc if a accutate 1Hz signal is required.
It will need to be programmed with I2C first.

It has a backup battery pin that will allow the chip to retain settings and memory if the main power supply is disconnected.
A lithum 3 volt cell will give in excess of 10 years backup operation without the need to recharge or replace the battery.

It also has Leap-Year Compensation Valid Up to 2100 so it should see most of us out for the next 90 years.
.
.
.
 

Attachments

axeman22

Member
I've been having a lot of fun with RTC's - I started with a DS1307 as they're easy to procure etc. I found it quite inaccurate but yes that was my fault due to extra capacitance in the patchboard I was using.

it was suggested to look at the DS3232.. I did some research and liked the idea of everything being in inside the chip(crystal I'm really talking about, the DS1307 it is separate) aswell as being temperature compensated etc.

Problem was.. you can only get them in a Surface mount package which was a bit of a pain. Anyway, I purchased some direct from maxim-IC online and I also found a SM Chip to DIP converter which worked a treat. Having never done

I would highly recommend anyone who is looking at using RTC's look to the DS3232, for my own personal experience is it a much better chip - all things considered.

URL for DS3232

pro's
+ Temperature compensated (keeps it super accurate)
+ XTAL built into chip so no external XTAL issues
+ it has an onboard temp sensor which you can read and it is very accurate.
+ it has 2 'ALARMS' which can be set to raise an interrupt line etc.
+ very accurate

con's
- at the time I looked I could only find it in SM20 form factor
- if you haven't soldered SM chips before then you need to do some learning.. I looked on youtube etc and found that it was not that hard - I never even killed one chip! (I found this guide to be very helpful)
- not as readily available as the DS1307
 
Last edited:

westaust55

Moderator
Another option that I have been using is the DS1338. Several verions avaiable.
8 pin SOIC8 which does not have internal crystal and is essentially same as DS1307 but works on fast i2c bus speeds as does the DS3232. Put it on an SOIC8 to DIP8 adapter and (same footprint as 8pin DIP socket is available) and drop it into any DS1307 socket.

16 pin version as DS1338C in SOIC16 includes the crystal within the package.

I have been running DS1338Z-33 (3.3V version) versions at 5Vdc (Absol Max 6Vdc) without problems.

I do note the DS3232 is "truly" rated for normal use up to 5.5V again with Absol Max of 6Vdc.
 
Last edited:

SAborn

Senior Member
My advice to anyone wanting a DS-1307 RTC is buy a complete assembled board with backup battery off Ebay as there is often several stores selling them for a fraction more than you can buy the chip for.

Its the beauty about I2C devices as it is plug and play interface to a common I2C bus.
 

axeman22

Member
My advice to anyone wanting a DS-1307 RTC is buy a complete assembled board with backup battery off Ebay as there is often several stores selling them for a fraction more than you can buy the chip for.

Its the beauty about I2C devices as it is plug and play interface to a common I2C bus.
here is a link http://cgi.ebay.com/INBOARD-RTC-DS1307-Board-I2C-PIC-AVR-ARM-/270588109335?cmd=ViewItem&pt=LH_DefaultDomain_0&hash=item3f004ee217

- Priced at $16.60 USD incl freight worldwide.
- whilst this looks good as it's a complete built up board it's still not temp compensated.. so no accuracy to mention here.



Another option that I have been using is the DS1338. Several versions avaiable.
8 pin SOIC8 which does not have internal crystal and is essentially same as DS1307 but works on fast i2c bus speeds as does the DS3232. Put it on an SOIC8 to DIP8 adapter and (same footprint as 8pin DIP socket is available) and drop it into any DS1307 socket.

16 pin version as DS1338C in SOIC16 includes the crystal within the package.

I have been running DS1338Z-33 (3.3V version) versions at 5Vdc (Absol Max 6Vdc) without problems.

I do note the DS3232 is "truly" rated for normal use up to 5.5V again with Absol Max of 6Vdc.
I can't see why you would go the DS1338 over the DS3232.? I've had a look at both and tried to see the differences - from what I understand the DS3232 main difference is the temperature compensation.

Both are SOIC! - which sucks.. I've been looking for a RTC that has the properties of the DS3232 (in particular the temp compensation) and can't find such a beast in a DIP package... Can anyone help there?

In australia I can get a DS3232 (SOIC20 package) for cheap cheap.. But I have had to resort to getting the SOIC to DIP converter from the US and got hit with $30 postage! - if anyone can advise of a good SOIC20 to DIP converter which is still cheap from Australia (ie postage logistics) please do post a link here.

So for those reading this thread.. I'm become somewhat obsessed with these RTC's and in particular one which is accurate (we're not talking STRATUM-0!, but still quite accurate). From my research and testing it seems that in order to achieve this goal the chip needs to be temperature compensated. From what I understand clock accuracy is linked to the accuracy if the input OSC - like a XTAL or and square wave etc... But if that wavers then so does clock accuracy. If you have a RTC which requires a input OSC to run it.. Like a XTAL for example on the DS1307 then any stray capacitance on that (which varies with temperature) will affect Accuracy. The DS3232 is continually checking itself (every 63 seconds from memory) to see what temp it is and then adjusting the internal capacitance against a lab determined table to keep things on song - indeed, it works very well.

So the closest thing I have found to date that gets near these points is the DS3232 but it is SOIC20 package.. Apart from that - it's ideal..

I think also that the DS1307 and a DS32khz is quie a good option.. But not ideal..
Pro : DS32Khz is Temp Compensated
Pro : DS32Khz is DIP as is DS1307
Con : using DS32Khz and DS1307 means you have TWO chips.. Not all in the one chip
Con(?) :I can't find an Australian stockist of DS32Khz which means expensive proposition with shipping.

To all you RTC lovers out there... Lets see if we can find that perfect RTC for PICAXE projects etc..

Here is the spec...:
- MANDATORY : onboard xtal or OSC etc (ie inside the chip package)
- MANDATORY : temp compensated
- MANDATORY :DIP package (SOIC is fine but a bit of a pain to play in a lab with)
- MANDATORY : stocked by Australian supplier - like au.farnell.com for example.
- DESIRABLE : Onboard Alarm(s)


Let the hunt begin..:):D
 

westaust55

Moderator
Both are SOIC! - which sucks.. I've been looking for a RTC that has the properties of the DS3232 (in particular the temp compensation) and can't find such a beast in a DIP package... Can anyone help there?

In australia I can get a DS3232 (SOIC20 package) for cheap cheap.. But I have had to resort to getting the SOIC to DIP converter from the US and got hit with $30 postage! - if anyone can advise of a good SOIC20 to DIP converter which is still cheap from Australia (ie postage logistics) please do post a link here.

So for those reading this thread..

In the past I (and Dr A purchased SOIC20 to DIP adaptors via ebay from a local Australian seller.
See: http://www.picaxeforum.co.uk/showthread.php?t=13347&page=2
Unfortunately taht link no longer works.

At the time (Sept 2009) the seller was selling adapters ranging from 8 pin to around 40 pin. Recollection was prices were not the cheapest - maybe around $1.50 or $2-00 ea.
I had from a separate Ebay seller in Sydney purchased around 50 SOIC8 to DIP8 adapters for $0.50 each.

Try a search on Ebay and elsewhere again (I do not have Ebay access from my current location). You may be lucky.
 

SAborn

Senior Member
The ds1307 RTC is small enough that it could be put in a crystal oven to maintain temp if really needed.

I dont know why you guys just dont learn to make your own dip adaptor boards as its very simple and a small sheet of positive resist coated circuit board is cheap and you would make 100s of adaptor boards from it.

If i can do it so can the rest of you.
 

axeman22

Member
I dont know why you guys just dont learn to make your own dip adaptor boards as its very simple and a small sheet of positive resist coated circuit board is cheap and you would make 100s of adaptor boards from it.

If i can do it so can the rest of you.
alright alright.. making Cct boards is sommething I'm YET to do.. granted, it is a bridge I need to cross.. I guess I am just suprised that there is not something out there that fits the bill as DIP.. there must be!
 

westaust55

Moderator
@axeman,
Now I am home with Ebay access, have a look here:
http://stores.shop.ebay.com.au/stuffdownunder__W0QQ_armrsZ1

@SAborn,
been there done that.
Used to design some very sophiosticated boards in the past up to A4 size for digital circuits associated with microprocessors. But stopped doing that 25 years ago. Only 2 years ago got back into such goodies :D

Don't believe I can make them for prices around AUD$0.50 to $1.50ea, considering, materials, labour, electricity, water, etc. Postage would be coutered by travel costs to gets the materials.
 

SAborn

Senior Member
I dont know about that, as you would do a few at a time like 100 x 100 mm square and this would yeild a lot of dip boards. (way less than $0.50)

I pay $30.00 for a full sheet 300 x 450mm and would hate to think how many dip boards you would get out of one of them.

Although smaller sheets are avaliable, i just like the big ones as i chew through it rather quickly.

I really dont understand the phobia many have to making circuit boards as it is not expencive or difficult to do.
I think many try to make that tiny little board with ultra fine tracks first up and stuff up big time and then its too hard.

A few basic chunky track boards to find your feet and refine the procedure and then scale it back until you reach your limit.

Lately ive been making boards with tracks i cant even bloody see without magnifiying.
Then the challenge is soldering those little spider legs in place.

I really dont like SMD stuff, and the older i get the less i like it....now thats a worry???
 

axeman22

Member
Hey SABorn.. you have got my interest up.. could you tell me hwo you do this - do you use software, a laser printer, how do you drill the holes.. etc etc..? I've done a little googling and looked at some uTube vids but I'm a bit perplexed as to where to start - I guess I will NEED a little bench drill ..?
 

SAborn

Senior Member
Hi Axe,

I done an article on a different forum some time back how i made boards.

Have a look at this first than ask questions. It might save me a lot of typing.


http://www.thebackshed.com/windmill/articles/MakingPrintedCircuitBoards.asp

There is many ways to do various steps of the proceedure.

I used a dremel for years to drill the boards, and now you can get the dremel ripoffs very cheap and they work well.

Yes it is best to mount them on a small press of some sort.

A friend of mine duct taped one to a home brew bottle cap press and it worked well.

Have a look and then ask question as i am active on both forums.
 

Grogster

Senior Member
I am looking at using a RTC in my latest project. I have been reading this thread, and like the look of the premade modules linked to by axeman22. I have not had a-lot of sucess using I2C before, so how painful are these to read?

I can't find the DS3232 here, but the 1307 is easy to come by.
I am not really that worried about a few lost minutes here and there over time, I just need a date-and-time reference for data logging.

EDIT: Does anyone know of any premade modules like this with the more accurate DS3232 chip on them?
 
Last edited:

axeman22

Member
I am looking at using a RTC in my latest project. I have been reading this thread, and like the look of the premade modules linked to by axeman22. I have not had a-lot of sucess using I2C before, so how painful are these to read?

I can't find the DS3232 here, but the 1307 is easy to come by.
I am not really that worried about a few lost minutes here and there over time, I just need a date-and-time reference for data logging.

EDIT: Does anyone know of any premade modules like this with the more accurate DS3232 chip on them?
Well, I just love the DS3232 - apart from the cost and form factor. I2C is easy as pie.. you can read the temp in easy also. It's super small, super accurate and a real top performer.. I still love it, all things considered.

I have just received a DS32Khz which I plan to use with a DS1307.. I think that will give good timing and both in DIP form factor. David from microzed Australia put me onto that idea - it negated capacitance issues from the xtal etc.

I just think time, should be accurate.. I was really quite amazed how much the DS1307 would drift around.. and then the DS3232 just solved all my woes in a nip.

I also found soldering the DS3232 to a converter to be quite easy.. but you do need a steady hand and good eye sight.

I was actually thinking about making up some DS3232's on converters and selling them.. hmmm...
 

Grogster

Senior Member
I would use the 3232, if I could get some - I might try Farnell, that's where i get all my other SMD regulators from Microchip etc...

Will have a look at the datasheet for the 3232 anyway.
I guess standard SOIC spacings of 1.27mm?
 

BeanieBots

Moderator
@Grogster,
I2C and the DS1307 is very simple. Two wires (plus pull-up resistors) and it's as easy as reading EEPROM.
Just one 'gotcha' waiting in the wings. The data is BCD but even then, PICAXE has commands to help out.

Also, the data-logger wizard can be used to get code examples and set the clock.
As for accuracy, with a little care it can be very accurate. Throw it together (crystal connections) and it can be a long way out.
 

Grogster

Senior Member
There appears to be two flavours of the 3232 that I can get from Farnell:
3232S and 3232SN.

Which is the one you guys use?
 

axeman22

Member
BB - you're usually on the money so - respect - :)

seriously though - what would your guidelines be for making a 1307 accurate? I'm thinking unless you put it in a temp controlled environment or us a DS32Khz to negate the XTAL it will never be that flash - no?

granted, the 3232 is good, but getting them not as easy as the 1307 - might be worth the effort to make the 1307 work better..

Note : I'm still stead fast in love with the DS3232.. it's an engineering thing (3232, I will never turn my back on you :) )
 

BeanieBots

Moderator
Quite right axeman22, it's largely down to the crystal.

With the DS1307 it's all about the crystal and load capacitance.
The datasheet will tell you what you can expect. You are in control.

With a device that has it all built in, the device is in control. What you get is what you get. Hence, it is actually possible to make the DS1307 MORE accurate but you need the right crystal and implement it properly.

In practice, simply keeping the crystal leads short and the PCB area clean yealds good results from the DS1307 but it can only ever be as good as the crystal used.
 

Grogster

Senior Member
Note : I'm still stead fast in love with the DS3232.. it's an engineering thing (3232, I will never turn my back on you :) )
I can get them from Farnell, but they would actually come from Australia.
I see that the only difference between the two versions, is that the SN one can operate over a much larger termerature range. The standard S one would suit me fine.

NZ$14 each vs NZ$7.50 for the 1307.
However, you get what you pay for...

I will design using the 3232 - I will probably be back here for more help axeman22!!!

I have to read some datasheets, but I would like to be able to log time AND date, and these chips seem to be able to do that. I think the 1307 does too for that matter.

I will be using a 28X2 PICAXE as the controller.
 

axeman22

Member
Looks like the 1307 is back on the menu then.

Getting a little confused as to which one I should use.
hmm - have you seen my post on my blog ..?

Happy to help and share code..

BB I think is on the money, but with a DS3232 you will be impressed.. how's about I send you one and you can square me up..? I'll re stock..

Will send a few more pics soon..! (about dinner time here) .. and soo cold! - with the DS3232 you can log the temp also.. :)
 

axeman22

Member
Looks like the 1307 is back on the menu then.

Getting a little confused as to which one I should use.
if you want to have a chit on the phone (love my accent) email or PM me your number and I'll give you a call later on this evening, looks like you're in Kiwi land..
 

Dippy

Moderator
Ultimately, it's up to you Groggy.

With the 1307 you have more control. True, but also more potential to mess it up. Will I buy the cheapest crystal on God's Earth? Yes.

I have used the DS3232 in a real project. Remember it is temperature and age compensated. The DS1307 is nothing compensated.

In my tests over a few weeks the DS3232 peed all over the DS1307 in terms of accuracy. And gave a half-reasonable thermometer as a bonus.

Apart from cost and availability problems I wouldn't think twice as to my choice in terms of performance betwen the two.
(My design was for a production project that was dumped due to 6 month lead times from Dallas/Maxim for the DS3232).

Or maybe look at other makes?
I've never tried them but there are loads, including Epson RX4045 and Phillips/NXP PCF8593.
And then there's ST M41T81 which has software clock calibration.

Makes it even more tricky to choose doesn't it :confused:
 

Grogster

Senior Member
Reading lots of data.
@ axeman22 - Have already ordered a couple from Farnell, but thanks very much for the offer. :)

@ Dippy - Yes, getting confusing!!! :D I think I will just go with the 2323's and see how we get on. There will be another thread shortly on how I go about talking to it...
 

Dippy

Moderator
What's a "2323"? Is this a new device? (Or twitchy fingers?).

Well, in practice, it's a posh 1307. Not much more to say about it really.
But, if you get the same performance results that I did then you'll be a happy chappy.

I did have a quick fiddle a few years go with NXP's RTCs after getting Mikro C , but I soon changed to DS RTCs.
 

axeman22

Member
Grogster : Be sure to post pics and share your code/thoughts! :)

I think you asked about the two variants of the DS3232 - there is one which is effectively MILSPEC - of course, I HAD to take that one.. after all, someone could fire Depleted Uranium shells into my project and without the super accurate, temp tolerant one, well, I'm be getting false readings :)

Seriously though.. either is fine, I would normally go the cheaper one but prices were very close so I took the better one.

you'll love the DS3232, once you get yourself some code going it is great,very set and forget.
 

axeman22

Member
......And gave a half-reasonable thermometer as a bonus.
Hmm - how do you make that claim? not debating it but.. do you have a block of solid 10degrees Celsius unobtainium which you use as a reference or..?

you know what I mean.. I was thinking, is the Themo in the DS3232 better than the Dallas one wire DS18B20 ..? but had no idea how to measure against a known ref etc.?

:confused:
 

Dippy

Moderator
Axeman, re: thermometer.

How can I make that claim?
Because I've tried it maybe? ;)
Besides, I don't think the phrase "half reasonable" is much of a claim to mega-accuracy is it?
That's why I said "half reasonable" - this means 'fairly good' or 'OK-ish but not amazing'.

I've checked a couple of DS3232s against a couple of thermos and got "half reasonable" results. i.e. a few degrees here and there.

Is it better than the DS18B20. No - read the Data Sheets for the devices and do some tests for yourself.
 

axeman22

Member
Axeman, re: thermometer.

How can I make that claim?
Because I've tried it maybe? ;)
Besides, I don't think the phrase "half reasonable" is much of a claim to mega-accuracy is it?
That's why I said "half reasonable" - this means 'fairly good' or 'OK-ish but not amazing'.

I've checked a couple of DS3232s against a couple of thermos and got "half reasonable" results. i.e. a few degrees here and there.

Is it better than the DS18B20. No - read the Data Sheets for the devices and do some tests for yourself.
just not something I understand so well.. might have to get into the weeds on the PDF's at some stage there.. thanks for clearing it up though :)
 

Dippy

Moderator
DS3232 Data Sheet Page 1 : - "Digital Temp Sensor Output: ±3°C Accuracy"
DS18B20 Data Sheet Page 1 : - "+/-0.5 oC accuracy from -10°C to +85°C"

No weeds, just 2 minutes :) Not too much of a struggle eh? ;)
For more details you would have to read further... could take another few minutes.

Checking is another issue, but that's your job. Good luck.
 

marks

Senior Member
Hi,
you can also get a ds3231sn about $10 au from ebay delivered
and the dip convertor boards from futerlec about 0.80c

temp accuracy of the ds18b20 far better 0.5 +- degrees
ds32xx is +- 3 degrees

might try 1 to next time i get somethng from futerlec lol

the ds1307 does a good job tho lol proberly better to get ready made board
as ppl seem to hav problems with cystal and board layout causing inaccuracy.
 

axeman22

Member
DS3232 Data Sheet Page 1 : - "Digital Temp Sensor Output: ±3°C Accuracy"
DS18B20 Data Sheet Page 1 : - "+/-0.5 oC accuracy from -10°C to +85°C"

No weeds, just 2 minutes :) Not too much of a struggle eh? ;)
For more details you would have to read further... could take another few minutes.

Checking is another issue, but that's your job. Good luck.
DIPPY - I think you're taking the pi## just a bit too much!! :)
 

Dippy

Moderator
Little ol' me... take the pee?
Nah.:rolleyes:
Merely saving you time and effort through kindness and generosity.
 

axeman22

Member
Hi,
you can also get a ds3231sn about $10 au from ebay delivered
and the dip convertor boards from futerlec about 0.80c

temp accuracy of the ds18b20 far better 0.5 +- degrees
ds32xx is +- 3 degrees

might try 1 to next time i get somethng from futerlec lol

the ds1307 does a good job tho lol proberly better to get ready made board
as ppl seem to hav problems with cystal and board layout causing inaccuracy.
well I'll be - I had spent the time a ways back looking at all these different RTC's etc.. I never (god knows how!) came across the DS3231 - looks functionally the same as the DS3232 but just without the SRAM (which have no need for anyway).

You're right there are quite a few on eBay - cheap.. no DS3232's though.. perhaps that says something in itself.

haven't been able to find any adapters as nice as these(attached) locally here in AU :-( everyone has the ugly boards where you have to add you own pins etc and it ends up quite wide.
 

Attachments

axeman22

Member
Whilst on this subject.. is there a 'typical' RTC etc that watch manufacturers use.. or do they just cut some ASIC just for their purpose etc..?

excuse what is probably a dumb question.. I know the DS3232/DS3231 would be tooo big.. no idea what they use.. but interested..
 
Top