Go Down

Topic: Keeping time and power supply (Read 929 times) previous topic - next topic

aperture22506

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
 

Jack Christensen

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.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

CrossRoads

There are other Maxim RTCs that are same form factor, internal crystal, and more accurate long term as well.
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.

liudr

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?!).

aperture22506

#4
Dec 11, 2011, 10:12 am Last Edit: Dec 11, 2011, 10:15 am by aperture22506 Reason: 1
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. :)
I'm looking forward to playing around with it.

CrossRoads

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.
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.

liudr

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.

CrossRoads

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

Well, there's always sundials  XD

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.

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.

aperture22506

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).


Go Up