Go Down

Topic: "Tiny RTC I2C Module" issue (Read 125732 times) previous topic - next topic

jonwwo

Jul 14, 2013, 12:13 am Last Edit: Jul 14, 2013, 12:24 am by jonwwo Reason: 1
So i got a bunch of these RTC module for cheap from china.  Ive used sparkfun modules before without issue, but ive been having some inconsistencies using these cheap modules.  



I could upload a time to the DS1307 and connect via I2C to the module (using RTClib library); however, the module would either not report back a time or it would report back the same time from the last  power down.  My first though was that the battery was dead, but no its fine.  After figuratively banging my head against the wall for a few hours, I realized that the oscillator crystal was loose from its solder pad.



Upon grounding the case of the oscillator with a jumper wire,



time was stored and progressed as would be expected of an RTC.  Im no electronics expert, but I thought that grounding the case of an oscillator was not required.  I thought it was just a good idea?  Why would this cause the RTC to not march forward in time when 5v power is lost?

Erdin

Thanks for sharing.

There are many problems with cheap RTC modules. This one can be added to the list.
Because it is battery operated, the power usage is extremely small. So everything is high impedance. Perhaps that has to do with the grounding of the case of the crystal.

jonwwo

So I soldered down the RTC's crystal thinking that would fix my problem...  but no, the problem still persists. Instead of having to ground the case of the crystal to get the RTC to act properly, I now have to tap ground to the positive side of the RTC's watch battery.  After this the RTC reports the correct time.



Im guessing this effects some sort of reset allowing the RTC to communicate via I2C?  Any thoughts?

Erdin

Try a new crystal, perhaps you can take one from some other device.
A crystal in a clock is almost always 32.768 kHz.

The DS1307 will continue to run the clock, not matter what the I2C is doing (writing the date and time via I2C will change it ofcourse).

jonwwo

ive tested 3 modules:

-one wont keep time at all when 5v is detached so it seems that crystal may be bad.
-two will keep time but wont transmit it until i do the battery ground thing.

MY SHORTCUT SOLUTION:

So as a quick fix i'm powering the clock off of one of the digital ports and in the setup function i cycle it from ground to power before using the clock.  This seems to work with several modules and after over 10 minutes of disconnect time.

Code: [Select]
#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 RTC;

void setup () {
    //  Here is where i cycle the clock's power
    pinMode(4,OUTPUT);
    digitalWrite(4,LOW);
    delay(10);
    digitalWrite(4,HIGH);
    delay(10);
   
    // Everything else is from RTClib example
    Serial.begin(57600);
    Wire.begin();
    RTC.begin();;

    //RTC.adjust(DateTime(__DATE__, __TIME__));

  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
  }
}

void loop () {
    DateTime now = RTC.now();
   
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(' ');
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
   
    Serial.println();
    delay(1000);
}


Erdin

Three out of three bad ?
We should never buy those anymore.

Was the Sparkfun RTC also a DS1307 ?

If the battery is good, and the pcb is good (no shortcuts, no bad soldering) it is probably the crystal that causes all the problems.

jonwwo

#6
Jul 15, 2013, 05:24 pm Last Edit: Jul 15, 2013, 08:32 pm by jonwwo Reason: 1

Three out of three bad ?
We should never buy those anymore.

Was the Sparkfun RTC also a DS1307 ?

If the battery is good, and the pcb is good (no shortcuts, no bad soldering) it is probably the crystal that causes all the problems.



I wouldn't say they're all "bad", just that something is going on that the existing libraries don't address.  I tested five more modules this morning and all but one was fixed by using my ground then power piece of code.  Upon further inspection, i had forgotten fix the unsoldered-down the crystal on the fifth one that didn't work after applying my code.  

SO IN CONCLUSION:

To make these cheap RTCs work: (1) make sure the case of the crystal is soldered to ground, and (2) momentarily ground the Vcc pin of the RTC before applying 5v.  I dont know why these things work, but they do, and both are required in the ones i bought.

snusmumriken

jonwwwo, have you made any further progress with these things? 

I have exactly the same issue (clock remembers only time at last power down, but increments it correctly from there) and it isn't fixed by either soldering down the xtal case or by your power cycling.  The coin cell in the device seems good.

I am on the verge of committing to 100 RTC units of some kind or another, and it would be a big saving if these cheap boards can actually be used.  So your latest conclusion would be really helpful!

jonwwo


jonwwwo, have you made any further progress with these things? 

I have exactly the same issue (clock remembers only time at last power down, but increments it correctly from there) and it isn't fixed by either soldering down the xtal case or by your power cycling.  The coin cell in the device seems good.

I am on the verge of committing to 100 RTC units of some kind or another, and it would be a big saving if these cheap boards can actually be used.  So your latest conclusion would be really helpful!


Yeah, in the end, my solutions only worked for some of the modules... In my opinion, these modules are crap and not worth your time.  If i were to do this project again but still needed to save money id try something like these:

http://www.ebay.com/itm/New-Arduino-RTC-DS1302-Real-Time-Clock-Module-For-AVR-ARM-PIC-SMD-/200931981696?pt=LH_DefaultDomain_0&hash=item2ec87ab980

They are simpler, no memory module, and may not have the same issues.  But let me reiterate, ive never used these so i dont know if they work any better.

snusmumriken

Thanks for that update.  I looked at those 1302 modules too, but I am already using serial for a sensor, so I needed an I2C clock - and there's the same anxiety about quality, as you suggest.  I reckon I'll have to splash out on the Sparkfun clock.

jonwwo

Ive never used the 1302, but can you use the Software Serial library?

snusmumriken

Well I'm managing to get data in and out via Serial, if that's what you mean?  Beyond that I haven't ventured.  Why do you ask?

JamesT42

Hi!

I've also encountered some problems with the "Tiny RTC I2C modules" from ebay.

In the german forums there is a thread about perhaps the battery type beeing a problem. Does the module you have use a LIR2032 (a rechargable battery unlike CR2032)? Because then it has a charing circuit and the LIR batteries also have a higher voltage. So the DS1307 might think the VCC voltage to be too low and thus doesn't function correctly.

JChristensen

I've never seen a DS1307 design where the crystal case was soldered to ground. I've probably got a dozen of them around, at least three different designs, plus I've breadboarded them with success. I wouldn't think the heat from soldering would do those crystals any good.

snusmumriken


I've never seen a DS1307 design where the crystal case was soldered to ground. I've probably got a dozen of them around, at least three different designs, plus I've breadboarded them with success. I wouldn't think the heat from soldering would do those crystals any good.


Well, Sparkfun seem to think it's a good idea to anchor the xtal case to a solder pad - see attached photo.  Their module simply works.


In the german forums there is a thread about perhaps the battery type beeing a problem. Does the module you have use a LIR2032 (a rechargable battery unlike CR2032)? Because then it has a charing circuit and the LIR batteries also have a higher voltage. So the DS1307 might think the VCC voltage to be too low and thus doesn't function correctly.


Interesting idea, but the measured voltage from the lithium 'Eunicell' CR2032 cell supplied in my Tiny RTC is 3.42V. It increments time nicely provided it is hooked up to VCC - it just doesn't appear to remember the set time while it is running on its own battery. I don't know what the 'BAT' terminal is intended for, so I don't know the significance of this, but the voltage measured there is only 1.8V.

Go Up