I'm using a DS1307 RTC (https://www.adafruit.com/product/3296) and an Arduino mega microcontroller trying to simply set and read the time of the RTC. However, whenever I try to output anything to the Serial Monitor, I get stuff like this:

Example Output

The code and the wiring is fairly straightforward which is why I'm confused. I'm just directly attaching the Vcc, GRND, SCL and SDA pins of the clock to the Arduino and using a slightly modified version of the example code as a part of the RTC library Adafruit supplied.

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

RTC_DS1307 rtc;

void setup () {
  while (!Serial); // for Leonardo/Micro/Zero


  rtc.adjust(DateTime(2017, 11, 17, 20, 33, 0));


void loop () {
    DateTime now = rtc.now();

    Serial.print(now.year(), DEC);
    Serial.print(now.month(), DEC);
    Serial.print(now.day(), DEC);
    Serial.print(' ');
    Serial.print(now.hour(), DEC);
    Serial.print(now.minute(), DEC);
    Serial.print(now.second(), DEC);


So I know I'm doing something wrong but I'm not sure what. Any help would be hugely appreciated.

  • Can you post a schematic of how you have the DS1307 wired?
    – ThreePhaseEel
    Commented Nov 18, 2017 at 0:50
  • Looks like a baud rate issue. Check your clock speed and settings.
    – Trevor
    Commented Nov 18, 2017 at 1:54
  • Set the serial monitor to 57600 and check.
    – ammar.cma
    Commented Nov 18, 2017 at 2:38
  • @ammar.cma In the code above you can see that I did set the serial monitor to 57600
    – chrispy
    Commented Nov 19, 2017 at 0:24
  • @Trevor What should I be changing it too exactly?
    – chrispy
    Commented Nov 19, 2017 at 0:25

1 Answer 1


Change the baud rate to 57600, it specifies at: Serial.begin(57600);

  • Thank you for the advice @senpaiscuba. I am new to stackoverflow and did not realize you could edit after posting.
    – jpo43
    Commented Apr 17, 2018 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.