5

I use Motion detection and a webcam as a security camera. It's headless with no internet or keyboard. To turn the camera off while it's not need I just turn the power supply off. Because I shut it down this way the time doesn't get saved onto the SD card, which I think happens on a normal shutdown?, so when I boot it up next time the time it loads off the SD card is way back to the last time I ever shut the Pi down correctly. This makes the timestamps and file names of the images Motion is storing on my USB stick double/triple/quadruple up with previous recordings and it makes it hard to sort through and some files also get overwritten.

I am wanting to know a way where a script(the one that saves the time on normal shutdowns) saves the current time of the system every 10 minutes or so, so that if the Pi looses it power and turns back on, it will continue making recording from where it previously was(within 10 minutes)(might overwrite a few minutes worth).

3

You can install ntp and fake hardware clock

apt-get install ntp fake-hwclock

ntp will get the time when you have internet access and fake hardware clock will save time to the Pi every so often. After reboot or power cycle - if there is no internet fake clock will read the last time it save.

We dont want the Pi to crash at all and generally fake-hw clock is the best choice if you want to spend $0 :) But for a few "bucks" look at John La Rooy's answer for an external clock that will keep time for years.

5

Have a search on ebay for "i2c rtc"

enter image description hereenter image description here

There are plenty of very inexpensive ones based on the DS1307 battery included!

I've connected one of these previously, but I don't think I posted the code anywhere yet. I'll add it to this answer when I find it.

The other chip is an AT24C32 flash memory that you can ignore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.