Go Down

Topic: Getting Deek-Robot datalogging card's RTC to work... help needed (Read 8784 times) previous topic - next topic

bilbosmith

I have an arduino Mega card (I think it is an R3), and is connected to a Deek-Robot SD/RTC datalogging shield(V1.0).  I am powering this off the USB port. I've been able to get the SD read/write/access to work just fine.  But after trying many dfferent sketches/libraries to set the Real Time clock I am stumped.    The shield uses a DS1307 chip in it, with a battery (it is plugged in, and has voltage). 
I've noticed that when plugging the boards together not ALL the shields pins, connect to the Arduino Mega's pins (i.e. Shields SDA & SCL not connected to MEGA.  On the opposite side the Shields IO & Ref pins don't connect.  When I run "TimeRTCSet" sketch to set the clock I get the following output...
Quote
Unable to sync with the RTC
0:00:00 0 0 1970
0:00:01 1 1 1970
0:00:02 1 1 1970
0:00:03 1 1 1970
0:00:04 1 1 1970

When I run the "Set Time" sketch from the "DS1307RTC" library I get these results...

Quote
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


I understand the time needs to be set before can use this, but none of the sketch's I've tried seem to be able to SET the time here.
On the MEGA card the SDA is pin 20, and SCL is pin 21.  On the shield there are the two pins that didn't conect via header between the two boards.  I tried running jumpers from the Shield to the MEGA to see if that would make any difference.... it didn't.

Another sketch "Set Time" in "DS1307RTC" libary gave me the following results...
Quote
DS1307 Communication Error :-{
Please check your circuitry

I've attached that code here...
Code: [Select]
#include <Wire.h>
#include <Time.h>
#include <DS1307RTC.h>

const char *monthName[12] = {
  "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};

tmElements_t tm;

void setup() {
  bool parse=false;
  bool config=false;

  // get the date and time the compiler was run
  if (getDate(__DATE__) && getTime(__TIME__)) {
    parse = true;
    // and configure the RTC with this info
    if (RTC.write(tm)) {
      config = true;
    }
  }

  Serial.begin(9600);
  while (!Serial) ; // wait for Arduino Serial Monitor
  delay(200);
  if (parse && config) {
    Serial.print("DS1307 configured Time=");
    Serial.print(__TIME__);
    Serial.print(", Date=");
    Serial.println(__DATE__);
  } else if (parse) {
    Serial.println("DS1307 Communication Error :-{");
    Serial.println("Please check your circuitry");
  } else {
    Serial.print("Could not parse info from the compiler, Time=\"");
    Serial.print(__TIME__);
    Serial.print("\", Date=\"");
    Serial.print(__DATE__);
    Serial.println("\"");
  }
}

void loop() {
}

bool getTime(const char *str)
{
  int Hour, Min, Sec;

  if (sscanf(str, "%d:%d:%d", &Hour, &Min, &Sec) != 3) return false;
  tm.Hour = Hour;
  tm.Minute = Min;
  tm.Second = Sec;
  return true;
}

bool getDate(const char *str)
{
  char Month[12];
  int Day, Year;
  uint8_t monthIndex;

  if (sscanf(str, "%s %d %d", Month, &Day, &Year) != 3) return false;
  for (monthIndex = 0; monthIndex < 12; monthIndex++) {
    if (strcmp(Month, monthName[monthIndex]) == 0) break;
  }
  if (monthIndex >= 12) return false;
  tm.Day = Day;
  tm.Month = monthIndex + 1;
  tm.Year = CalendarYrToTm(Year);
  return true;
}


So far I've wasted most of my Sunday trying to figure out how to get this working.... but no luck, very frustrated.

Any Geniuses that can help me here?   :smiley-eek:

bilbosmith

I may have finally figured this out. Running jumpers for SDA/SCL from MEGA to Datalogging shield's pins on the header didn't work.  But I did notice that there are also "holes" by the shields Power LED also market SDA & SCL.  When I ran a set of jumpers there, I started getting the sketches to run properly.  Hopefully others that run into this can avoid wasting the whole day like I did.  I am posting a picture of the two cards and the connection to further illustrate this (later when I get more time).

marchantcilliers

Hi Bilbosmith,  I need some technical help please.
I have also bought the deek robot data logging shield (v1.0) and I am running it off an arduino uno. I am using the "rtclib" library. For some reason I cannot get any response from the onboard RTC (DS1307).

If I run the standard DS1307 example there is no feedback on the serial monitor.

I have now spent a day looking for answers online, can you please help.

Any help would be greatly appreciated!

Marchant
South Africa

RoddyJoff

I can confirm that running jumpers as per the attached pic solves the RTC problem associated with Deek-Robot's data logging shield - thanks to Bilbosmith.

It's only the Pink and Orange wires, the others are part of my project.

aaahhnuts

I know it's an old post and I'm sure someone else has done it, but in the interest off all people searching for answers I like to add....









Just jumper them on the shield...

aaahhnuts

I know it's an old post and I'm sure someone else has done it, but in the interest off all people searching for answers I like to add....









Just jumper them on the shield...

aarg

Just be aware that you are connecting pins A4,A5 and SDA,SCL together on the Mega and you could damage the Mega outputs if you enable those pins as outputs simultaneously.

It's not a problem on the Uno, because they are electrically connected anyway.

Seems like a dumb idea for Deek to take the RTC connections to A4, A5. The best thing would be to also cut the traces (it looks quite easy).
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

aaahhnuts

Damn missed your reply, sorry.  As I marked it Mega and only use it with my stuff it's not a problem for me.

I just got my scalpels a couple of days ago so I might perform surgery soon...

heinburgh

I ran into the same error with my deek. Soldered two wires as you posted in the photo, still no change. Battery shows healthy 3.1V

Any other idea?

TDHofstetter

Heinburgh, did you get it to work yet? If not, could you show us exactly where you attached each jumper at both ends?

Surely you've gotten it to work.

heinburgh

Heinburgh, did you get it to work yet? If not, could you show us exactly where you attached each jumper at both ends?

Surely you've gotten it to work.
I did get it working, although this was some time back. I'll go out to one of my devices that use this and check on the wiring for you.

Go Up