SparkFun will be closed on Tuesday, November 5th to support our team in being able to go out and vote! Orders placed after 2 pm MT Monday, November 4th will ship on Wednesday, November 6th. Thanks for your patience and understanding.
This a custom designed module for the DS1307 Real Time Clock. The module comes fully assembled and pre-programmed with the current time (ok, so it's * our current time - *MST). The included Lithium coin cell battery (CR1225 41mAh) will run the module for a minimum of 9 years (17 years typical) without external 5V power. The DS1307 RTC is accessed via the I2C protocol. We've written a test-bed to program the modules. This test-bed code should give you some insight on how to interface the module to any microcontroller using our example software I2C and BCD routines.
**Software: **
This skill defines how difficult the soldering is on a particular product. It might be a couple simple solder joints, or require special reflow tools.
Skill Level: Noob - Some basic soldering is required, but it is limited to a just a few pins, basic through-hole soldering, and couple (if any) polarized components. A basic soldering iron is all you should need.
See all skill levels
If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.
Skill Level: Competent - The toolchain for programming is a bit more complex and will examples may not be explicitly provided for you. You will be required to have a fundamental knowledge of programming and be required to provide your own code. You may need to modify existing libraries or code to work with your specific hardware. Sensor and hardware interfaces will be SPI or I2C.
See all skill levels
If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.
Skill Level: Rookie - You may be required to know a bit more about the component, such as orientation, or how to hook it up, in addition to power requirements. You will need to understand polarized components.
See all skill levels
We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.
No reviews yet.
So that others might benefit, I am posting my recent experiences with this breakout board. At first, I thought I had a bad board, but after a day of troubleshooting I found the issue. The symptoms were that the board would accept commands, update the time and provide accurate time readings when 5V were applied to the board, but when the power was removed, all registers would zero out. I tested the battery and it was showing a nominal 3.2V, so looking further, only 20 to 40 mV were seen at pin 3 when the battery was in the holder. Seems as if the battery is shorting itself out on the + solder pads where the battery holder is soldered to the board.
To rectify the problem, I inserted a piece of aluminum foil between the battery and the - battery contact on the board, this lifted the battery enough so that it would clear the + solder pads on the sides and prevent the short from occurring.
I am currently debating on either leaving it as is or returning it for another unit, but since I soldered a header on the board and it is working, I may end up keeping this one.
Same problem, same fix. If I was really good, I'd try to resolder the battery holder, using less solder. But the aluminum foil trick worked so well, why bother :)
Neema20,
I had the exact same problem; the battery was shorting on the positive solder pads on the right and left. A piece of aluminum foil did the trick. The voltmeter read .05 volts from pin 3 of DS1307 to ground prior to the mod. After the mod, 3.05 volts. Great find and thanks for posting.
Sparkfun, why not put the pull-up resistors on the module for us with jumper to disconnect if necessary?
Just ran in to this problem today! I was using a Mikroelectronica DS1307 development module (they call it the RTC2). Transferring my design over to 'production' hardware, I decided to use the Sparkfun DS1307 module. It wouldn't work! After about 20 minutes of trying to measure signals on the pins, I finally figured out that there's no pull-up resistors.
Was just going to post this as well. Would make it convenient and help get it up and running without errors, which is what this board's about!
Hi,
I wrote a C# driver targeting the netduino for this clock module. You can find the code and details here:http://fabienroyer.wordpress.com/2011/01/03/keeping-track-of-time-on-a-netduino-using-a-maxim-ds1307-real-time-clock/
Cheers,
-Fabien.
For Arduino Uno users -
I have built on the code John Vaughters included in his tutorial (nice job, btw). Created an RTC library and added the class accessors listed below. Plus, I have a test harness that exercises the library. This is a work in progress (still a little rough, a little light on comments), but if you are just getting started with this nice little 1307 breakout board, perhaps my work might be of some use. Plus, I could use the feedback.
ezcook57@gmail.com
void getTimeDate(struct timeDateContainer* workingPtr);
void printTimeDate(struct timeDateContainer* nowPtr);
void setSeconds(int seconds);
void setMinutes (int minutes);
void setHours (int hours);
void setDayOfWeek (int dayOfWeek);
void setDayOfMonth (int dayOfMonth);
void setMonthOfYear (int monthOfYear);
void setYear (int year);
bool is12HourModeEnabled(void);
byte isItAMorPM (void);
void setAmPm (int amPmDesignator);
void set24HourMode (void);
void set12HourMode (void);
void turn1307On (void); - not yet implemented V 4.0
void turn1307Off (void); - ditto
void readMemoryBlock (byte destinationArray[],
byte numberOfBytes,
byte startingOffset);
void clearMemoryBlock (void);
byte bcdToDec(byte val);
byte decToBcd(byte val);
// should be able to use byte instead of unsigned char?
void I2cWriteUtility (unsigned char newValue,
unsigned char dataOffset,
unsigned char dataMask);
unsigned char I2cReadUtility (unsigned char dataOffset);
Is there any way you could create a module that runs on 3.3V as well?
I found that the DS3231 to be a fantastic replacement. The DS3231 will function with a VCC ranging from 2.3V to 5.5V and has a battery backup. Unlike the DS1307, the DS3231 also has an integrated crystal (so no external crystal required), temperature sensor, 2 programmable time-of-day alarms, a 32.768 kHz output pin, and a reset button debounce circuit. And the DS3231 only costs a dollar more (DS1307 cost is $1.36/1k and the DS3231 is $2.55/1k).
We are currently working on a rev
Any idea when that's going to be ready?
It's in the testing phase, so week or a few?
Any more news on the updated module?
Take a look!
That was almost 8 weeks ago, is there any further information available. What chip will it be using. We need an accurate I2C clock w/o trying to mount surface mount chips our self!
For all who want a drop-in I2C replacement, Check out the DS3231 breakout from lovelectronics. Just got mine for a clock project that I'm working on. The new SparkFun DS3234 is good and all, but it is SPI.
same price and everything? i think it would be great for my project
I see that the schematic is for v1.3 and I was wondering if its the same for v1.4? Also, is that a 0 ohm resistor? One last question, what size coin-cell battery holder is that? BOM? Any help would be greatly appreciated!
We haven't released v1.4 yet, but when we do, the new schematic and board files will be posted. The battery holder is available here.
This module has the following: IC ($1.35), crystal ($0.27), holder ($0.27), 0.56 sq in pcb (~$0.15) capacitor ($0.04), CR1225 (~$0.20) and assembly (~$0.15) for a grand total of $2.43, this even before negotiating with suppliers on volume pricing. Does anyone else think this module is overpriced? For that matter, do all Sparkfun products have such ridiculous margin (approx. 515% margin in this case)? If the answer is yes, I see a real business opportunity here!
Go for it! Let us know how that business turns out for you.
How can you use this item with the pcDuino or Raspberry Pi??
.
Yes thanks indeed to John Vaughters. I'd have never got this running on my own. Comments below mentioned pull up resistors. There were none shown on the schematic? So now that I have the clock set, I want to read it as a time stamp for a logger. I'll have to use the libraries and whittle the code for my application. It feels like cheating but I'm still toddling along learning the code and the syntax
Anyone seen a shield for MCP79410 or PCF85063 ? These are quite a bit cheaper than DSxxx clocks. Microchip has AC164140 and NXP has OM11059A,598 SKU for eval, but of course they arent as neat as ones here ..
Just hooked mine up. WOW so easy! I removed the battery to solder it, so the time was 1-1-12 0:0 (or whatever) when I tested it (as I expected). I read through all the comments on here but I liked this guy's example the best. Simple, easy, and got `er done. BTW, that link was http://arduinotronics.blogspot.com/2010/10/ds1307-real-time-clock-working.html
The libraries are nice, but my project has more crap connected to it than anything I've seen anyone else do with an Arduino, so I didn't want yet another include file. The above was nicely KISS.
I wrote a dinky little GUI in java for this device if anyone wants to check it out. Its at my site: http://www.servophilia.com/java.html
does this work at 3.3v?
Nope. You'd want to look at DeadOn RTC - DS3234 Breakout which is an SPI device, or Eric Falsken's suggestion DS3231 Real Time Clock Module / ChronoDot - Ultra-precise Real Time Clock - v2.1 which use the DS3231 which is an I2C device
Is there a serial RTC?
Only up to year 2100? I excpect a new millenium crisis!
It's worse than that.
Is it possible to get one of these preprogrammed to the time being transmitted from Fort Collins, Colorado By WWVB (and even better delivered before it gains or looses a full second....)?
I like it
Sparkfun, the datasheet is also silent (or at least vague) on the issue of accuracy. Could you please provide a reasonable explanation as to how accurate we can expect this clock to be?
The datasheet is vague because the accuracy ultimately depends on the external crystal. You should expect these to gain or lose up to 30 seconds a month, the same as an average wristwatch.
I'm not at SparkFun, but judging from the comments above I'd say I wouldn't rely on this being particularly accurate at all. It'll be good enough for rough time keeping purposes, but if you want something better, check out DeadOn RTC - DS3234 Breakout, or even start looking into radio-signal or GPS controlled modules. That said, I'm not sure where the inaccuracy is coming from. This component relies on the crystal and its internal bias offset to get any level of accuracy. While crystals can and do swing (with temperature, for example), they're do pretty well in the hundreds of millions of watches out there. I'd be inclined to blame the internals and would almost thing that not having the bias - and instead relying on external capacitors where you can do some tuning yourself would give more accurate results than the solution they (Dallas) chose here.
This thing is not very accurate, as others have noted. However, the one I have is very stable. Using this device to produce an accurate time requires a little software to remove the drift. If you do this, it's better to let the clock drift and compute a correction than to occasionally reset the clock. Two of the 56 ram bytes can be used to store a reference time. I have a clock that is working well with this approach.
im having a problem with the module returning for hours minutes and seconds 165:165:85, intermittently... i think it is a power problem, because my arduino mega also freezes.
I am having the same problem. The ds1307 worked fine for several weeks, but then it started showing 165:165:85, etc. I've tried various sketches but it acts as though it has failed. Did you ever find an answer?
hii guys..i also got a problem working with ds1307...in my case i got ds1307 working with atmega 8 and i get the correct time display..but when i use atmega 168...it shows 0:0:0...time is not getting display.... my hardware is working perfect.......can anyone help me with this????
The DS1307 is a nice device, but it doesn't keep time very accurately. Its good for a out a minute a week. If you need better timekeeping try the DS3234, its good for about 1 second a week.
While simple, the DS1307 was a bad choice: operating voltage 4.5-5.5V. There are TONS of other great (and cheaper) RTCs which operate as low down as 1V!!!!!
Hi guys, We have just purchased the RTC module from Sparkfun and we thought we could use the "Example 16F88 code" listed above to write it to our PIC16F88, but we have to use the pic basic pro compiler to get it there. We are really new to all of this so we are anxious to learn. Does anyone have code examples that we could use? Thank you for any suggestions.
I followed these directions using analog pins 4 and 5 with my Uno. Ran these 2 sketches:
http://bildr.org/2011/03/ds1307-arduino/
Got
0/0/0 0:0:0
0/0/0 0:0:0
0/0/0 0:0:0
0/0/0 0:0:0
...
Please help!
I found despite the claim that the clock would come preset with the time at Sparkfun that my clock also reported the time and date as zero's. Find an example (link above I think) that will show you how to set the time. Then once you do that it appears to keep the time just fine even with no power.
Can you guys sell the DS1307 alone? I need it for a project and I don't want to solder this board to a PC board...
I second that! It is amazing that Sparkfun doesn't already have a simple, 8 pin, I2c chip.
Wow, be aware, while this is a fine chip for learning purposes (i2C)at stable room temperature it looses about 60 seconds per week.
BTW, this I2C buss chip works fine at 5VDC with the HMC Compass chip on the same I2C buss. I2C pull down resistors either 4.7k or 10K are part of the MHC compass chip.
We have a more accurate one here
That's fine but there's nothing on the description of the module that indicates that the accuracy is poor. It's not ok to be selling a clock circuit that doesn't keep time fairly accurately without a big caveat on the product description page. Mine is losing a second every three hours and your reaction is "oh well, we have a better one" - not ok you guys.
After modifying some simple code from the Revolution Ed PICAXE forum this little clock operated fine with a 20X2 C.1 firmware. My first I2C experience. Anyway, the draw back is setting the exact time to the second. I guess it would not take too long to write code to read a GPS and synch the time. Another night ...
Yet another library: https://github.com/davidhbrown/RealTimeClockDS1307
Includes example sketch that (via Serial monitor) allows you to set the clock, accurately toggle AM/PM, enable/disable the square wave generator, and read/write memory.
I wanted to use the square wave output to trigger an interrupt and use the battery-backed RAM for a data logger project, so I needed a library that would do a little more than just read the time.
Hello guys,
I wrote a library to make setting and getting date/time from DS1307 easier on Arduino.
The code is available at:
https://github.com/turicas/DS1307/
Please let me know what do you think and, if you want, put a link to this library in the product description.
Hi turicas, thankyou for writing the library. I guess you already know but the examples all hang after 120 reads. Probably easy to solve but I do not know how to do it !!
can some write me some code or show me where to get it to reset the clock to UTC Time
I'd like to use the 1Hz oscillator and the "open drain" SQW pin with an LED and resistor connected in series to the 5V supply.
So far, I'm using a 3K-Ohm resistor to limit the LED to about 1mA (fairly dim). Is this sufficient as a pull-up resistor? A lower value / brighter LED would be nice. A 200-ohm resistor did also work, but I didn't leave it running for a long time. Should I be doing something else, like using SQW to drive my own transistor to switch the LED? Seems redundant, but I'd rather put in an extra part than kill the clock. I can't find anything in the datasheet that refers to allowable current on this pin; presumably it has no problem with the +5V it uses itself.
All the online references to open drains (mostly talking about open collectors actually) I can find seem to be talking about using values up to hundreds of kohm to try to minimize current or dropping back maybe to 4.7kOhm for something like I2C running lots of parallel devices at 400kHz.
The intended application is to help confirm running status of a data logger and so will be blinking away for months on end. I can also leave off the blinky without impairing the essential operation if I'm totally missing the intended use of the pin.
I have the sparkfun DS1307 module hooked to my Arduino Uno on analog pins 4 and 5 that same as this diagram http://bildr.org/2011/03/ds1307-arduino. When I start it up and use the code from the site above to read it reads noon Jan 1 1999. This works fine, however when I try to set the time using the other example sketch provided I get the right time until i close and reopen the serial monitor or turn off everything and turn it back on. If I do either of those things the the time goes back to 1999. Any ideas what could be wrong? Thanks
I want to connect several RTC's at once. Is there a way to change the slave address on a DS1307 and DS3234?
Nope. Sorry. If you really need it, maybe you could bitbang a second i2c port in software...
I wasn't paying attention, the battery holder is not a ground. You'll short the battery otherwise and loose time when the device is powered off :)
This device costs more than Adafruit's, but is around a third of the PCB real estate (double sided, SOIC).
John Boxall has some good example code and tutorial as well: http://tronixstuff.wordpress.com/2010/05/20/getting-started-with-arduino-%E2%80%93-chapter-seven/
SparkFun's devices are better-designed than their competitions' devices, but they tend to cost a tad bit more.
Is there any possibility to change default (0x68) address on this chip ? I have 4 devices on the I2C bus and they all 0x68.
I am also trying to change the address on the other sensors (K22 Senseair) but without luck so far.
Thank you !
I sent an email to MAXIM support and got the following reply:
Our I2C clocks are all set for D0h, and there is no way to change that, except on the DS1372 (32-bit binary counter), where you can place 2 devices.
http://www.maxim-ic.com/datasheet/index.mvp/id/5507
The DS3234 uses SPI communications, which usually requires device-specific Chip Enable inputs from the Master. There is no Slave Address in SPI.
DS3231 and DS3232 are I2C-formatted TCXOs.
http://para.maxim-ic.com/en/search.mvp?fam=rtc&374=I2C&tree=timers
Alternatively, you might add an I2C mux to place multiple components of the same Slave address.
http://www.maxim-ic.com/datasheet/index.mvp/id/5222
I had troubles getting the example code working with Uno.
I was successful with the RTC library (https://github.com/adafruit/RTClib) connecting SDA - A4, SCL - A5.
My watch uses an mbed as it's brain so if there is some drift in the time I don't much care. Compensation is easy. Especially if I implement wifi. It's conveniently already put together for me :)
One of the mounting holes isn't accessible due to the location of the battery holder.
If anyone had the same problem as me I found the solution, hope it saves you some googling time :) I am also unsure if the problem is connected to the UNO or not which I am using.<br />
<br />
Two issues:<br />
Besides having to switch connectors from RX(0) and TX(1) to using A4 and A5 to get a read, I couldn't set the time with the commands provided, it would just randomly set the time. The TsomeNumbers.. did not work. The problem came with the code supplied in both the wiring example and in the bottom section of the Arduino tutorial.<br />
<br />
I found by using the less(more?) sophisticated code from glacialwanderer.com it works a treat. just remember to comment out the set time line when the time is set :)<br />
<br />
http://www.glacialwanderer.com/hobbyrobotics/?p=12<br />
<br />
Hope this helps!
I got my DS1307 displaying on my LCD module. Posted my code and wiring at http://arduinotronics.blogspot.com/2010/10/ds1307-real-time-clock-working.html
Thank you Sparkfun!
Can't wait! Any ETA? Thanks!
You should know by now our ETAs aren't great :-) It is in the works, that's the most reliable information we have.
This module is highly useful, especially with Arduino. We have a tutorial about it here: http://bit.ly/amhBeW
Works great, but it was set to a junk time when I got it. It was something like 30:05:00 or something. Had to reset it. Silly Sparkfun :)
Yeah! mine was preset to 1/1/0 0:0:80 and wouldn't increment.
but once i set it to the right time it worked great
I wrote an arduino library to use this. It's available at http://is.gd/880Ju but I don't really have 24 hour time working yet. The archive has a Readme.txt that covers how to use the library including how to wire it to the Arduino.
I mean 12 hour time.
personally, i prefer the 24 hour version, so though it goes against sparkfun, http://www.newark.com/maxim-integrated-products/ds1307z/real-time-clock-ic/dp/08J6234
If you set the appropriate register, you can get 24 hour time. See the datasheet.
Like the guy said 3.3V needed did not realise it was 5V only. Just ordered myself the 1338 hope my soldering ip up to it.
codemonkey: Would love to see one of these for a 3.3v part, rather than 5v.
What this guy said. 3.3v version please. Have a look at the DS1338 or DS1388. I don't think you even need to change the PCB!
Kshatrya: OK, it's working now. The module I received had a faulty crystal. No clock, no increment. Who'd have thought? -G-
Mine arrived with Register-0 Bit-7 SET! No Clocking.
Hmmmmm. I guess that the date/time is wrong....
Thanks for setting it at SparkFun;(
:) Hello, I have written a tutorial to interface DS1307 Chip with AVR MCUs. You can have a look at it here
http://extremeelectronics.co.in/avr-tutorials/interfacing-ds1307-rtc-chip-with-avr-microcontroller/
Im thinking not... but just incase:
Is this compatiable with a 3.3v arduino and other 3.3v I2C components?
If not are there any plans for a 3.3v part? :)
Nothing's incrementing.
I can read from, and write to the RTC, but the time isn't incrementing. I've tried setting/clearing bit 7 of 0x00, running with/without ground and with/without 1K pull-up resisters. Still no action.
I've tried the code from Combustory, as well as my own more abbreviated code.
Heck! I even tried removing the B/U battery to reset everything to zero!
Can anyone suggest something new to try?
Jim
Victoria, BC
OK, it's working now. The module I received had a faulty crystal. No clock, no increment. Who'd have thought? -G-
Doc + schema + code in one page. Get it running in just the time of soldering the wires.
One big difference with tzarcone, I must not plug the ground wire, otherwise reading is always the same.
Hope this helps.
http://kalshagar.wikispaces.com/Arduino+and+a+Real+Time+Clock+(RTC)
If you're using 5v (which the device requires), the pullup resistor values given are wrong. The very minimum should be 1.5k. This might be why it doesn't work with the ground pin connected (yes, that should be connected). If that doesn't work, you have other electrical problems in your system.
I would love a bit more newbie help with this module. What do "SQW", "SCL", and "SDA" mean? I think I kinda understand how to run the Arduino tutorial, but I'm actually not clear on how to physically wire the thing up.
Since my last replay, I attached the bob 00099 to my arduino duemilanove 328.
bob to Arduino
SDA to Analog Pin 4
SCL to Analog Pin 5
5v to 5v
Gnd to Gnd
I'm able to program and read from it using
RTC Control v.01
by <http://www.combustory.com> John Vaughters
Cheers,
Troy
I found some info on the Arduino Tutorial in Portuguese by Daniel Goncalaves under the "Software" heading.
It shows a photo and diagram and provides some discriptions. I was able to read it in English by entering the URL into Google search and then use [translating this page] feature.
I haven't connected my clock yet, so I don't know how accurate the info is.
http://lusorobotica.com/index.php/topic,681.0.html
Cheers,
Troy
What's the frequency stability on the crystal? +/-0.5% means that your date/time could be off by almost 2 whole days at the end of a year. 10ppm or less would be nice since that would cut the error to single digit minutes in a year.
You've got a point there ! If I knew before that the time-base of this device is not that stable I would of bought another type of RTC. Mine runs 9 seconds behind a day! ( that is about as much as the clock on my cell phone in a whole year ) Maybe I will look for a radio-based syncronisation with DCF-77. (europe system).
At least then I will have an automatic switch of summer and winter time.
If you want reasonable time keeping I've had much better luck with a DS3231. The only downside is they are about twice the price of a DS1307.
Would love to see one of these for a 3.3v part, rather than 5v.