RTC not working on Data Logging shield (ID: 1141)

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
johnl_aegis
 
Posts: 2
Joined: Wed Jul 16, 2014 7:30 am

RTC not working on Data Logging shield (ID: 1141)

Post by johnl_aegis »

I pluged the data logging shield onto my Arduino Mega 2560 R3 and get the libraries installed.
I tried the examples>RTClib>ds1307, but the RTC cannot be adjust and it does not function probably.

The serial monitor shows:

RTC is NOT running!
2165/165/165 165:165:85
since midnight 1/1/1970 = 2028820689s = 23481d
now + 7d + 30s: 2034/4/23 17:18:39

2165/165/165 165:165:85
since midnight 1/1/1970 = 2028820689s = 23481d
now + 7d + 30s: 2034/4/23 17:18:39

2165/165/165 165:165:85
since midnight 1/1/1970 = 2028820689s = 23481d
now + 7d + 30s: 2034/4/23 17:18:39

2165/165/165 165:165:85
since midnight 1/1/1970 = 2028820689s = 23481d
now + 7d + 30s: 2034/4/23 17:18:39

2165/165/165 165:165:85
since midnight 1/1/1970 = 2028820689s = 23481d
now + 7d + 30s: 2034/4/23 17:18:39

2165/165/165 165:165:85
since midnight 1/1/1970 = 2028820689s = 23481d
now + 7d + 30s: 2034/4/23 17:18:39

