Arduino Due and DS1307 RTC on Datalogger Shield V1

Hi

IM trying to use the RTC DS1307 on the Datalogger Shield V1 with the Due. It seems others have tried, but at the time no clear answer was given.

The code blow is the Example code for the DS1307 from the RTV Lib. I’ve tried the shield on the UNO and it works fine.

Can anyone help me understand how i might get it working with the DUE?

Thanks
A.

// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include "RTClib.h"

RTC_DS1307 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup () {
  Serial.begin(57600);

#ifndef ESP8266
  while (!Serial); // wait for serial port to connect. Needed for native USB
#endif

  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    Serial.flush();
    abort();
  }

  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running, let's set the time!");
    // When time needs to be set on a new device, or after a power loss, the
    // following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }

  // When time needs to be re-set on a previously configured device, the
  // following line sets the RTC to the date & time this sketch was compiled
  // rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  // This line sets the RTC with an explicit date & time, for example to set
  // January 21, 2014 at 3am you would call:
  // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}

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(daysOfTheWeek[now.dayOfTheWeek()]);
    Serial.print(") ");
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();

    Serial.print(" since midnight 1/1/1970 = ");
    Serial.print(now.unixtime());
    Serial.print("s = ");
    Serial.print(now.unixtime() / 86400L);
    Serial.println("d");

    // calculate a date which is 7 days, 12 hours, 30 minutes, and 6 seconds into the future
    DateTime future (now + TimeSpan(7,12,30,6));

    Serial.print(" now + 7d + 12h + 30m + 6s: ");
    Serial.print(future.year(), DEC);
    Serial.print('/');
    Serial.print(future.month(), DEC);
    Serial.print('/');
    Serial.print(future.day(), DEC);
    Serial.print(' ');
    Serial.print(future.hour(), DEC);
    Serial.print(':');
    Serial.print(future.minute(), DEC);
    Serial.print(':');
    Serial.print(future.second(), DEC);
    Serial.println();

    Serial.println();
    delay(3000);
}

Date and time functions using a DS1307 RTC connected via I2C and Wire lib`!!!

In case it is helpful to others in future, i got this to work as follows:

I DID NOT fit the shield on the Arduino Due, instead i connected SDA and SCL near AREF on Due to Pin 4 and Pin 5 on the shield respectively. I also connected 5V on Due to 5V on Shield and Gnd on Due to Gnd on Shield. This works fine no other wires required to shield if you are only utilising it for the RTC.

I would however appreciate your thoughts on an additional related point. I did earlier connect the shield to the DUE and made the same wired connections explained above, it also worked, but I later fried the board (bought a new one). It is not clear to me if the cause was because when the shield is mounted on the DUE with the above wiring, it also directly connects pin 4 and 5 on the DUE to SDA and SCL on the DUE .

For this reason i only recommend NOT connecting the shield because i am unsure if this was the cause or if i caused it by later messing about with a TFT on the SPI later in the evening.

Anyway thanks