Arduino Forum

Using Arduino => General Electronics => Topic started by: dev_000 on May 23, 2011, 10:14 am

Title: [Solved] RTC 1307 Problem
Post by: dev_000 on May 23, 2011, 10:14 am
Hi all
I am working on a project based on RTC clock DS1307. I have been using it without any problems for a couple of months now without a problem.
this is what i used. http://www.glacialwanderer.com/hobbyrobotics/?p=12
But during the last week RTC is behaving strangely... ie) it is not running. It runs sometimes when I touch the 32khz with my fingers but whenever I remove my fingers it stops (I can assure you it is not loose connection problem). What could be the problem?? I am using a breadboard. I tried different breadboards, different Crystals, different ICs even but still problem persists...
It has to be crystal I guess... but i changed like 7-8 crystals but still nothing...
IC is fine because I can set and read time from it. Problem is that it is not "running".
Is it some ground problem of the crystal (Because something like that is mentioned in the datasheet of 1307)?? I had shorted the arduino gnd and 3V battery gnds and I am not using any capacitors...
Can someone help me fix this?? because its driving me nuts and I am pretty sure its not a wiring problem...
Thanks in advance.
Title: Re: RTC 1307 Problem
Post by: jackrae on May 23, 2011, 10:26 am
Have you tried changing its battery ?
Title: Re: RTC 1307 Problem
Post by: dev_000 on May 23, 2011, 10:31 am
Yup.. Checked with a multimeter. VBAT pin is receiving 3V. even tried a potential divider circuit to get 3v from Arduino 5V. Even that didnt make it work :(
Title: Re: RTC 1307 Problem
Post by: TerryKing on May 23, 2011, 01:38 pm
Do you have some decoupling capacitor (say .1 uF) across Vcc and Gnd near the chip??

Are you SURE ground is not flaky or bouncing on the breadboard etc? Temporarily double up wires to Ground and Vcc.   There is the occasional bad manufactured-jumper wire.

Title: Re: RTC 1307 Problem
Post by: dev_000 on May 23, 2011, 02:59 pm
I havent put a decoupling capacitor... is it necessary??
and GND is not flaky because I have wired it in different breadboards using different wires..

Title: Re: RTC 1307 Problem
Post by: dev_000 on May 23, 2011, 03:06 pm
I have just now tried putting the .1uF between  Vcc and GND of the breadboard. but still nothing... It works only when I touch it :( Should I specifically place the capacitor at some place? or put any capacitors for crystals??
Title: Re: RTC 1307 Problem
Post by: TerryKing on May 23, 2011, 04:21 pm
Wow, everything is right and it still doesn't work.. 

This simply means there is something else we don't understand...

Ideas anyone??

Do you have pull-up resistors??

Have you tried another Arduino?? 

Hmmm....
Title: Re: RTC 1307 Problem
Post by: dev_000 on May 23, 2011, 04:37 pm
yup. Pull up resistance used are 2.2k and connected as given in http://www.glacialwanderer.com/hobbyrobotics/?p=12
and yes I checked with another arduino still works only when I touch. :(
Cant figure out why its working erratically and its driving me nuts...  =(
Title: Re: RTC 1307 Problem
Post by: liuzengqiang on May 23, 2011, 05:50 pm
Upload a picture of how you were touching the crystal on the cap or across the leads?
Title: Re: RTC 1307 Problem
Post by: floresta on May 23, 2011, 07:17 pm
Quote
It has to be crystal I guess... but i changed like 7-8 crystals but still nothing...
IC is fine because I can set and read time from it. Problem is that it is not "running".
Is it some ground problem of the crystal (Because something like that is mentioned in the datasheet of 1307)?? I had shorted the arduino gnd and 3V battery gnds and I am not using any capacitors...
Can someone help me fix this?? because its driving me nuts and I am pretty sure its not a wiring problem...


The Maxim DS1307 data sheet shows a recommended layout for the crystal in Figure 2.  This would imply that not only are the electrical characteristics of the crystal important but so is the physical layout.  I have successfully used a pc board layout that did not include the recommended ground plane, but a solderless breadboard introduces a lot of extraneous capacitance which may be your problem.

Don
Title: Re: RTC 1307 Problem
Post by: dev_000 on May 23, 2011, 08:53 pm
Quote
Upload a picture of how you were touching the crystal on the cap or across the leads?

I am touching the metal cap on top not the leads... and touching always doesnt make it run (Abt 80% of the time when I touch it runs) and that too not always at the correct speed..

Quote
I have successfully used a pc board layout that did not include the recommended ground plane, but a solderless breadboard introduces a lot of extraneous capacitance which may be your problem.

I too am guessing this to be the reason... any way to correct this??
Title: Re: RTC 1307 Problem
Post by: liuzengqiang on May 23, 2011, 11:41 pm

Quote
Upload a picture of how you were touching the crystal on the cap or across the leads?

I am touching the metal cap on top not the leads... and touching always doesnt make it run (Abt 80% of the time when I touch it runs) and that too not always at the correct speed..

Quote
I have successfully used a pc board layout that did not include the recommended ground plane, but a solderless breadboard introduces a lot of extraneous capacitance which may be your problem.

I too am guessing this to be the reason... any way to correct this??


1) Ok, that is a bit strange.
2) Use a perf board to build your circuit on or a PCB kit?

Like this:
http://www.inmojo.com/store/inmojo-market/item/rtc-module-ds1340z/

or this:

http://www.sparkfun.com/products/10160

This is my version ;)

http://www.inmojo.com/store/liudr-arduino-and-physics-gadgets/item/rtc-real-time-clock-module-%2B-eeprom-slot/
Title: Re: RTC 1307 Problem
Post by: jluciani on May 24, 2011, 01:37 am
My guess is that crystal capacitance does not match the DS1307 requirements.
What is the Cl of the crystal? Verify that this matches the DS1307 requirements.
Does the ESR specification of the crystal match the drive capabilities
of the DS1307? Both of these specifications are important for stable operation.

For low frequency crystals I use a guard ring around the crystal. These
devices are high-impedance and are susceptible to noise.
Pictures of my layouts are at http://wiblocks.luciani.org/PICO/PICO1TRC-index.html

(* jcl *)
Title: Re: RTC 1307 Problem
Post by: dev_000 on May 24, 2011, 05:04 am
Quote
My guess is that crystal capacitance does not match the DS1307 requirements.
What is the Cl of the crystal? Verify that this matches the DS1307 requirements.
Does the ESR specification of the crystal match the drive capabilities
of the DS1307? Both of these specifications are important for stable operation.

How do I find this? because I I got the crystals from a local shop and no way to know the values... I still am thinking its the capacitance problem of the crystals..
By the way what is CI and ESR?

Quote
Use a perf board to build your circuit on or a PCB kit?

I tried building on General purpose line PCB board earlier but it didnt work same problem... but I will give it a try once more...
Cant use/order pref board its too expensive for the stuff I am building considering the shipping charges...
Title: Re: RTC 1307 Problem
Post by: jluciani on May 24, 2011, 12:26 pm
Cl is load capacitance. For the DS1307 the required load capacitance is 12.5pF.
This capacitance is internal to the DS1307.

ESR is Effective Series Resistance. For the DS1307 the maximum ESR is 45KOhms.

These values effect startup and stability of the clock. You need the datasheet
for the crystal to get these numbers. If your layout is correct (see the MAXIM
datasheet) the best thing to do is to order a couple of crystals from Mouser
or Digikey.

(* jcl *)
Title: Re: RTC 1307 Problem
Post by: dev_000 on May 24, 2011, 12:39 pm
thanx... I guess i will try changig the crystals then... :|
Title: Re: RTC 1307 Problem
Post by: liuzengqiang on May 24, 2011, 04:51 pm
I've used this from dipmicro.com without any problem:

http://dipmicro.com/store/XC4-32768

The load capacitance is 12.5pF. The effective serial resistance is not given though. And it's out of stock.
Title: Re: RTC 1307 Problem
Post by: dev_000 on May 24, 2011, 06:38 pm
Thanx u guys :) appreciate the help but ordering such a small thing online is very expensive :( Lemme try a few other local shops here :)
Title: Re: RTC 1307 Problem
Post by: liuzengqiang on May 24, 2011, 06:51 pm

