Anyone know what happens to the internal clock on a raspberry pi during a power outage?
I have a Raspberry Pi OW, and it occurred to me that it’s internal clock might have to be reset every time it loses power.
It’s hard for me to test because I have it in headless mode, and connect to it via ssh. Which means by the time I am able to check, it’s already been connected to the internet
-
- Posts: 152
- Joined: Tue Jul 28, 2020 10:34 am
Time keeping on Ras-pi
Last edited by GarraTheWinnie on Wed Oct 14, 2020 12:35 pm, edited 1 time in total.
-
- Posts: 1238
- Joined: Sat Nov 09, 2019 12:14 pm
Re: Time keeping on Ras-pi
There is no "internal clock" on a Raspberry Pi.
Thus, your assumptions about what happens are all correct.
Thus, your assumptions about what happens are all correct.
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth
Loves Linux; loves to dance.
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth
Loves Linux; loves to dance.
-
- Posts: 152
- Joined: Tue Jul 28, 2020 10:34 am
Re: Time keeping on Ras-pi
If I install a time server on my Raspberry Pi, will it keep the time after being unplugged?
I read an article that suggest it might, but without a battery of some sort, I can’t imagine it would
I read an article that suggest it might, but without a battery of some sort, I can’t imagine it would
- DougieLawson
- Posts: 40523
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
- Contact: Website Twitter
Re: Time keeping on Ras-pi
There are no time-of-day clocks on a RPi without adding additional external hardware.GarraTheWinnie wrote: ↑Wed Oct 14, 2020 12:16 pmAnyone know what happens to the internal clock on a raspberry pi during a power outage?
On restart the system clock is reset to 17 minutes past the last hour it was up. So it the time was 21:45 when the power failed it will come back up with the clock set to 21:17. That's due to the somewhat insane behaviour of fake-hwclock. Once the internet is connected then systemd's timesyncd process should reset the clock to the time from an internet time server.
Any language using left-hand whitespace for syntax is ridiculous
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
-
- Posts: 152
- Joined: Tue Jul 28, 2020 10:34 am
Re: Time keeping on Ras-pi
Ah ok.
I’m looking at RTCs online, and as with most things raspberry pi, they aren’t expensive until the shipping comes in.
Does raspi have a low power mode?
If I wanted to program it to power everything except the ‘internal clock’ during a power outage, is that possible?
I’m looking at RTCs online, and as with most things raspberry pi, they aren’t expensive until the shipping comes in.
Does raspi have a low power mode?
If I wanted to program it to power everything except the ‘internal clock’ during a power outage, is that possible?
- DougieLawson
- Posts: 40523
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
- Contact: Website Twitter
Re: Time keeping on Ras-pi
There is no such thing.
It runs at low power normally unless you're beating the CPU to death. It costs less than £5 a year to run for 24/365.
You need a battery backed RTC.
Any language using left-hand whitespace for syntax is ridiculous
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
-
- Posts: 152
- Joined: Tue Jul 28, 2020 10:34 am
Re: Time keeping on Ras-pi
Fair enough.
Thanks!
Thanks!
Re: Time keeping on Ras-pi
As Dougie says, no.
But, you can down clock it and reduce the voltage to some minimal values to reduce the power consumption.
It might go as low as 200MHz (arm_freq=200) and perhaps over_voltage=-4
You would have to experiment (edit /boot/config.txt)
Turn off the HDMI if you are not using it with "/usr/bin/tvservice -o" in /etc/rc.local
Last edited by jahboater on Wed Oct 14, 2020 1:31 pm, edited 1 time in total.
Pi4 8GB and Pi4 4GB running Raspberry Pi OS 64-bit
- RaTTuS
- Posts: 10700
- Joined: Tue Nov 29, 2011 11:12 am
- Location: North West UK
- Contact: Twitter YouTube
Re: Time keeping on Ras-pi
https://www.aliexpress.com/item/4001304848879.html
I've not used it, others are available YMMV
I've not used it, others are available YMMV
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
-
- Posts: 152
- Joined: Tue Jul 28, 2020 10:34 am
Re: Time keeping on Ras-pi
I ended up buying this
I’m not sure why it has two spaces for VCC, ground, Sda, and SCL. Am I safe to assume it’s for connecting other devices in line?
There isn’t much information about the 32k and the Pwm pin. I assumed one was to power a buzzer, but I am having doubts about it
I’m not sure why it has two spaces for VCC, ground, Sda, and SCL. Am I safe to assume it’s for connecting other devices in line?
There isn’t much information about the 32k and the Pwm pin. I assumed one was to power a buzzer, but I am having doubts about it
-
- Posts: 13971
- Joined: Fri Mar 09, 2012 7:36 pm
- Location: Vallejo, CA (US)
Re: Time keeping on Ras-pi
Those are okay. At present, I'm using this one: https://chicagodist.com/products/rasclo ... spberry-pi It has the advantage of a replaceable battery, which that site also sells, for considerably less than local (to me) retail.RaTTuS wrote: ↑Wed Oct 14, 2020 1:30 pmhttps://www.aliexpress.com/item/4001304848879.html
I've not used it, others are available YMMV
Re: Time keeping on Ras-pi
Probably. Or as an alternative means of connecting if not wanting to use the 6-way connector at the other end.GarraTheWinnie wrote: ↑Wed Oct 14, 2020 2:57 pmI ended up buying this
I’m not sure why it has two spaces for VCC, ground, Sda, and SCL. Am I safe to assume it’s for connecting other devices in line?
The "32K" output is simply a 32kHz open-drain output, possibly with pull-up on-board, taking the internal DS3231 clock out to other things which may find that useful. Most things wouldn't.GarraTheWinnie wrote: ↑Wed Oct 14, 2020 2:57 pmThere isn’t much information about the 32k and the Pwm pin. I assumed one was to power a buzzer, but I am having doubts about it
By PWM pin I presume you mean the SQW output. That's another open-drain output, possibly with pull-up on-board, which can be used to flash a LED on and off to show it's working, or provide a slow clock rate to something else, or provide a signal for when an alarm condition has been met.
The DS3231 datasheet will contains the details for both. Neither are probably used nor that useful when used by the Pi as a time-keeping RTC, but you might be able to leverage use for user applications.
-
- Posts: 1238
- Joined: Sat Nov 09, 2019 12:14 pm
Re: Time keeping on Ras-pi
I'm trying to figure out why you care. From your OP, it is clear that your Pi *IS* Internet connected and it gets and correctly sets its time from the Internet, so why are you fussing with RTCs?
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth
Loves Linux; loves to dance.
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth
Loves Linux; loves to dance.
-
- Posts: 152
- Joined: Tue Jul 28, 2020 10:34 am
Re: Time keeping on Ras-pi
I did mean SQW, my bad. Good to know! The Datasheet I looked up explained what they were, but not what they were for. I couldn’t find an example online of what they were used for. So now I knowhippy wrote: ↑Wed Oct 14, 2020 3:35 pmBy PWM pin I presume you mean the SQW output. That's another open-drain output, possibly with pull-up on-board, which can be used to flash a LED on and off to show it's working, or provide a slow clock rate to something else, or provide a signal for when an alarm condition has been met.
The DS3231 datasheet will contains the details for both. Neither are probably used nor that useful when used by the Pi as a time-keeping RTC, but you might be able to leverage use for user applications.
Thanks for the help!
my project is connected to the wifi whileGlowInTheDark wrote: I'm trying to figure out why you care. From your OP, it is clear that your Pi *IS* Internet connected and it gets and correctly sets its time from the Internet, so why are you fussing with RTCs?
I work on it. I’m undecided if it will stay that way. Even if it does, my area gets power outages a lot, and my internet isn’t the greatest. My project doesn’t need the internet, so it would nice to not have to relay on it. Besides 90% of Pi projects are ‘because I can’, isn’t that a good enough reason?
-
- Posts: 1238
- Joined: Sat Nov 09, 2019 12:14 pm
Re: Time keeping on Ras-pi
Absolutely. I was just trying to get a feel for what your actual situation was.Besides 90% of Pi projects are ‘because I can’, isn’t that a good enough reason?
BTW, it is also true that my one experience with putting an RTC on a Pi was, to say the least, less than satisfying, so I'm a little skeptical of the whole general idea.
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth
Loves Linux; loves to dance.
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth
Loves Linux; loves to dance.
-
- Posts: 152
- Joined: Tue Jul 28, 2020 10:34 am
Re: Time keeping on Ras-pi
I’m making a reef-Pi system to automate numerous things on my fish tank.
In all honesty, my power company sucks. It’s too important to relay on everything turning on properly.
So I figured I’d see how this works out
In all honesty, my power company sucks. It’s too important to relay on everything turning on properly.
So I figured I’d see how this works out
Re: Time keeping on Ras-pi
Would a ups be better in that case ?GarraTheWinnie wrote: ↑Wed Oct 14, 2020 9:02 pmI’m making a reef-Pi system to automate numerous things on my fish tank.
In all honesty, my power company sucks. It’s too important to relay on everything turning on properly.
So I figured I’d see how this works out
Re: Time keeping on Ras-pi
That's always a tough one to determine. It usually boils down to how long any outages will be and how detrimental not doing something at the time it should be done is, whether things can be successfully mitigated by playing catch-up later.
It's not unusual that the first thought to enter people's head when the mains goes off is the risk to food in their freezers. That's likely the least of their worries.
Re: Time keeping on Ras-pi
It may depend how much the fish are worth.hippy wrote: ↑Thu Oct 15, 2020 12:05 pmThat's always a tough one to determine. It usually boils down to how long any outages will be and how detrimental not doing something at the time it should be done is, whether things can be successfully mitigated by playing catch-up later.
It's not unusual that the first thought to enter people's head when the mains goes off is the risk to food in their freezers. That's likely the least of their worries.