DS1302 issue

Recently I bought a ds1302 module (see the pic below), after installed the library from Electronics - Henning Karlsen, the output of the clock is flawed.
The time and date are stored in the chip without problems, but It outputs like this if i give it 5v power from arduino. If powered by 3.3v, the time and date can’t even store in the chip.

Monday 19.05.2012 – 00:43:43
xxxxxxxxx 00.00.2000 – 00:00:00
Monday 19.05.2012 – 00:43:45
xxxxxxxxx 00.00.2000 – 00:00:00
Monday 19.05.2012 – 00:43:47
xxxxxxxxx 00.00.2000 – 00:00:00
Monday 19.05.2012 – 00:43:49
xxxxxxxxx 00.00.2000 – 00:00:00

// DS1302_Serial_Easy (C)2010 Henning Karlsen
// web: http://www.henningkarlsen.com/electronics
// A quick demo of how to use my DS1302-library to 
// quickly send time and date information over a serial link
// I assume you know how to connect the DS1302.
// DS1302:  CE pin    -> Arduino Digital 2
//          I/O pin   -> Arduino Digital 3
//          SCLK pin  -> Arduino Digital 4

#include <DS1302.h>

// Init the DS1302
DS1302 rtc(2, 3, 4);

void setup()
  // Set the clock to run-mode, and disable the write protection
  // Setup Serial connection

  // The following lines can be commented out to use the values already stored in the DS1302
  rtc.setDOW(SUNDAY);        // Set Day-of-Week to FRIDAY
  rtc.setTime(0, 43, 0);     // Set the time to 12:00:00 (24hr format)
  rtc.setDate(26, 5, 2013);   // Set the date to August 6th, 2010

void loop()
  // Send Day-of-Week
  Serial.print(" ");
  // Send date
  Serial.print(" -- ");

  // Send time
  // Wait one second before repeating :)
  delay (1000);

I'm not very fond of that code. The DS1302 requires sometimes a very short delay, and I also doubt if interfacing the DS1302 is correct.

A voltage of 3.3V should be no problem. A assume you use a 3.3V Arduino, so not only the power but also the digital pins of the Arduino are 3.3V. If you use for example a 5V Arduino Uno and power the RTC with 3.3V, that would not work.

On this forum, there are a number of problems with bad crystals. Some bad quality crystals seems to need 5V or else they won't work.

I have the some module, but I don´t know how to connect this module with mi Arduino Demilanove 328
Can ´u helpme?

This has information about the wiring: http://playground.arduino.cc/Main/DS1302

When you need more help, we have to know so much more. What kind of module do you have ? You could attach a photo of it. The very cheap ones from Ebay have often problems with the crystal. Do you use the newest Arduino software, version 1.0.5 ?

I have the same problem on the Arduino Uno, it is affected every even second. If I increase query speed fo 10x per second, 10 query are bad and next 10 OK. But if I use the same module and the same code on Arduino Nano R3, everythink is OK. Did you already solve the problem?

I have the same RTC module as shown in the picture on top of the thread. This ist how I wired it up after heaving read the DOCS:

Chip Pin        Arduino Pin          Module Pin
 CE pin     -> Arduino Digital 2    (RST)
 I/O pin    -> Arduino Digital 3    (DAT)
  SCLK pin  -> Arduino Digital 4    (CLK)
  VCC       -> Arduino 3.3V         (VCC)
  GND       -> Arduino GND          (GND)

This one works for me with the serial simple sketch of the henning karlsen library. Time can be stored and runs. Didn't try how battery works yet. If I connect VCC to 5V I get the same weird results as mentioned above. 3.3V works fine for me.

I had a 1302 running on 5V with HK's library with no problems. It was a standalone loose chip with a loose xtal, hooked up on breadboard.

I say "had", because I leveled-up to a 1307 since I2C is more pin efficient.

Try connecting i/o by the 1k resistor :)