I tried to put on new battery, but no success.
So, i suspect two possible causes for the RTC problem:
1. is there any RTClib files specific for mega? (like SD library, i followed the tutorial and modification for mega, my SD is working fine)
2. UNO and Mega have different ports for SDA and SCL. Referring Arduino offical site, UNO & Ethernet are A4(SDA) and A5(SCL), but Mega2560 is 20 (SDA), 21 (SCL),
do I have to cut track and rewire the SDA and SCL to port 20 & 21 in order to get RTC work? (currently, i have just plugged the shield onto my mega2560, so port 20 & 21 do not connect to any other pins.

Can you advise how i can get RTC work on mega2560? many thanks.

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: RTC not working on Data Logging shield (ID: 1141)

Post by adafruit_support_bill »

Please post a photo showing your soldering on the shield.
If you have an R3 Mega, you do not need any jumpers. All R3 Arduinos have an extra set of SDA/SCL pins next to the AREF pin. However, these are cross-connected to the A4/A5 pins on the shield for backwards compatibility, so you can't use A4/A5 for other purposes.

johnl_aegis
 
Posts: 2
Joined: Wed Jul 16, 2014 7:30 am

Re: RTC not working on Data Logging shield (ID: 1141)

Post by johnl_aegis »

adafruit_support_bill wrote:Please post a photo showing your soldering on the shield.
If you have an R3 Mega, you do not need any jumpers. All R3 Arduinos have an extra set of SDA/SCL pins next to the AREF pin. However, these are cross-connected to the A4/A5 pins on the shield for backwards compatibility, so you can't use A4/A5 for other purposes.
Thanks for your prompt reply.
My shield is clean without any rerouting / modification yet.
I plugged the data logging shield onto my R3 Mega and could not get the RTC working.
Please advise me what to do. e.g. getting the right RTClib for mega? or hard wire somewhere? Thanks.

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: RTC not working on Data Logging shield (ID: 1141)

Post by adafruit_support_bill »

Please post a photo showing your soldering on the shield.

User avatar
ajohnsonlaird
 
Posts: 20
Joined: Fri Feb 13, 2015 1:14 am

Re: RTC not working on Data Logging shield (ID: 1141)

Post by ajohnsonlaird »

I've got a somewhat similar problem with two genuine Arduino Mega 2560 R3s.

The Adafruit SD and RTC work fine when plugged directly into the Mega 2560, but the RTC "is NOT running!" when I use an intermediary Itead Studio Screw terminal.

I have tested with two different Mega 2560 and two different Itead Studios screw terminals.

The screw terminal is described here https://www.itead.cc/development-platfo ... hield.html -- but I purchased them directly from Itead when they sold them fully assembled.

The schematic for the screw terminal shield is here: https://cdn.itead.cc/media/wysiwyg/Prod ... d_v1.0.png

I realize that Adafruit cannot provide support for other vendors' shields, but I wanted to post a warning for others who might be trying to do the same thing.

What is really puzzling of course, is why a "pass through" screw terminal would produce this effect?
Andy
Forensic Software Analyst.

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: RTC not working on Data Logging shield (ID: 1141)

Post by Franklin97355 »

Does it pass through the ICSP and R3 pins?

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: RTC not working on Data Logging shield (ID: 1141)

Post by adafruit_support_bill »

The screw terminal shield schematic does not appear to have the R3 pins for SDA/SCL or the ICSP pins for SPI. Since the Mega maps these interfaces to different GPIO pins, most shields that use SPI or i2c will not work unless these additional pins are passed through.

User avatar
ajohnsonlaird
 
Posts: 20
Joined: Fri Feb 13, 2015 1:14 am

Re: RTC not working on Data Logging shield (ID: 1141)

Post by ajohnsonlaird »

adafruit_support_bill wrote:The screw terminal shield schematic does not appear to have the R3 pins for SDA/SCL or the ICSP pins for SPI. Since the Mega maps these interfaces to different GPIO pins, most shields that use SPI or i2c will not work unless these additional pins are passed through.
You're correct, Bill. The Itead Studios terminal shield does NOT pass though the R3 SCL and SDA pins -- is there a way that the Adafruit Data Logger/RTC shield can be programmed up to use A4/A5 instead -- while my application ideally needs 16 analog inputs, I can get by with 14. I somewhat new to the Arduino world but have been a systems programmer for decades, so apologies for my apparently noob question.

Thanks for the support, even for a non-Adafruit shield!
Andy

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: RTC not working on Data Logging shield (ID: 1141)

Post by adafruit_support_bill »

is there a way that the Adafruit Data Logger/RTC shield can be programmed up to use A4/A5 instead
Yes, but not trivially. There is a "software i2c" library, but you would probably need to do a bit of hacking to integrate it with everything else.

A simpler approach would be to connect a jumper from the Mega i2c pins to A4/A5. https://www.arduino.cc/en/Main/arduinoBoardMega
pin 20 -> A4: SDA
pin 21 -> A5: SCL

That is equivalent to what you would get if if the screw terminal shield had the R3 pins.

User avatar
ajohnsonlaird
 
Posts: 20
Joined: Fri Feb 13, 2015 1:14 am

Re: RTC not working on Data Logging shield (ID: 1141)

Post by ajohnsonlaird »

adafruit_support_bill wrote:
is there a way that the Adafruit Data Logger/RTC shield can be programmed up to use A4/A5 instead
Yes, but not trivially. There is a "software i2c" library, but you would probably need to do a bit of hacking to integrate it with everything else.

A simpler approach would be to connect a jumper from the Mega i2c pins to A4/A5. https://www.arduino.cc/en/Main/arduinoBoardMega
pin 20 -> A4: SDA
pin 21 -> A5: SCL

That is equivalent to what you would get if if the screw terminal shield had the R3 pins.
Ah yes, the "purple wire" fix of old. I'll do that.
Thanks again for your help, Bill -- much appreciated.
Andy

User avatar
ajohnsonlaird
 
Posts: 20
Joined: Fri Feb 13, 2015 1:14 am

Re: RTC not working on Data Logging shield (ID: 1141)

Post by ajohnsonlaird »

franklin97355 wrote:Does it pass through the ICSP and R3 pins?
As you can see from my response to Bill, Franklin, it certainly does not pass through the R3 SDA/SCL pins adjacent to AREF and GND.
And, as you inferred, it also does not pass through the ISCP pins.

Sigh.
Well, I guess that answers my question.

Thanks for responding.
Andy

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: RTC not working on Data Logging shield (ID: 1141)

Post by adafruit_support_bill »

Ah yes, the "purple wire" fix of old. I'll do that.
'purple wire'? It was always the 'blue wire' fix where I came from.

User avatar
dfaMA
 
Posts: 3
Joined: Thu Aug 30, 2018 5:26 pm

Re: RTC not working on Data Logging shield (ID: 1141)

Post by dfaMA »

I've encountered a similar problem with using the RTC of the Adafruit data logging shield with a genuine Arduino Uno R2. Attached is the output from the RTC test sketch.

RTC is NOT running!
2165/165/165 (Friday) 165:165:85
since midnight 1/1/1970 = 1539906385s = 17822d
now + 7d + 30s: 2018/10/26 12:16:31

2165/165/165 (Friday) 165:165:85
since midnight 1/1/1970 = 1539906385s = 17822d
now + 7d + 30s: 2018/10/26 12:16:31

2165/165/165 (Friday) 165:165:85
since midnight 1/1/1970 = 1539906385s = 17822d
now + 7d + 30s: 2018/10/26 12:16:31

2165/165/165 (Friday) 165:165:85
since midnight 1/1/1970 = 1539906385s = 17822d
now + 7d + 30s: 2018/10/26 12:16:31

2165/165/165 (Friday) 165:165:85
since midnight 1/1/1970 = 1539906385s = 17822d
now + 7d + 30s: 2018/10/26 12:16:31

A CR1220 battery is installed in the shield. Can you explain why the clock is not advancing?

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: RTC not working on Data Logging shield (ID: 1141)

Post by Franklin97355 »

Can you post a picture of the boards soldering and also post the code you are running? Do you have the correct library for the RTC chip on the shield?

User avatar
dfaMA
 
Posts: 3
Joined: Thu Aug 30, 2018 5:26 pm

Re: RTC not working on Data Logging shield (ID: 1141)

Post by dfaMA »

Photos of the shield soldering are attached.

The code is taken from the Arduino IDE File -> Examples -> RTClib -> PCF8523, as noted in the pdf on the Adafruit site for the Data Logger shield project. The posted sketch was modified to uncomment the rtc.adjust line, as noted in the pdf. Sketch code is posted below.

The library RTClib is included in the Arduino libraries folder and shows up in the Sketch -> Include Library menu.

Code: Select all

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

RTC_PCF8523 rtc;

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

void setup () {

  while (!Serial) {
    delay(1);  // for Leonardo/Micro/Zero
  }

  Serial.begin(57600);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }

  if (! rtc.initialized()) {
    Serial.println("RTC is NOT running!");
    // 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 and 30 seconds into the future
    DateTime future (now + TimeSpan(7,12,30,6));
    
    Serial.print(" now + 7d + 30s: ");
    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);
} 
Attachments
adafruit-shield2.jpeg
adafruit-shield2.jpeg (109.82 KiB) Viewed 746 times
Last edited by Franklin97355 on Thu Aug 30, 2018 9:33 pm, edited 1 time in total.
Reason: Please use code tags when posting code or logs to the forums. It preserves formatting and makes it easier for everyone to read the code. Click the code button above the reply box and past your code between the tags created.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”