perpignan, france
Offline
Full Member
Karma: 0
Posts: 209
|
 |
« on: February 21, 2012, 09:59:25 am » |
Hi all I just corrected a few bugs in the DS1307.h library found on this forum, and added 1.0 compatibility. I added a new example sketch with detailled comments, in french and in english (DS1307_demo_en or _fr) You can find the archive here : http://bricofoy.free.fr/forums/arduino/DS1307.zipPlease report bugs to bricofoy (at) free.fr Enjoy
|
|
|
|
« Last Edit: February 21, 2012, 10:01:32 am by bricofoy »
|
Logged
|
-tu savais que si tu passe le CD de windows à l'envers, tu entends une chanson satanique ? -non, mais il y a pire : à l'endroit, ça l'installe !!
|
|
|
|
Coppell, Texas
Offline
Newbie
Karma: 0
Posts: 27
|
 |
« Reply #1 on: February 25, 2012, 07:47:41 am » |
Hello,
I'm relatively new to the Arduino platform and am trying to use the DS1307 for a timestamp source. I've downloaded the DS1307.h library and have tried to run some of the examples. The sketches compile and load without error but the output is not a valid date (for example the DS1307_demo_en sketch produces the following timestamp: "Actual time : 45:85:85 7 165/45/2165")
What pins should I be using for SDA and SDC on the Arduino UNO?
Thank you,
|
|
|
|
|
Logged
|
|
|
|
|
perpignan, france
Offline
Full Member
Karma: 0
Posts: 209
|
 |
« Reply #2 on: February 27, 2012, 03:29:04 am » |
sda is A4 and sdc is A5. You must have pullups resistors somewhere on the I2C bus, only on one device.
Regarding the program output, did you set time in the ds1307 first ? When entering for exemple h00m00s00 R , and then some spaces, what is the next output ?
|
|
|
|
|
Logged
|
-tu savais que si tu passe le CD de windows à l'envers, tu entends une chanson satanique ? -non, mais il y a pire : à l'endroit, ça l'installe !!
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 3
|
 |
« Reply #3 on: March 25, 2012, 11:03:23 am » |
bricofoy, I just pulled out my DS1307 this morning and finally decided to hook it up. It's good to see the community already active with support. But, I, too, get the same results as miker. To answer your question, when I enter 'h00m00s00 R ' I get the following output: Actual time : 45:85:85 7 165/45/2165 hours set to 0
Actual time : 45:85:85 7 165/45/2165 minutes set to 0
Actual time : 45:85:85 7 165/45/2165 seconds set to 0 Actual time : 45:85:85 7 165/45/2165
Actual time : 45:85:85 7 165/45/2165
Actual time : 45:85:85 7 165/45/2165
And here's what I get when I enter 'h08m59s00M03D25Y12': Actual time : 45:85:85 7 165/45/2165 hours set to 8
Actual time : 45:85:85 7 165/45/2165 minutes set to 59
Actual time : 45:85:85 7 165/45/2165 seconds set to 0
Actual time : 45:85:85 7 165/45/2165 month set to 3
Actual time : 45:85:85 7 165/45/2165 day of month set to 25
Actual time : 45:85:85 7 165/45/2165 year set to 12
Actual time : 45:85:85 7 165/45/2165
Any idea what the problem might be? Gene
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 12
|
 |
« Reply #4 on: March 25, 2012, 11:56:07 am » |
i am getting errors like error wconstants.h: no such file or directory what is my problem pls help me
|
|
|
|
|
Logged
|
|
|
|
|
perpignan, france
Offline
Full Member
Karma: 0
Posts: 209
|
 |
« Reply #5 on: March 25, 2012, 01:35:26 pm » |
Any idea what the problem might be?
Gene
I'm afraid not  Seems the communication with the ds1307 is wrong. Are you sure about your I2C bus ? Do you have another I2C device to connect on the bus and try to see if it works ? Make sure you did not reverse SDA ans SDC pins between arduino board and DS1307. I'm quite puzzled you got the exact same output Miker got... Looks like a software bug (or you both have the exact same hardware issue, but this sound strange). It should be interesting to know wich arduino version you and miker are using ? So you should also try with another library for the DS1307, maybe there is a large bug lurking around in the one I updated :/ i am getting errors like error wconstants.h: no such file or directory what is my problem pls help me
What arduino IDE version are you using ? I tested with both 1.0 (wich I use) and 0.22 and it worked fine. Please include the complete error message and tell us what program are you trying to compile, one of yours or one of the examples provided with the library ?
|
|
|
|
« Last Edit: March 25, 2012, 01:46:14 pm by bricofoy »
|
Logged
|
-tu savais que si tu passe le CD de windows à l'envers, tu entends une chanson satanique ? -non, mais il y a pire : à l'endroit, ça l'installe !!
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 3
|
 |
