DS1307 works when powered from Arduino, but not when powered

For RTC breakouts, etc., use the Other Products from Adafruit forum

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
nabelekt
 
Posts: 17
Joined: Mon Nov 06, 2017 11:15 pm

DS1307 works when powered from Arduino, but not when powered

Post by nabelekt »

I have found that when I have the 5V and GND pins of my DS1307 connected to my Arduino, I see the expected time output in the serial monitor. But, when I connect 5V and GND to a separate 5V power supply, nothing is displayed.

The code on the Arduino:

Code: Select all

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

#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 rtc;

  void setup () {
  Serial.begin(57600);
  
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }
  
  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    DateTime now = rtc.now();
    rtc.adjust(DateTime(now.year(), now.month(), now.day(), now.hour(), now.minute(), now.second() + 6));
    // It takes about 6 seconds from compilation to when the time is actually set - check this, it varies
  }
  
  }

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();
    
    Serial.println();
    delay(1000);
}
I measure 4.95-4.99 V across 5V and GND with my multimeter in both cases. Can anybody tell me why this is happening? Thanks!

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

Re: DS1307 works when powered from Arduino, but not when pow

Post by adafruit_support_bill »

But, when I connect 5V and GND to a separate 5V power supply, nothing is displayed.
You need at least a common ground connection between the DS1307 and the Arduino.

User avatar
nabelekt
 
Posts: 17
Joined: Mon Nov 06, 2017 11:15 pm

Re: DS1307 works when powered from Arduino, but not when pow

Post by nabelekt »

adafruit_support_bill wrote:You need at least a common ground connection between the DS1307 and the Arduino.
Ah. Should have realized that. It's working now that I have a common ground. Thanks!

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

Re: DS1307 works when powered from Arduino, but not when pow

Post by adafruit_support_bill »

Good to hear. Thanks for the follow-up.

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

Return to “Clock Kits (discontinued)”