Thanx u guys :) appreciate the help but ordering such a small thing online is very expensive :( Lemme try a few other local shops here :)


You in USA by any chance?
Title: Re: RTC 1307 Problem
Post by: dev_000 on May 24, 2011, 06:54 pm
nope. All the way in India. Here price of the crystal in the shop is half of what is given in the link u gave just now  ;)
Title: Re: RTC 1307 Problem
Post by: liuzengqiang on May 24, 2011, 06:57 pm

nope. All the way in India. Here price of the crystal in the shop is half of what is given in the link u gave just now  ;)


I was about to offer you one for free if you're within USA, in a tiny envelop.  ;)

I guess a local shop is better option for you.
Title: Re: RTC 1307 Problem
Post by: dev_000 on May 24, 2011, 07:04 pm
Quote
I was about to offer you one for free if you're within USA, in a tiny envelop.

Wow thanx for the gesture :)

Quote
I guess a local shop is better option for you.


Exactly.. Here each crystal cost around Rs. 4. That's like less than 0.1$  :) If no crystal here works I guess i got to order from somewhere :(
Title: Re: RTC 1307 Problem
Post by: liuzengqiang on May 24, 2011, 07:10 pm
Just post here or on bars forum asking for good shops (online or local) in India. Lots of friends in India visit this forum and should be able to point you to places for parts.
Title: Re: RTC 1307 Problem
Post by: dev_000 on May 24, 2011, 07:15 pm
Will keep u guys posted... Because this is 1 problem I cant get a fix on... Never had I had this kind of a problem... I have finished the entire project just need to get this part running...
So I will update if I get it working :D
Once again Thank you all for your help.. :)
Title: Re: RTC 1307 Problem
Post by: TerryKing on May 24, 2011, 09:32 pm
PLEASE mark this Subject [SOLVED] when you figure this one out!

