RTC: DS1302, DS1307; Internal Xtal: DS1337/38/39/40C, ISL12020/22M; etc
Cluso99
Posts: 18,069
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)
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)
Comments
This is why I vote for the DS1302 as My favorite...
If there was any interest, I could make a DIP module for the DS1339
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.
Look at DS1340.
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.
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..
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.
http://macetech.com/store/index.php?main_page=product_info&cPath=5&products_id=8&zenid=45639031b2c626ba39996e71256d8418
The MaceTech ChronoDot board is a nice module.
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!
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)
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.
-- 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
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.
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.
PS: Tracy's chip is ~5x4 mm as I recall, so that make it very small...
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.
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.
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.
Thats a very interesting chip you've found. If you do produce breakouts i'd certainly purchase at least a couple.