« Reply #6 on: March 26, 2012, 12:33:10 am » |
I'm running Arduino v.1.0 software and the board is an Arduino Uno rev 3 board. I checked the SDA and SDC pins the were correct. I tried switching them anyways just in case and that didn't work. I'll see if I can dig up another I2C device to see how that works.
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 86
Posts: 9360
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #7 on: March 26, 2012, 01:49:09 pm » |
Nick Gammon has a I2C scanner on his (very good) website - http://www.gammon.com.au/forum/?id=10896 - that might be of help...
|
|
|
|
|
Logged
|
|
|
|
|
perpignan, france
Offline
Full Member
Karma: 0
Posts: 209
|
 |
« Reply #8 on: March 26, 2012, 05:56:33 pm » |
I just tried to reproduce the error you got, and the only way to produce something like that (but not with the exact same output) was to short-circuit sda and sdc, or to use wrong pullup resistor value.
can you try the i2c scanner robtillaart mentionned ?
|
|
|
|
|
Logged
|
-tu savais que si tu passe le CD de windows à l'envers, tu entends une chanson satanique ? -non, mais il y a pire : à l'endroit, ça l'installe !!
|
|
|
|
perpignan, france
Offline
Full Member
Karma: 0
Posts: 209
|
 |
« Reply #9 on: March 28, 2012, 01:10:55 pm » |
okay, miker and gdahilig, I eventually got your exact same output :
Heure actuelle : 45:85:85 7 165/45/2165
I achieved this... when unpluging the DS1307 !
So this is exactly what I suspected : there is a problem in your I2C bus, perhaps wrong pullup resistors values, or more basically your ds1307 chip is just dead.
In the next release of the lib, I will include a communication test to verify DS1307 respond before any further operation, and output a warning in such case.
|
|
|
|
« Last Edit: March 28, 2012, 01:14:15 pm by bricofoy »
|
Logged
|
-tu savais que si tu passe le CD de windows à l'envers, tu entends une chanson satanique ? -non, mais il y a pire : à l'endroit, ça l'installe !!
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 3
|
 |
« Reply #10 on: March 31, 2012, 01:07:17 pm » |
bicofoy,
Sorry it took so long for me to reply. Pull up resistors did the TRICK. I had none (doh!), but once those were put in, it all seems to work great!
Thanks for the much appreciated help!
gene
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 14
|
 |
« Reply #11 on: May 07, 2013, 11:32:07 am » |
Hi all I just corrected a few bugs in the DS1307.h library found on this forum, and added 1.0 compatibility. I added a new example sketch with detailled comments, in french and in english (DS1307_demo_en or _fr) You can find the archive here : http://bricofoy.free.fr/forums/arduino/DS1307.zipPlease report bugs to bricofoy (at) free.fr Enjoy I tried to show the time and date in arduino with RTC 1307, but after I turn off the power and turn it on again the next day, hour and date don't update,, confused why
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 86
Posts: 9360
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #12 on: May 07, 2013, 11:47:06 am » |
Do you have a backup battery on the RTC?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 14
|
 |
« Reply #13 on: May 07, 2013, 08:30:32 pm » |
Do you have a backup battery on the RTC?
yes I put 3.3 volt battery also in DS1307, but date not updating, the time updating but late from time actually... why? i'm confused...
|
|
|
|
« Last Edit: May 07, 2013, 08:34:49 pm by Fightforjuly »
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 99
|
 |
« Reply #14 on: May 08, 2013, 03:53:18 am » |
Maybe your RTC is "broken".
I have a couple of tiny RTC bought on ebay and one of them works fine and the other one, when I poweroff external battery, loses the hour. So, external battery doesn't work. I tried with the other one's battery and same happends.
But the other one, works fine with and without external power.
|
|
|
|
|
Logged
|
|
|
|
|
|