jojo_angelov
Posts: 38
Joined: Mon Jan 06, 2014 1:59 am

Unplug and plug the pi once a day - will it short it out?

Sat Nov 22, 2014 8:13 pm

So I am wondering if unplugging the pi physically to restart it once a day will cause any problem in the long run? Could it damage /short it out somehow?
I need the pi to be running continously and I wanna cover the case if the pi shutdowns. I have a watchdog in place but I'm concerned about physically shutting down die to a problem.

User avatar
rpdom
Posts: 15592
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Unplug and plug the pi once a day - will it short it out

Sat Nov 22, 2014 8:27 pm

Unplugging and plugging in the Pi will not damage it. That is what the plug is for.

Unplugging it without first shutting down cleanly will probably leave the filesystem in an unclean state which should be recoverable, but on rare occasions may cause fatal corruption of the SD card requiring replacement of the card.

User avatar
aTao
Posts: 1087
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: Unplug and plug the pi once a day - will it short it out

Sat Nov 22, 2014 8:57 pm

How about using the reset pins near the hdmi socket?
>)))'><'(((<

W. H. Heydt
Posts: 11094
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Unplug and plug the pi once a day - will it short it out

Sat Nov 22, 2014 9:35 pm

Not sure why you're concerned about the Pi staying up. Below is the output from uptime for my alarm clock Pi. The last shutdown was because of a R6 earthquake with an epicenter 12 miles away.

Code: Select all

[email protected] ~ $ uptime
 13:31:43 up 90 days, 10:08,  2 users,  load average: 0.21, 0.20, 0.15
(That is *far* from a record for a Pi.)

User avatar
mikronauts
Posts: 2732
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Unplug and plug the pi once a day - will it short it out

Sat Nov 22, 2014 10:21 pm

Add a cheap external microcontroller as a watchdog.

Have the Pi signal it every minute, and if it does not receive a signal for more than two minutes, have it reset the Pi.
jojo_angelov wrote:So I am wondering if unplugging the pi physically to restart it once a day will cause any problem in the long run? Could it damage /short it out somehow?
I need the pi to be running continously and I wanna cover the case if the pi shutdowns. I have a watchdog in place but I'm concerned about physically shutting down die to a problem.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

W. H. Heydt
Posts: 11094
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Unplug and plug the pi once a day - will it short it out

Sat Nov 22, 2014 10:52 pm

mikronauts wrote:Add a cheap external microcontroller as a watchdog.

Have the Pi signal it every minute, and if it does not receive a signal for more than two minutes, have it reset the Pi.
That assumes that the microcontroller is more reliable than the Pi. I suppose he might have the Pi watch the microcontroller while the microcontroller watches the Pi...

User avatar
Douglas6
Posts: 4783
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Unplug and plug the pi once a day - will it short it out

Sun Nov 23, 2014 1:31 am

W. H. Heydt wrote:
mikronauts wrote:Add a cheap external microcontroller as a watchdog.
That assumes that the microcontroller is more reliable than the Pi.
Probably a good assumption. Lines of code count is an indicator of reliability, also parts count, and the MCU could run for months on coin cells. Might even survive an earthquake. :)

User avatar
mikronauts
Posts: 2732
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Unplug and plug the pi once a day - will it short it out

Sun Nov 23, 2014 1:53 am

:)

If I was worried about the microcontroller, I'd use three in parallel, of three different architectures, using different compilers, all of which would have a super-simple program, that would just busy-wait for three minutes, then pull the reset for the Pi low.

(of course, personally, I'd write the code for these watchdogs in assembler, but most people use C these days; I'd make the output open-collector, using the direction bit to ground reset from any/all of them if the Pi had not reset them)

The Pi would pull the reset line (of the three microcontrollers) low every minute for say 10us.

I suspect the above would be pretty robust :) :) :)
Douglas6 wrote:
W. H. Heydt wrote:
mikronauts wrote:Add a cheap external microcontroller as a watchdog.
That assumes that the microcontroller is more reliable than the Pi.
Probably a good assumption. Lines of code count is an indicator of reliability, also parts count, and the MCU could run for months on coin cells. Might even survive an earthquake. :)
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

W. H. Heydt
Posts: 11094
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Unplug and plug the pi once a day - will it short it out

Sun Nov 23, 2014 3:46 am

OF course, since the OP was asking about pulling the power cord, the implication is that he has physical access without any particular difficulty, so this: http://www.adafruit.com/products/1620 would also work as is probably cheaper (and certainly less work) than any MCU.

In any case, concern over a Pi dropping is...questionable. (And, if it comes to that, the Pi came through the 'quake just fine. It was the 30+ year old UPS that failed. Appears to have taken a hit from a surge that fried a diode and maybe some other components. It's in the shop being repaired.)

User avatar
Douglas6
Posts: 4783
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Unplug and plug the pi once a day - will it short it out

Sun Nov 23, 2014 3:51 am

mikronauts wrote:I suspect the above would be pretty robust :) :) :)
With some radiation-hardening, I suspect that solution would outlast the cockroaches.

User avatar
aTao
Posts: 1087
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: Unplug and plug the pi once a day - will it short it out

