I am new to this forum and am starting from the basics with wiring an Arduino Uno to control some LED's. As part of this project, I chose a Chronodot 2.1 as the RTC. I'm using the RTC Test sketch found here: http://learn.adafruit.com/ds1307-real-t ... g-the-code. When I upload the sketch, I get the following print out in the serial monitor:
2000/1/1 0:9:15
since 1970 = 946685355s = 10957d
now + 7d + 30s: 2000/1/8 0:9:45
2000/1/1 0:9:18
since 1970 = 946685358s = 10957d
now + 7d + 30s: 2000/1/8 0:9:48
(Note that my print out did not start with "RTC is NOT running!" on the first line, as in the tutorial. That should tell me something, but I'm not sure what?)
Now, when I attempt to set the time on the RTC, by uncommenting out RTC.adjust(DateTime(__DATE__, __TIME__)); and uploading the changed sketch, I get a very similar result - the time has not set itself to my computer's time:
2000/1/1 0:16:8
since 1970 = 946685768s = 10957d
now + 7d + 30s: 2000/1/8 0:16:38
2000/1/1 0:16:11
since 1970 = 946685771s = 10957d
now + 7d + 30s: 2000/1/8 0:16:41
Nothing changed. I did verify that I uploaded the sketch after uncommenting that line of code, so I guess I'm doing something else incorrectly or perhaps my wiring is not correct? I have the Wire and RTClib libraries and I am running at a baud rate of 57600, but I'm at a loss to figure out what I'm missing/overlooking. Any suggestions?
Chronodot 2.1
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Chronodot 2.1
The chronodot needs to be reset before you run your sketch. To do that, disconnect the power jumper and remove the backup battery.
Next, reinstall the battery, but don't connect the power jumper yet.
Compile and upload your sketch to the arduino. Open the serial monitor window.
Reconnect the power jumper to the chronodot, and press the reset button on the arduino.
You should see the "RTC not running message", and the correct time will be set in the chronodot.
Next, reinstall the battery, but don't connect the power jumper yet.
Compile and upload your sketch to the arduino. Open the serial monitor window.
Reconnect the power jumper to the chronodot, and press the reset button on the arduino.
You should see the "RTC not running message", and the correct time will be set in the chronodot.
- encker2
- Posts: 9
- Joined: Thu Oct 31, 2013 10:28 pm
Re: Chronodot 2.1
Thank you for your reply. The first few steps worked as expected. But when I reset the Uno, the print out reverts back to what it initially said the last time I worked on this. You'll see from the results below, in between the 2nd and 3rd reading is where I reset the board.
RTC is NOT running!
2165/165/165 165:165:85
since 1970 = 1379807185s = 15969d
now + 7d + 30s: 2013/9/28 23:46:55
2165/165/165 165:165:85
since 1970 = 1379807185s = 15969d
now + 7d + 30s: 2013/9/28 23:46:55
**Uno reset**
2000/1/1 0:0:18
since 1970 = 946684818s = 10957d
now + 7d + 30s: 2000/1/8 0:0:48
Upon further testing, the output changes to 2000/1/1 0:0:18 consistently as soon as I install the battery and reverts back to the 2165/165/165 165:165:85 date/time output as soon as I remove the battery. Could these results be indicative of incorrect wiring or the sign of a bad clock?
RTC is NOT running!
2165/165/165 165:165:85
since 1970 = 1379807185s = 15969d
now + 7d + 30s: 2013/9/28 23:46:55
2165/165/165 165:165:85
since 1970 = 1379807185s = 15969d
now + 7d + 30s: 2013/9/28 23:46:55
**Uno reset**
2000/1/1 0:0:18
since 1970 = 946684818s = 10957d
now + 7d + 30s: 2000/1/8 0:0:48
Upon further testing, the output changes to 2000/1/1 0:0:18 consistently as soon as I install the battery and reverts back to the 2165/165/165 165:165:85 date/time output as soon as I remove the battery. Could these results be indicative of incorrect wiring or the sign of a bad clock?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Chronodot 2.1
I've seen the 2165/165/165 165:165:85 thing before. I'm not sure what causes it, but it seems to be related to the battery. Can you post clear, detailed pictures of both sides of your chronodot?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Chronodot 2.1
Looks OK. Try a fresh battery.
- encker2
- Posts: 9
- Joined: Thu Oct 31, 2013 10:28 pm
Re: Chronodot 2.1
No dice. I swapped out the battery, the clock, the 4 jumper cables and the breadboard. I also tried a different USB port on my laptop. Same result each time. The only variables left are the USB cable and the Uno itself. I can probably find another USB cable, but before I order another Uno, I want to make sure there's not another answer. To that end, I've uploaded a picture of my wiring, in hopes that if I'm missing something here that's blatantly obvious, you guys will be notice it before I purchase another controller.
(Note - the perspective is off in this image. The red jumper is in the 5V power pin and the green jumper is in the ground pin. SDA is connected to analog pin 4 and SLC is connected to A5.)
(Note - the perspective is off in this image. The red jumper is in the 5V power pin and the green jumper is in the ground pin. SDA is connected to analog pin 4 and SLC is connected to A5.)
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Chronodot 2.1
That all looks good. Let's replace the Chronodot. Please email [email protected] with a link to this thread and ask for a replacement
- encker2
- Posts: 9
- Joined: Thu Oct 31, 2013 10:28 pm
Re: Chronodot 2.1
Thank you for the offer. Do you mean the Uno? I have already bought a new Chronodot clock that I have tried. The board is the only thing I haven't swapped out.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Chronodot 2.1
No - I meant the chronodot. This is not likely to be a problem with the Uno. But if you get the same problem with two different chronodots, then a third one is probably not going to solve the problem either.
Can you post the exact sketch you're using?
Can you post the exact sketch you're using?
- encker2
- Posts: 9
- Joined: Thu Oct 31, 2013 10:28 pm
Re: Chronodot 2.1
It is the code here: http://learn.adafruit.com/ds1307-real-t ... g-the-code
This is the code copied right from my sketch:
This is the code copied right from my sketch:
Code: Select all
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
void setup () {
Serial.begin(57600);
Wire.begin();
RTC.begin();
if (! RTC.isrunning()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
RTC.adjust(DateTime(__DATE__, __TIME__));
}
}
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.print(" since 1970 = ");
Serial.print(now.unixtime());
Serial.print("s = ");
Serial.print(now.unixtime() / 86400L);
Serial.println("d");
// calculate a date which is 7 days and 30 seconds into the future
DateTime future (now.unixtime() + 7 * 86400L + 30);
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);
}
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Chronodot 2.1
2165/165/165 165:165:85 - usually means that the clock is not running at all.Upon further testing, the output changes to 2000/1/1 0:0:18 consistently as soon as I install the battery and reverts back to the 2165/165/165 165:165:85 date/time output as soon as I remove the battery. Could these results be indicative of incorrect wiring or the sign of a bad clock?
2000/1/1 0:0:18 - usually means that the clock is running, but has not received a time adjustment.
But this output:
Code: Select all
2165/165/165 165:165:85
since 1970 = 1379807185s = 15969d
now + 7d + 30s: 2013/9/28 23:46:55
- encker2
- Posts: 9
- Joined: Thu Oct 31, 2013 10:28 pm
Re: Chronodot 2.1
Thank you for stating something else that I thought was odd: the September date. However, not being versed with this platform, I didn't know how significant it was when trying to set a current date/time.
And, yes, I was able to reproduce this event with both Chronodots. I guess this is another reason I wonder if there's something that I'm doing procedurally incorrect (where the files are saved on my PC/how I installed the Arduino software, where my libraries stored, etc. that I wouldn't think of as having any bearing on the outcome of the serial printout) or whether there is something wrong with the Uno itself. I guess there's also something in the back of my mind that questions the computer itself as being a possible reason that the clock can't receive the current time, although the computer does display the correct date/time in the task bar. That is something I haven't tried - installing the software and testing the results from a different PC.
And, yes, I was able to reproduce this event with both Chronodots. I guess this is another reason I wonder if there's something that I'm doing procedurally incorrect (where the files are saved on my PC/how I installed the Arduino software, where my libraries stored, etc. that I wouldn't think of as having any bearing on the outcome of the serial printout) or whether there is something wrong with the Uno itself. I guess there's also something in the back of my mind that questions the computer itself as being a possible reason that the clock can't receive the current time, although the computer does display the correct date/time in the task bar. That is something I haven't tried - installing the software and testing the results from a different PC.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Chronodot 2.1
I have to admit I am stumped. I've never seen symptoms like that before. The fact that it shows up with two different ChronoDots would tend to indicate that the issue is not with the Dot itself.
99% of the RTC problems we see here are due to soldering or connection problems. Your solder looks fine and clearly you are able to communicate with the devices. You could try re-wiring. It is a long-shot, but we have seen the occasional flaky jumper wire.
99% of the RTC problems we see here are due to soldering or connection problems. Your solder looks fine and clearly you are able to communicate with the devices. You could try re-wiring. It is a long-shot, but we have seen the occasional flaky jumper wire.
- macegr
- Posts: 293
- Joined: Fri Apr 04, 2008 4:46 pm
Re: Chronodot 2.1
The clock should not stop running if the battery is not present. If you run the sketch without the battery installed, you should at least get the 2000/1/1 date working. If it only works with the battery installed, then there is definitely some kind of problem with the power input. There's also actually an important difference between the first two tries in your first post in this thread. There's a difference of about 7 minutes between the attempts, so the ChronoDot is running in some capacity and keeping time. Or perhaps your local time was 00:16:38 when you compiled the sketch, and date didn't get set correctly.
If there really is 7 minutes between the first attempt and the attempt to set the time, maybe that's another indicator (depending on how fast you attempted this). Your computer should only take a few seconds to upload code to a UNO, so I wouldn't have expected more than a minute of elapsed time between those two attempts. If your computer is taking a really long time, then that might indicate other problems.
Anyway...the power behavior isn't normal; they should run just fine without a battery installed, if power is available. They'll also run with just the battery installed, and you can communicate to them that way...just run the battery down a lot faster. So the fact that communication is happening should not be taken as proof your power connections are correct. I would suspect a faulty ground connection, which could contribute to intermittent communication.
If there really is 7 minutes between the first attempt and the attempt to set the time, maybe that's another indicator (depending on how fast you attempted this). Your computer should only take a few seconds to upload code to a UNO, so I wouldn't have expected more than a minute of elapsed time between those two attempts. If your computer is taking a really long time, then that might indicate other problems.
Anyway...the power behavior isn't normal; they should run just fine without a battery installed, if power is available. They'll also run with just the battery installed, and you can communicate to them that way...just run the battery down a lot faster. So the fact that communication is happening should not be taken as proof your power connections are correct. I would suspect a faulty ground connection, which could contribute to intermittent communication.
Please be positive and constructive with your questions and comments.