alternative to RTC

I'm making ~35 dataloggers that need to timestamp events. They'll be in the field and battery conservation is important. Also, the less hardware the better, just because it's one more thing to break. I don't want to use an RTC for the reason above and also for budget reasons. I was thinking about the time library, but I don't know how accurate it is. I've also considered using a crystal and changing that into time, but that might be the same as using the time library... http://www.arduino.cc/playground/Code/Time

Using an all-software route would be cheapest, but it also seems like it would be the least accurate. Using an RTC would be the most accurate, but the most expensive. Any ideas I haven't listed or things I don't know?

Any ideas I haven't listed or things I don't know?

Ah, 2nd Order Ignorance. You've come to the right place!

Typically, an RTC is built to run a very long time on a single low-energy battery. If you include an RTC, you will (probably) be able to put the Atmel processor into the deepest sleep modes thus conserving a significant amount of power.

A software only solution will use considerably more power; you will have fewer parts but you will need a bigger battery.

In either case, the voltage regulator consumes (wastes) a significant amount of power. Try to eliminate it.

First think about what accuracy you really need. Note that it will accumulate without synchronization (by ethernet or telphone). If 30 seconds a day is o.k., then we can talk about software...

RTC isnt that expensive, a DS1307+Crystal+2 resistors+battery+holder < $3

Combined with the time library will give you the best of both worlds! if the RTC fails the library should keep reasonable time.

And as mentioned before the low power usage is a good thing I use a RTC on mine so it sets the time if there is any power outs, I also added and external EEPROM on the RTC board to store log results as both are wired on the same serial interface!

If my Arduinos are anything to go by, software is capable of far better than 30 seconds a day. I have a system running and logging various things remotely over the internet.

http://majestic81.plus.com/

Its been running over a year, once a minute (time locked via NTP) it logs the date and time from the NTP computer and the 'Milliseconds since start' value from the above web page. Its currently over 35 days since it last 'went round the clock' and in that time its gained just over 15 seconds. All my arduinos (including an ebay knock off) are accurate to within 2 seconds a day. I get better than 20 seconds a day from my home brews with cheap ceramic resonators instead of crystals. I don't run them in temperature controlled environments and the page above is often unheated for long periods in winter and the accuracy doesn't vary by much.

Interesting to have such a statistic. I did not say that an Arduino looses or gains 30 s per day. However this is something you have to expect under worst case conditions, which is mainly temperature (zero degrees... 40 degrees..). Another problem is reset... The time can most likely only be upheld when writing it into the EEPROM, and restoring it; this will give an additional error of 1/2 storage intervall per restart...

hmm, I didn't know that RTCs were that cheap. I've found them on sparkfun for around twenty dollars, maybe I'm not looking in the right place?

Also, what's a more energy-conservative way to power an arduino from a 9volt without a voltage regulator?

RTC boards maybe expensive, but i got mine from below :-

http://cgi.ebay.co.uk/50pcs-Crystal-32-768-kHz-32-768KHZ-Cylinder-3-x-8-mm-/250643472458?pt=LH_DefaultDomain_0#ht_2512wt_1002

http://cgi.ebay.co.uk/20pcs-DS1307-1307-I-C-Real-Time-Clock-Dallas-DIP-8-/140436664483?pt=LH_DefaultDomain_0

2 resistors is all you need, adding a 3v battery and holder will preserve the clock!

actually, here's an idea: I have ~35 units that log data and store them temporarily. I have one unit that goes around and takes the data via serial or I2C and stores it to an SD card. Could I just have an RTC on the SD card arduino and when I transfer data, I update the time on the individual units? I think I remember there being a setTime() command or something.