LEONARDO - DS1307 RTC module need help (NEWBIE)

Hello,

Well, I am trying to use RTC module with Leonardo board.

Module I have looks exacly like this one:

It has two sets of pins (P1 havig 7 and P2 having 5 pins).

My connection: (arduino-RTC): 5V - VCC, GND - GND, D2 (digital pin 2) - SDA, D3 - SCL. All connected on P1 or P2 on DS1307 (tried both options, BTW - does it metter if I connect P1 or P2 pins?), tried also connecting A4 and A5 for SDA/SCL (but I read it is for UNO, not Leonardo), I also connected DS1307 SCL and SCA to appropriate pins on Leonardo (SCL and SDA pins, next to the reset button).

I tried with examples from IDE:

#include <Wire.h>
#include "RTClib.h"
 
RTC_DS1307 RTC;
 
void setup () {
    Serial.begin(57600);
    Wire.begin();
    RTC.begin();
 
  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    //RTC.adjust(DateTime(__DATE__, __TIME__));
  }
 
}
 
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(3000);
}

the code compiles correcty, but after upload there is nothing on the serial monitor.

Any hints on what I did wrong?

You mean it doesn't even say that the RTC isn't running?- might like to check that baud rate...

Yep, blank window, at different baud rates (tried 9600 and 57600).

Neither info about "non working state" nor date or (at least) something.

on a UNO definitely use A4=SDA, A5=SCL
Leonardo SDA and SCL are near Aref and Ground
(sorry previous info was for Mega - :frowning: )

try adding

Serial.println("RTC test");

to setup, just to make sure the serial port is actually open

Here is what I did:

Unplugged everything from the board
uploaded the sketch:

void setup() {
  Serial.begin(9600);      // open the serial port at 9600 bps:    
}

void loop() {  
Serial.println("serial working...");
}

and opened serial monitor (Tools/Serial Monitor), which was BLANK (SM was set to 9600 baud).

any ideas?

I would add delay(1000); to loop to give it a chance!
Also, just click the icon, top right of the IDE to open monitor

Try a tiny sketch that does nothing but do serial print?

setup()
{
Serial.begin(9600);
Serial.println("Starting.....");
}

loop()
{
Serial.println("In the loop.....");
delay(1000);
}

It didnt work out.

I recorded my screen to show if I do everything in order (but what to mess here?!?):

it is on screencast.com: 2014-02-17_0910

sketch is compiled and uploaded properly, but NO OUTPUT is generated on Serial Monitor.

??

I'm using the dedicated SCL and SDA pins on my Leonardo, and the communication with DS1307 is working.
The only problem is that I cannot set the Date, as is day, month and year. Time and Day Of the Week are working properly.
I've read through .cpp file and couldn't find anything wrong, maybe my DS1307 IC is with something wrong.

Send it discrete commands with Wire.h Very easy to do.