Shop OBEX P1 Docs P2 Docs Learn Events
RTC: DS1302, DS1307; Internal Xtal: DS1337/38/39/40C, ISL12020/22M; etc — Parallax Forums

RTC: DS1302, DS1307; Internal Xtal: DS1337/38/39/40C, ISL12020/22M; etc

Cluso99Cluso99 Posts: 18,069
edited 2011-07-20 14:25 in Propeller 1
I am looking at the RTC (Real Time Clock). The two common ones here are...

DS1302 http://datasheets.maxim-ic.com/en/ds/DS1302.pdf
3 wire interface (CE, SCLK, IO) - not SPI
2V-5V operation
Inbuilt trickle charger (can use supercap)

DS1307 http://datasheets.maxim-ic.com/en/ds/DS1307.pdf
I2C 2 wire (SCL & SDA)
5V operation
Uses coincell battery

There are others that are also cheaper. Any worth considering?

Postedit:
Perhaps I should have said...
The DS1307 has the advantage that it can co-exist with the eeprom, however it is 5V and offers no charging capability.
The DS1302 has the advantage it can operate at 3V3 and has an inbuilt trickle charger, but the disadvantage is it requires extra 3 pins.

I would have preferred I2C and 3V3 with a trickle charger. This is just a neater solution. I am not phased by the issues of 5V or code, just that it's a pain!

Postedit: Info on other RTC chips...
All the following have internal crystals, and are available from DigiKey...

DS1337C (internal xtal) SOIC16W SQW, 2 Alarms - no separate Vbatt
DS1338C-33 (internal xtal) SOIC16W Vbatt, SQW/Out
DS1339C-33 (internal xtal) SOIC16W Vbat, Alarm,Trickle chg
DS1340C-33 (internal xtal 15ppm) SOIC16W Vbat, FT/Out, Trickle chg $4.30ea qyt 25 <=== my preference
ISL12022M (internal xtal 5ppm) SOIC20W Vbat, IRQ/Fout $4.57ea qty 25
ISL12020M (internal xtal 5ppm) DFN20 Vbat, IRQ/Fout $4.82ea qty 25
DS3231S (internal xtal 2ppm) SOIC16W Vbat, Alarmx2, PButton Reset $5.88ea qty 25

Here are someother parts & DigiKey P/Ns...
P183-ND 1225 Coincell 3V 48mAh
P061-ND 1225 Coincell with legs
BK-885-CT-ND SMT Coincell holder 1225+
3000K-ND SMT Coincell holder 1225+
3001K-ND T/H Coincell holder 1225+
BH3000-ND T/H Coincell holder 1225+
P10787-ND Supercap 100mF 5V5 (life of 2 years @ 30degC)
«1

