Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

RTC won't output to Serial Monitor
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

RTC won't output to Serial Monitor

by gouletd98 on Wed Jul 01, 2020 1:25 pm

Hello,

I have the following data logging shield https://www.adafruit.com/product/1141 connected to an Arduino pro (https://www.sparkfun.com/products/10915). I have the replaceable battery (https://www.adafruit.com/product/380) inserted into the port positive side up for a backup. This setup is connected to my computer through the FTDI USB-serial converter https://www.adafruit.com/product/70, with all of the needed drivers installed.

I downloaded the RTClib and was following the instruction set on how to set up the real-time clock (https://learn.adafruit.com/adafruit-dat ... time-clock) but every time I run the program, nothing uploads to the serial port (after making sure that the BAUD rates match). I am running the Examples --> RTClib --> PCF8523 code and not changing anything to it before I upload.

I do not have an SD card plugged into my shield but I did not think this would affect it. Any ideas on what I could be experiencing / troubleshooting methods?

gouletd98
 
Posts: 18
Joined: Wed Jul 01, 2020 1:11 pm

Re: RTC won't output to Serial Monitor

by adafruit_support_carter on Wed Jul 01, 2020 2:09 pm

but every time I run the program, nothing uploads to the serial port (after making sure that the BAUD rates match).

Can you clarify what is happening here. Is the sketch not uploading? Or does it upload but you see nothing in the Serial Monitor?

adafruit_support_carter
 
Posts: 16846
Joined: Tue Nov 29, 2016 2:45 pm

Re: RTC won't output to Serial Monitor

by gouletd98 on Wed Jul 01, 2020 2:12 pm

Of course, the sketch successfully uploads but I see nothing in the Serial Monitor.

gouletd98
 
Posts: 18
Joined: Wed Jul 01, 2020 1:11 pm

Re: RTC won't output to Serial Monitor

by adafruit_support_carter on Wed Jul 01, 2020 2:31 pm

Try sanity checking Serial Monitor functionality using a very simple sketch that just loops and prints. Don't even worry about the RTC. Just print "hello world" or something. See if you can get anything to show up in Serial Monitor.

adafruit_support_carter
 
Posts: 16846
Joined: Tue Nov 29, 2016 2:45 pm

Re: RTC won't output to Serial Monitor

by gouletd98 on Wed Jul 01, 2020 2:44 pm

The Serial Monitor seems to be outputting just fine.
Attachments
Hello_World.png
Hello_World.png (36.47 KiB) Viewed 42 times

gouletd98
 
Posts: 18
Joined: Wed Jul 01, 2020 1:11 pm

Re: RTC won't output to Serial Monitor

by adafruit_support_carter on Wed Jul 01, 2020 2:53 pm

OK, thanks for the simple check.

Try adding some more prints to the example sketch. Like here:
https://github.com/adafruit/RTClib/blob ... 23.ino#L14
add
Code: Select all | TOGGLE FULL SIZE
Serial.println("RTC Example Sketch");

just to add a simple beginning print statement that you can look for.

adafruit_support_carter
 
Posts: 16846
Joined: Tue Nov 29, 2016 2:45 pm

Re: RTC won't output to Serial Monitor

by gouletd98 on Wed Jul 01, 2020 3:02 pm

I added that line and it prints it, but does nothing else. Should I have something physically wired on the data shield? I know in the document (https://learn.adafruit.com/adafruit-dat ... time-clock) it doesn't mention any connection of wires, unless you have the first revision which I do not have (https://learn.adafruit.com/adafruit-dat ... and-config). Thank you for the help!
Attachments
RTC_help.png
RTC_help.png (34.32 KiB) Viewed 40 times

gouletd98
 
Posts: 18
Joined: Wed Jul 01, 2020 1:11 pm

Re: RTC won't output to Serial Monitor

by adafruit_support_carter on Wed Jul 01, 2020 3:09 pm

Weird. Even if it were a connection issue, I'd expect you'd see the other prints. Like "Couldn't find RTC" etc.

Try adding even more prints to see if you can narrow down where it's stalling. Ex:

Code: Select all | TOGGLE FULL SIZE
void setup () {
  Serial.begin(57600);

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

  Serial.println("RTC Example Sketch");

  Serial.println("Initializing RTC...");

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

  Serial.println("Checking if time is set...");

  if (! rtc.initialized() || rtc.lostPower()) {
    Serial.println("RTC is NOT initialized, 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));
    //
    // Note: allow 2 seconds after inserting battery or applying external power
    // without battery before calling adjust(). This gives the PCF8523's
    // crystal oscillator time to stabilize. If you call adjust() very quickly
    // after the RTC is powered, lostPower() may still return true.
  }

  // 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));

  Serial.println("DONE.");
}

adafruit_support_carter
 
Posts: 16846
Joined: Tue Nov 29, 2016 2:45 pm

Re: RTC won't output to Serial Monitor

by gouletd98 on Wed Jul 01, 2020 3:26 pm

It appears to cut off right after. Any ideas?

Code: Select all | TOGGLE FULL SIZE
 Serial.println("Initializing RTC...");
Attachments
Troubleshoot_RTC.png
Troubleshoot_RTC.png (31.74 KiB) Viewed 38 times

gouletd98
 
Posts: 18
Joined: Wed Jul 01, 2020 1:11 pm

Re: RTC won't output to Serial Monitor

by adafruit_support_carter on Wed Jul 01, 2020 4:59 pm

It seems like it's not returning from the call the begin(). There's not much that happens there:
https://github.com/adafruit/RTClib/blob ... .cpp#L1039

This might be a connection issue with the I2C bus. Can you post a photo of the setup showing how everything is connected.

adafruit_support_carter
 
Posts: 16846
Joined: Tue Nov 29, 2016 2:45 pm

Re: RTC won't output to Serial Monitor

by gouletd98 on Thu Jul 02, 2020 2:50 pm

This is how I have it in current state. I have also tried connecting the SCL and SDA to A4/A5 to see if that changed anything.
Attachments
IMG_0354.JPG
IMG_0354.JPG (737.32 KiB) Viewed 35 times
IMG_0353.JPG
IMG_0353.JPG (526.28 KiB) Viewed 35 times
IMG_0352.JPG
IMG_0352.JPG (964.3 KiB) Viewed 35 times

gouletd98
 
Posts: 18
Joined: Wed Jul 01, 2020 1:11 pm

Re: RTC won't output to Serial Monitor

by adafruit_support_carter on Thu Jul 02, 2020 3:25 pm

I have also tried connecting the SCL and SDA to A4/A5 to see if that changed anything.

How did you do this? Did you solder the jumpers on the back of the shield? This might be the general issue. The Data Logger shield uses the SCL/SDA pins. The Arduino Pro does not have those. So you will have to use A4/A5 from the Arduino Pro and solder the jumpers on the back of the shield.

adafruit_support_carter
 
Posts: 16846
Joined: Tue Nov 29, 2016 2:45 pm

Re: RTC won't output to Serial Monitor

by gouletd98 on Thu Jul 02, 2020 3:52 pm

I did Solder the jumpers on the back of the board. I have no wires plugged into anything right now. Should I have something going to A4 / A5? Thanks again for the help!
Attachments
IMG_0355.JPG
IMG_0355.JPG (418.39 KiB) Viewed 34 times

gouletd98
 
Posts: 18
Joined: Wed Jul 01, 2020 1:11 pm

Re: RTC won't output to Serial Monitor

by adafruit_support_carter on Thu Jul 02, 2020 4:09 pm

Hmm. That should be all you need. Those jumper pads are routed to the A4/A5 header pins.

Do you have stacking pins here? Are they long enough to actually engage with the Arduino?
pins.jpg
pins.jpg (39.34 KiB) Viewed 33 times


As another way to test, try running this I2C scanner sketch to see if anything is seen on the I2C bus:
https://playground.arduino.cc/Main/I2cScanner/

adafruit_support_carter
 
Posts: 16846
Joined: Tue Nov 29, 2016 2:45 pm

Re: RTC won't output to Serial Monitor

by gouletd98 on Thu Jul 02, 2020 4:19 pm

They are connected using stacking headers. I have been able to read out information from voltage dividers, connect LEDs, etc. to the pins so I would assume they are engaged enough?

I tried doing that and it didn't even report the following after letting it run for ~2 minutes:
Code: Select all | TOGGLE FULL SIZE
Serial.println("No I2C devices found\n");
Attachments
i2c check.png
i2c check.png (29.63 KiB) Viewed 33 times

gouletd98
 
Posts: 18
Joined: Wed Jul 01, 2020 1:11 pm

Please be positive and constructive with your questions and comments.