I keep thinking about it, even riding the bike tonight.

I'm about 4:1 it's the crystal characteristics. 

You have the primary Engineering requirement: persistence.
Title: Re: RTC 1307 Problem
Post by: dev_000 on May 25, 2011, 05:02 am

PLEASE mark this Subject [SOLVED] when you figure this one out!

I keep thinking about it, even riding the bike tonight.

I'm about 4:1 it's the crystal characteristics. 


Will surely do.. I gotta figure this one out anyway.. its an important component of my project..  This forum has helped me so many ways. I will post the answer once I get it figured out  :)

Quote
You have the primary Engineering requirement: persistence.

Hehe Thanx... :)
Title: Re: RTC 1307 Problem
Post by: jackrae on May 25, 2011, 09:48 am
Have you tried salvaging a crystal from an old watch - don't know what their frequency is but they are free
Title: Re: RTC 1307 Problem
Post by: dev_000 on May 25, 2011, 02:48 pm
Yippee! got it working... I bought a new crystal from another local shop, its working nicely... Tried around 12 crystals for the entire project though and the 12th one worked  :D I think the stuff I bought from the earlier shop was from a bad stock or something ... Phew! What a relief...
Thanx again for everyone's support... :D
Title: Re: RTC 1307 Problem
Post by: liuzengqiang on May 25, 2011, 06:38 pm
Glad you finally got it working. Maybe you can start a list of good shops and bad shops and share with local electronics fans ;) I don't have any shops near me except the RadioShack. I go there for replacement soldering iron tips. Man, they got me hooked when I bought their cheap iron. The tip is too fragile. Maybe not thick enough tin/chromium + too much power.
Title: [Solved] RTC 1307 Problem
Post by: dev_000 on May 25, 2011, 08:16 pm
That shop is usually good.. :) This might have been a really rotten stock :D