Comments

  • andrewsiandrewsi Posts: 59
    edited 2011-02-07 21:37
    There's not a huge difference between them in practical operation. The 1302 takes 3 pins to control (clock, data, and chip enable) while the I2C version can be done with two pins (and pullups), but also expects 5V. Either one can run from a coin cell for backup, although the supercap charger is kind of nice on the 1302. At the end of the day, there's OBEX modules for either one of these, so it seems like a bit of a toss-up.
  • TtailspinTtailspin Posts: 1,326
    edited 2011-02-07 22:16
    The Prop Pro Dev Board comes stock with the DS1302.
    This is why I vote for the DS1302 as My favorite...
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-02-07 23:17
    See first post for more info.
  • RaymanRayman Posts: 14,876
    edited 2011-02-08 06:20
    Actually, my current favorite is the DS1339. But, it doesn't come in a DIP package...

    If there was any interest, I could make a DIP module for the DS1339 :)
  • Paul Sr.Paul Sr. Posts: 435
    edited 2011-02-08 06:47
    DS3231 - grown up DS1307 that doesn't need an external Xtal!
  • Ken GraceyKen Gracey Posts: 7,401
    edited 2011-02-08 07:33
    Chris Savage has spent a significant part of his professional career programming the DS1302. Yesterday when I mentioned the DS1307 he came alive during a meeting to debate the two, but there was no mention from either of us about the DS1339 and DS3231. I've seen him build several different kinds of clocks through the years and use the DS1302 in a couple of projects.

    I'm sure he'll be checking in on this thread to cast a vote. Just a matter of minutes. He can smell RTC chips from a distance, even over the internet.
  • jazzedjazzed Posts: 11,803
    edited 2011-02-08 08:13
    I'm using the 3.3V I2C interface DS1338 in an S08 package successfully with a coin-cell battery. The DS1340 is DS1338 with a trickle charger. I don't have room for SO16 package parts.

    Cluso99 wrote: »
    I would have preferred I2C and 3V3 with a trickle charger. This is just a neater solution. I am not phased by the issues of 5V or code, just that it's a pain!
    Look at DS1340.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2011-02-08 08:21
    Okay, I voted my preference (no point keeping it a secret) which is the DS1302. A quick breakdown from my standpoint...both chips are useful and have similar features.

    DS1302 has the trickle charger and a wider operating voltage.
    DS1307 is I2C and can co-exist on the Propeller's existing I2C bus by just pulling up the SDA/SCL lines to 3.3V. So the 5V issue doesn't really exist since almost all propeller boards offer a 5V supply.

    As for losing three lines to the DS1302, it really depends on how you look at it...for me that has almost never happened because in almost every design I use a DS1302 in there are multiple SPI devices in the system and they can all share the Clock and Data lines. So if you're going to allocate lines for an SPI device anyway, the cost is only one additional I/O for the DS1302 anyway. I prefer the SPI interface over the I2C one, however with supporting objects for the Propeller to cover both protocols it really isn't an issue for newer users.

    I guess my best advice would be if you really want to conserve I/O pins and don't have any other SPI type devices (this includes Shift Registers) then perhaps the DS1307 would be better. A 3V Lithium Battery like the CR2032 can backup the time/date/RAM for quite a long time.

    If you have an SPI bus (74xx595, 74xx165, DS1620, MAX7219, etc) already then the DS1302 gives you a little more leeway. As a note, in early designs (back in the 90s) I used the charging circuit on the DS1302. Lately I find a CR2032 last long enough that I don't bother with the Supercap.

    Of course, just to throw a monkey wrench into things, I was at one point looking at a newer Maxim/Dallas RTC which had an on-board crystal and was supposed to be more accurate than either the DS1302 or the DS1307. Unfortunately it was not available as a through hole part.
  • KyeKye Posts: 2,200
    edited 2011-02-08 08:31
    For the DS1302 to coexist with FSRW or my FATEngine on te SPI bus you will have headaches... The DS1307 is a much better choice if you do not want to have programing problems... which are the most important type of problem. I see the DS1302 as a no go.
  • RaymanRayman Posts: 14,876
    edited 2011-02-08 08:31
    Cluso,
    One small point... You can easily use a supercap with the DS1307. I just use a blocking diode to the 3.3V Vdd to charge it...

    I suppose for the majority of people the DS1302 would be better because you get more support from Parallax.
    But for me, I always worry about running out of pins and so an I2C solution is a no-brainer.
    Also, as far as I can tell all the Dallas I2C chips are almost code compatible, just the special function registers are different..
  • blittledblittled Posts: 681
    edited 2011-02-08 09:26
    There are also a couple of micro controllers with built in RTCs such as PICS and the Texas Instruments MSP430 series. The benefit to this is you can pick your communication from serial, I2C, or SPI. You can also have the time returned in any format. The disadvantage is you have to program it and learn a different language.

    I'm looking into the MSP430's since they are cheap and very low power. A SuperCap can run them for a month and the development system, the Launchpad, is $4.30 with free development software.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-02-08 11:03
    I really like the Chronodot from macetech... It uses a ds3231 and has worked well for me so far. They are supposed to be some of the most accurate rtc's out there
    http://macetech.com/store/index.php?main_page=product_info&cPath=5&products_id=8&zenid=45639031b2c626ba39996e71256d8418
  • RaymanRayman Posts: 14,876
    edited 2011-02-08 11:15
    I must admit, if you've got space and don't mind paying a few dollars extra, the DS3231 looks pretty good.
  • RaymanRayman Posts: 14,876
    edited 2011-02-08 11:20
    Also noticed my favorite, DS1339 can come with an integrated crystal too...
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2011-02-08 14:47
    I like the DS3231 - it is very accurate.

    The MaceTech ChronoDot board is a nice module.
  • Paul Sr.Paul Sr. Posts: 435
    edited 2011-02-08 16:06
    Rayman wrote: »
    I must admit, if you've got space and don't mind paying a few dollars extra, the DS3231 looks pretty good.

    Yes, it is nice. I had a Sparkfun 28-SOIC in my goodies box so I soldered the 3231 to it, wired it up to the Prop, and used Kye's DS1307 driver (as is) - worked fine! I started to add the 3231 bells and whistles, but not enough time to focus on it at the moment!
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-02-08 21:10
    Thanks guys. I had missed those parts when checking Digikey.

    Here is a summary...
    DS1337C (internal xtal) SOIC16W SQW, 2 Alarms - no separate Vbatt
    DS1338C-33 (internal xtal) SOIC16W Vbatt, SQW/Out
    DS1339C-33 (internal xtal) SOIC16W Vbat, Alarm,Trickle chg
    DS1340C-33 (internal xtal) SOIC16W Vbat, FT/Out, Trickle chg
    DS3231S has temp controlled xtal oscillator and is more expensive

    If I cannot fit the SOIC16W I will use one of the uTSSOP8 packages and try and squeeze the xtal somewhere.

    I intend to place the coincell socket / coincell with legs / supercap over the RTC IC. AFAIK shipping by air precludes devices containing lithium batteries so I intend to use a 1025 3V 45mA battery and holder, although a supercap or coincell with legs would also work.

    Here are some DigiKey P/Ns...
    500K-ND Coincell 1025 socket t/h
    P183-ND 1025 Coincell
    P061-ND 1025 Coincell with legs
    P10787-ND Supercap 100mF 5V5 (life of 2 years @ 30degC)
  • jazzedjazzed Posts: 11,803
    edited 2011-02-08 22:43
    The S08+crystal solution is much cheaper than the SO16.
    A small ground-plane is recommended for the S08 crystal.
    The SQW out pin can be used to strobe a power LED to save power.

    I'm using a CR1220 battery and holder. I also have a .1" header for separate battery connection.

    The CR1220 battery is 12x2mm and 35mAh to 38mAh.
    The holder is essentially a surface mount strap. http://www.keyelco.com/pdfs/M55p4.pdf
    Total cost for CR1220 + #3000 holder is about $1.10US 10 at a time.

    My first proto has the battery holder on the bottom of the board at the side.
    I have room for it on top now that I decided to just use 1 SDRAM chip.
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2011-02-09 00:51
    My vote sways from Dallas Semi and goes to the Intersil ISL12020M.
    -- I2C, standard register or burst read and write
    -- 2.7 to 5.5 V operation, backup battery or capacitor operation to 1.8V.
    400 µA I2C active, 6 µA timekeeping from main Vdd, 1 µA timekeeping from backup
    -- embedded 32kHz xtal +/- 5ppm from -40 to +85 °C.
    compensation registers are factory programmed, but still accessible
    -- tiny DFN20 package, but only 8 pins are used similar to DS1307.
    other packages available, e.g. soic8 without the internal xtal.
    -- temperature and voltage status for both main and backup supplies.
    -- flexible alarm and frequency outputs.
    -- 130 bytes battery backed user SRAM
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-02-09 02:08
    jazzed: funny you should mention smt socket on the underside. I was just thinking the smae thing. You know, the 16 pin SOIC is the same footprint as the prop LCC without the pins. Another interesting thing I saw is these RTCs have 7,000 transistors,which is equivalent to the original Z80 processor!!
  • RaymanRayman Posts: 14,876
    edited 2011-02-09 06:24
    Tracy, that ISL12030M is very interesting...

    I also noticed there's one that can sync of a 60Hz power line. I've heard that is actually an extremely accurate time source.
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2011-02-09 08:30
    Ray, the power line frequency is accurate over the long term, but not necessarily so over the short term. The frequency is adjusted periodically to keep it to 24*3600*(line_freq) within a day, but adjustments can be +/- 0.02 Hz for hours at a time, depending on the algorithm used by the power operator. Also there can be transient outliers of +/- 0.05 Hz (50000 ppm) or more as the demand fluctuates. I've seen graphs where the long term average approaches 1ppm.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-02-09 17:54
    Tracy: The Intersil is a nice chip but even bigger at 20 pins. I am not sure about using the QFN package when hand soldering. It is more expensive. The DS3231S is a similar chip too. Both have very tight tolerances.

    In Australia, the same applies to our 50Hz, over time it is extremely accurate (or was), but over the short period it is not. However, once you have access to the ac line, you have power and you could just as easily use a cog within the prop, plus an input pin and a small cheap cct an the cog would be the RTC.
  • RaymanRayman Posts: 14,876
    edited 2011-02-09 18:38
    Cluso, I was a bit surpised when I heard about people using the AC line for timekeeping. But, the long term average of 1ppm that Tracy mentioned is more than 30X better that the 5MHz crystals we typically use for the Prop. So, I can see that solution making a lot of sense if you have constant AC power and no outages (unlike here).

    PS: Tracy's chip is ~5x4 mm as I recall, so that make it very small...
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-02-09 21:00
    Ray: Yes, the chip is very small but it is 0.5mm spacing AND QFN. A mix I do not enjoy, and with a xtal inside, soldering temperature can be a problem. I know that hand soldering 0.65mm pitch on LCC and SOT type chips is OK, but 0.5mm pitch is difficult. And this is without the added complexity of QFN.

    Re the ac power, provided you have battery backup sufficient to allow the prop to continue functioning, the 5MHz clock would possibly be accurate enough to keep the time during the outages. It would be fairly simple to detect. The ac power would be supplied via a plugpack at a low ac voltage like 6v ac. In addition to normal rectification, a diode from the input to a series resistor to the prop pin with a 3V3 zener to ground would make a simple circuit.
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2011-02-10 11:21
    I hear you about the DFN package. It takes a stencil to lay down paste in the correct pattern (which needs to be by-the-book), and an oven. Given that, they are pretty easy to work with.

    The nice thing about having an embedded crystal with a chip like this, with its temperature compensation, is that it comes precalibrated from their automated system. All the offset and curvature corrections are matched to the crystal and there is no further influence from the circuit board layout.

    I attached a photo of a board with the ISL12020M just above left of the Prop, and I am amazed that they managed to fit both the chip and the 32kHz xtal into that little package. Also, a circuit board layout with the ISL12020M on a DIP-8 carrier. I don't know, would anyone be interested in such breakout for this nice chip? You see, on the DIP-8, it has the same pinout as a DS1307 and the I2C driver is much the same too.
    412 x 278 - 252K
    458 x 440 - 16K
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-02-10 13:38
    Tracy: I think there could be others that would love a DIP version pcb. We will wait and see what response you get. Certainly the specs are great and yes, a very tiny package with the xtal in it.

    Just for your info, here is the pcb (unrouted version). You can see I don't have much space for the part (same size as the prop without pins). The coincell will go over the RTC chip. Basically the chip is ~12x10mm which is ~0.5x0.4". The pcb has a 0.1" grid.
    463 x 249 - 45K
    tmp.JPG 45.4K
  • TubularTubular Posts: 4,717
    edited 2011-02-10 20:06
    @ Tracy,

    Thats a very interesting chip you've found. If you do produce breakouts i'd certainly purchase at least a couple.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-02-11 16:59
    I have updated the top post. BTW here is a pcb showing how large the SOIC16W really is! (0.1" grid)
    357 x 251 - 34K
  • RaymanRayman Posts: 14,876
    edited 2011-02-11 17:24
    Cluso, I noticed you have the DS1339 as SOIC16. I'm using it in the uSOP8 package, which I think makes a lot more sense...
Sign In or Register to comment.