Pages: [1]   Go Down
Author Topic: Keeping time and power supply  (Read 865 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I recently just bought an arduino, should be coming in the mail any day now.

In preparation for its arrival I've downloaded the software and programmed a few main functions for my purpose.

My question is in regards to keeping time. The old DateTime library states "The disadvantage is that time will be incorrect if the Arduino is reset." Does this include switching off the arduino or is there a small battery that keeps those settings?

And if not, is it easy to transfer power supplies from one to another? i.e usb to battery?

p.s I know the arduino is not accurate for time keeping, it doesn't need to be.


references

http://www.arduino.cc/playground/Code/DateTime
 
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 95
Posts: 4084
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Adding a real time clock with a backup battery is a common solution. The setup() function can read the RTC at startup and set the time. This library works well for me, and actually synchronizes its time with the RTC periodically. I have several of Adafruit's RTCs, they work well, there are many others out there too. Check the Chronodot if more long-term accuracy is needed.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27081
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There are other Maxim RTCs that are same form factor, internal crystal, and more accurate long term as well.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7197
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Besides real time clocks, which are incredibly cheap, if your project involves a GPS, you can also receive time from GPS if it has a lock on satellites (best chance outdoors) and there is no need to correct long-term drift of time except that the time is at Greenwich for those that use day light saving time, you need to make adjustment twice a year (thanks Franklin?!).
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for your suggestions. I don't require an RTC nor a GPS because time doesn't need to be accurate as I would be only required to use the time for 4 hours. 

I just wanted to know if I can turn the arduino off for maybe an hour (unconnected from a power source) and not have to re-calibrate the time.

Thank you though. smiley
I'm looking forward to playing around with it.
« Last Edit: December 11, 2011, 04:15:20 am by aperture22506 » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27081
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So I guess the answer is No then. You need a wallwart or battery or USB or solar or something for power source if you want to keep time running.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7197
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

A more detailed NO: Arduino has no clock. It doesn't know what time it is unless you tell it. But it can count time like a stop watch, which knows not what time it is but only time elasped since it last was restarted, up to many hours beyond 4 hours. So if you want arduino to count up to 4 hours (not telling you what time it is like 5:30pm), you need to continuously supply power to it. Real time clocks can keep time ticking when main power is off only when they are equipped with backup batteries. You can't keep time without using some sort of energy. That's basic sense.
Logged


Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27081
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"You can't keep time without using some sort of energy."

Well, there's always sundials  smiley-lol

I used to have a sundial watch I'd wear as a joke indoors.  People would ask what time it was at a meeting, I'd slide my sleeve back and more around until  I had a shadow from the flourescent lights, then announce some time close to the end (or start) of the meeting, or lunch, or quitting time.

Looked like a piece of carved rock, I snapped the upright off 1 too many times & lost it eventually.

Kind of like this one
http://www.fossil.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=12052&catalogId=10052&productId=22060007&cm_mmc=PG-_-feed-_-pdp-_-dly&mr:referralID=30d5873a-0735-11e0-b21a-001b2166c2c0

Got it a  museum gift shop I think.

Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah thank you,

Looks like i will be bringing my laptop.

I just thought there maybe a little battery (just like the cmos batt in computers).

Logged

Pages: [1]   Go Up
Jump to: