📬❄️📦Adafruit Holiday Shipping Deadlines 2019: Please place all UPS 3 Day orders by 11am ET Friday December 13 📬❄️📦
0

Implementing date/time library
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Implementing date/time library

by drummerboyx on Mon Apr 05, 2010 4:49 pm

Hello,
Is it possible for the date/time library to be a timer? For example, at 7 am each morning it moves a servo that feeds fish. I have something similar set up, but I have to turn it on exactly at 7 am for the timer to work properly. So, maybe the arduino can read the time from my MAC laptop then I can unplug my laptop and it can do a set action at 7 am. Can someone post code? I'm new to arduino and looked around the internet for this sort of thing, no luck and I'm at a dead end...

Elijah
drummerboyx
 
Posts: 80
Joined: Wed Feb 10, 2010 7:36 am

Re: Implementing date/time library

by franklin97355 on Mon Apr 05, 2010 7:01 pm

Which date/time library are you referencing? I don't want to spend my time looking for a library only to find out it isn't the one you are talking about.

franklin97355
 
Posts: 21362
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: Implementing date/time library

by drummerboyx on Mon Apr 05, 2010 7:20 pm

drummerboyx
 
Posts: 80
Joined: Wed Feb 10, 2010 7:36 am

Re: Implementing date/time library

by franklin97355 on Mon Apr 05, 2010 8:48 pm

I would get the enhanced version and run the sample code to see if it works for you. It won't be very accurate and will fail if the power is removed. If it were me I'd get a timer chip and power that with a backup battery.

franklin97355
 
Posts: 21362
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: Implementing date/time library

by John_NY on Thu Apr 08, 2010 8:35 pm

Using a real-time clock was mentioned instead of relying on the Arduino to keep time. The Adafruit Monochron clock keeps time using a DS1307 IC circuit. To add the RTC, you'd need a 32.768KHz 12.5pF crystal oscillator, a leaded CR2032 (or a CR2032 and a battery holder), a couple of pull-up resistors according to the MONOCHRON schematic, and the DS1307 itself.
Some links that might help with the DS1307:
Schematic from the MONOCHRON clock: http://www.ladyada.net/make/monochron/design.html
Adafruit Wiki Part Selector: http://www.ladyada.net/wiki/partselector/ic#rtc
Sparkfun Breakout Board: http://www.sparkfun.com/commerce/produc ... ucts_id=99
Alternate Source: http://www.taydaelectronics.com/servlet ... xim/Detail
Image
DS1307

The DS1307 RTC talks to the Arduino via the I2C pins (on the Arduino, Analog 5 is the clock, Analog 4 is the data), which uses the "Wire.h" library.
According to the data sheet, the I2C address register is set as follows.
Access is obtained by implementing a START condition and providing a device identification
code followed by a register address. Subsequent registers can be accessed sequentially until a STOP condition is
executed.

Not sure what that means, so I'd probably check the SparkFun links.
Sparkfun Breakout: http://www.sparkfun.com/commerce/produc ... ucts_id=99
How to page: http://combustory.com/wiki/index.php/RT ... ck#Summary

Implementing a real-time clock is on my "To Do" list -- so I can just point to the links, but not yet say how well they work.
-John
John_NY
 
Posts: 55
Joined: Sun Jul 05, 2009 2:54 am
Location: SoCal

Please be positive and constructive with your questions and comments.