DS1307 Real Time Clock
#1
Posted 26 August 2010 - 10:15 PM
#2
Posted 13 December 2010 - 09:44 PM
good project. I used it and it works fine. I had to add two pullup resistors (one 2.2K between SDA and +5, one 2.2K between SCL and +5) as indicated in the ds1307 datasheet.
I used this module
Thank you for your project.
Bye,
Stefano.
#3
Posted 22 December 2010 - 01:52 PM
Hi stacyh3,
good project. I used it and it works fine. I had to add two pullup resistors (one 2.2K between SDA and +5, one 2.2K between SCL and +5) as indicated in the ds1307 datasheet.
I used this module
Thank you for your project.
Bye,
Stefano.
How do i determine the address of the DS1307?
tony
#5
Posted 22 December 2010 - 02:39 PM
thanks CW2....another question....According to the datasheet (pdf), the address is 0x68 (b1101000).
private const int I2CAddress = 0x68; private const int I2CTimeout = 1000; private const int I2CClockRateKhz = 100; public const int UserDataAddress = 8; public const int UserDataLength = 56; private I2CDevice clock = new I2CDevice(new I2CDevice.Configuration(I2CAddress, I2CClockRateKhz));
I have seen that i need to connect the DS1307 to Analog Pin 4 and 5. Is this hardcoded? The configuration does not specify which pins to use or are these the only ones that support i2c?
thanks in advance
tony
#6
Posted 22 December 2010 - 02:56 PM
Yes, it is hardcoded. You can see in the schematic that the I2C signal lines are multiplexed with analog inputs and accessible via Analog Input pins 4 and 5. The microcontroller has only one I2C hardware module - it would be possible to implement "software" I2C on any two pins, but it would require native driver; another option could be to use an expander or bus converter IC...I have seen that i need to connect the DS1307 to Analog Pin 4 and 5. Is this hardcoded? The configuration does not specify which pins to use or are these the only ones that support i2c?
#7
Posted 22 December 2010 - 03:08 PM
Sorry for all the questions as i am using the code above but its not working. Do i need to connect a battery if it connect to 5V? When it gets to this codeYes, it is hardcoded. You can see in the schematic that the I2C signal lines are multiplexed with analog inputs and accessible via Analog Input pins 4 and 5. The microcontroller has only one I2C hardware module - it would be possible to implement "software" I2C on any two pins, but it would require native driver; another option could be to use an expander or bus converter IC...
public DateTime Now() { var data = new byte[7]; int result = Read(0, data);//*******Returns 1 and data has all zeros in it //TODO: Add exception handling if result == 0
tony
#8
Posted 23 December 2010 - 01:39 AM
Sorry for all the questions as i am using the code above but its not working. Do i need to connect a battery if it connect to 5V?
The battery is backup in case the 5V is disconnected. If the battery is not present, this pin must be grounded or the DS1307 won't work... I found that out the hard way a few years ago...
#9
Posted 23 December 2010 - 04:11 AM
thanks for your advice..got it working...mmm...and also make sure your track don't touch each other. I am using a vero board and using screw driver to break tracks...drill might be betterSorry for all the questions as i am using the code above but its not working. Do i need to connect a battery if it connect to 5V? When it gets to this code
public DateTime Now() { var data = new byte[7]; int result = Read(0, data);//*******Returns 1 and data has all zeros in it //TODO: Add exception handling if result == 0
tony
#10
Posted 12 October 2011 - 03:55 PM
Me too... anybody find the solution? Thank You.Sorry for all the questions as i am using the code above but its not working. Do i need to connect a battery if it connect to 5V? When it gets to this code
public DateTime Now() { var data = new byte[7]; int result = Read(0, data);//*******Returns 1 and data has all zeros in it //TODO: Add exception handling if result == 0
Alberto.
#11
Posted 12 October 2011 - 05:15 PM
how did you connect it? Did you include a 5V battery?Me too... anybody find the solution? Thank You.
Alberto.
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#12
Posted 14 October 2011 - 08:01 AM
I connect the module:how did you connect it? Did you include a 5V battery?
SDA -> Netduino Analog Pin 4
SCL -> Netduino Analog Pin 5
GND -> Netduino GND
Vcc -> Netduino 5V
And also I connect 2 resistors (2.2 Khm):
SDA --> 2.2 Khm resistor --> Vcc
SCL --> 2.2 Khm resistor --> Vcc
And also include the CR2032 battery on the slot
But doesn't work...
P.S. I translate the C# code in VB...
Alberto.
#13
Posted 14 October 2011 - 08:45 AM
#14
Posted 30 December 2011 - 08:13 PM
#15
Posted 09 October 2012 - 08:38 PM
#16
Posted 03 November 2012 - 10:26 PM
Are you struggling with getting the time from an NTP server...or setting the time of the RTC?I am trying to set the time of the RTC using a NTP server once a month. Any Ideas?
Chris
#17
Posted 04 November 2012 - 02:00 AM
Hi boez52,
Are you struggling with getting the time from an NTP server...or setting the time of the RTC?
Chris
Neither, I got it working a few weeks ago
#18
Posted 04 November 2012 - 02:16 AM
Okay cool. Sorry that I didn't see this post until today. Thank you for the update.Neither, I got it working a few weeks ago
Chris
#19
Posted 31 December 2012 - 07:24 PM
Hi.
Just to say this code worked fine to me after I set up clock. I was getting exceptions on mscorlib due weird values on DS1307. I think...
I used this code on Netduino plus, latest firmware and an Arduino module Tiny RTC with an extra AT24C32 memory on I2C bus, 3.3K ohms pull ups.
Many thanks!
#20
Posted 31 December 2012 - 07:43 PM
i also have written some ds1307 code.
it can be found here: http://forums.netdui...ground/?p=41558
it also shows how to access the ds1307 sram.
greetings
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users