Sun Nov 23, 2014 8:44 am

mikronauts wrote:
The Pi would pull the reset line (of the three microcontrollers) low every minute for say 10us.

I suspect the above would be pretty robust :) :) :)

Nope, significantly less than 10^6 better than just a RPi.
GPIO breaks and gets stuck low
RPi crashes while GPIO is low
watchdog wire breaks free and touches GND

a simple R/C circuit would be more reliable
>)))'><'(((<

jojo_angelov
Posts: 38
Joined: Mon Jan 06, 2014 1:59 am

Re: Unplug and plug the pi once a day - will it short it out

Sun Nov 23, 2014 3:03 pm

So what I've encounter is that sometimes due to card problems the pi will simply shutdown and the wifi adapter will light up solid blue. The pi is pretty much like shutdown so the only way I can restart it is by unplugging and plugging. My solution to "unplug the cord" was to use a Plug-In Mechanical Timer to basically unplug it at night at some time just to be sure that the pi will be reset if something happens. I do not have access to the physical location of the pi and that is why I am thinking of using the Timer but I simply asked the question because it is still the same as "unplugging and plugging back in". What do you guys think I can do to make this setup better? I do not have access to the location so I wanna make sure I cover my ground. The watchdog that is on the PI simply doesn't work when the pi shutdowns due to some error "say SD failure 1 time".

User avatar
B.Goode
Posts: 8987
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Unplug and plug the pi once a day - will it short it out

Sun Nov 23, 2014 3:12 pm

jojo_angelov wrote:So what I've encounter is that sometimes due to card problems the pi will simply shutdown and the wifi adapter will light up solid blue. The pi is pretty much like shutdown so the only way I can restart it is by unplugging and plugging.
Ahh....

So, is it really the case that "The pi is pretty much like shutdown ", or might it simply be that the wifi adaptor has gone into power-saving mode so that you no longer have access to the RPi?

jojo_angelov
Posts: 38
Joined: Mon Jan 06, 2014 1:59 am

Re: Unplug and plug the pi once a day - will it short it out

Sun Nov 23, 2014 3:15 pm

B.Goode wrote:
jojo_angelov wrote:So what I've encounter is that sometimes due to card problems the pi will simply shutdown and the wifi adapter will light up solid blue. The pi is pretty much like shutdown so the only way I can restart it is by unplugging and plugging.
Ahh....

So, is it really the case that "The pi is pretty much like shutdown ", or might it simply be that the wifi adaptor has gone into power-saving mode so that you no longer have access to the RPi?
The pi actually dies. I witnessed it when it happened.
It gave this error :ext4_journal_check_start: Detected aborted journal " and then it just died. Then the blue led light of the WiFi dongle just lights up solid blue.

I know this is simply a corrupted SD error, which may or may not come again, but I wanted to still account for such problems.

kfred
Posts: 5
Joined: Sat Jul 12, 2014 2:44 pm

Re: Unplug and plug the pi once a day - will it short it out

Fri Jan 02, 2015 8:09 pm

I've seen this myself. I have PI appliances in my house and cars. I had a Pi running shairport for apple airplay of music in my house that had this type of error. It was caused by SD card corruption after a power hit. The problem is that the linux filesystem journaling isn't aware of flash page size / alignment and it can get corrupted along with the data if power drops during write. I saw the same when I started using the Pi as a movie server in the car so kids could watch movies on long car trips from their various idevices, laptops, etc. It worked for an entire 3-week road trip and then died with SD corruption right before I tried to show it to a neighbor. I even have one power supply that'll corrupt the SD card every time I unplug it if not properly shut down (argh). I considered making a mini-ups based on NiMh AA rechargeable batteries and then my unix and engineering background kicked in.

Simple is elegant in my book. You don't need to power cycle your pi daily. You simply need to make the root filesystem read-only. First go through the steps from this link: http://blog.gegg.us/2014/03/a-raspbian- ... -fs-howto/. Once you've rebooted in read-only mode, see which services are broken. For me, it was lighttpd and udhcpd. I had to modify the config files for these to have them log to /tmp. I also had to touch the lease file for udhcpd after telling it to do everything in /tmp as well. Basically, if a service isn't working, try to start it and then use logread to view the in-memory syslog to see what's wrong. It should be obvious (missing files, directories). Simply mount -o remount,rw / make changes, mount -o remount,ro /, and try to start the service again. Once you have it all sorted out reboot and see if it works.

I've now had my media center Pi running almost a year since our last power hit, and the car Pi v1 (which was a Pi duct-taped to an old access point and ssd hard drive) has been a flawless appliance that the kids throw in the car when we go on trips. If you just have to have a watchdog, again simple is best. I would go with a mosfet latching circuit and use an R/C circuit that must be refreshed by GPIO. There are ways to make this bullet-proof using a 555 timer, but I suspect you'll be quite happy with the hardened Pi without the watchdog. If you still want to go this route, I can elaborate further.

Back to simple elegance, with this approach, you simply remount / in read-write mode prior to rpi-update or installing new packages. Way simpler than building a UPS, and you can do all this in a few hours.

(kfred)

Return to “General discussion”