Feeder Outage: How to setup device to reboot daily?

hey guys,

I’m running PiAware (SD Card) 2.1-5 on all the hardware listed on the flightaware.com/adsb/piaware/build . I’m also using all the instructions on the WiFi section to build a network_monitor.sh that is supposed to reconnect me upon disconnection.

I’ve been having some issues with my device with its continued disconnection. I noticed that there will be times where it just stops working and if I unplug/plug it back in, it will reconnect just fine and work for days on end. Randomly it will just disconnect again.

I have a remote location feeder and plan on adding additional ones around the world, but they will be of no use if i have no way to make sure they can sustain a good connection. I’ve tried adding the script that will reconnect to the network if it discovers that it’s offline, but that appears to not have worked for me.

What I’m looking to do is see if I can program a script that will tell the Raspberry to reboot every 24 hours. That will make sure that even if it stops working, it will reboot.

I am not very programming inclined, but I do know how to write to files and follow instructions similar to the WiFi network_monitor.sh program. Can anyone give me a good way or script to run that will reboot the device every 24 hours and also make the program run itself every time on bootup?

Thank you in advance for any help!!!

If i can’t get it fixed with software, maybe I should consider using a 24-hour digital timer outlet like this: amazon.com/Woods-50007-24-Ho … X2YTVXVXTY

The next thing would be, how much damage would it do to the Raspberry if I hard rebooted it by cutting power once every 24 hours.

Complete damage. You will be formatting the SD card every month or sooner.

Fix the root problem instead of patching it.
Can you locally login when it goes offline? In other words, is a network problem, or something more? If you can login, can you confirm it’s a network issue? Try pinging your router.
Most issues are caused by bad power supplies. People assume that the rating of the power supply written on it is correct. More often then not, it’s simply a complete lie. Often, a power supply rated for 5VDC@2amps drops half a volt or more at 50% loading. This will cause the machine to lockup. Or it can cause the dongle or a WiFi adapter to drop out.

With a correct setup, these should operate long term without manual intervention. (It’s NOT a POS Windows machine). So, it’s best to find the root cause.

Thanks for the response!

I don’t have a terminal set up (monitor/keyboard/mouse) where the device is so I don’t have a way to log into it physically. Does the default PiAware image contain a SSH service so that I can try through the local network?

I did read about power supplies being #1 reason why devices stop working after awhile. I am using the power supply that was suggested by the tutorial. Kootek 5V 2A Universal Micro USB Charger Adapter Power Supply. What power supply should I use instead?

I am thinking a possible fix will be to get a good powered USB Hub and also set up a cron job where it will correctly reboot the Raspberry every 24 hours. Would correctly rebooting it that often damage the pie?

A periodic reboot will be OK but is also unlikely to fix the problem. The piaware image doesn’t need to be rebooted like this and if the real problem is an intermittent power problem then that will continue to happen.

Yes.

For remote installs, what you probably want is remotely-controllable power, via a different mechanism (i.e. not controlled by the Pi). So if the Pi does wedge, you can power cycle it. Every time you do that, there’s a risk that it’s not going to come back, so you only want to do it when you absolutely have to.

A variation on this is to have an external watchdog that cycles the power if the Pi doesn’t check in periodically. (The Pi has an internal watchdog that can do something similar, but I don’t know how reliable that is in the face of power issues)

For remote or difficult-to-access local installations, you may want to move up the power supply “food chain.”

I’m using this item: http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?search_type=jameco&catalogId=10001&freeText=323362&langId=-1&productId=323362&storeId=10001&ddkey=http:StoreCatalogDrillDownView.

I chose a dual voltage unit, 5VDC/4A for the Pi and 12VDC/1A for the HabAmp filter but there are single voltage units available as well. I cut the female end off an old power cord for the AC side. DC wire with USB connector for the Pi came from a failed wall wart (thus the need for a new supply). Add some crimp-on spade lugs to make it pretty.

Thank you for all the replies and suggestions.

What I intend to implement:

  1. Upgrade power supply to a dedicated powered USB Hub. I am going to try Sabrent 4-Port USB 3.0 Hub with Individual Power Switches and LEDs included 5V/2.5A power adapter

  2. Made sure the code is correct for network_monitor.sh as suggested in Optional Steps for Advanced Setup

  3. Added crontab for a reboot every night at 12AM. I don’t think this is necessary, but I wanted to be safe.

  4. Install a WiFi Smart Plug that will let me remotely control the power so if all else fails, I can power cycle the device. Never used this before so I don’t know how reliable it is to connect to it from overseas.

I’ll report back in awhile to see how stable the set up is.

Thanks =)

I think a good powered USB hub is a great start. I had this issue, and it wasn’t that the device was completely locking up, but instead, the RTL dongle was disconnecting and dump1090 would become a zombie and take forever to reconnect. The powered hub fixed that issue - as it was a power issue to dump1090.

Are you able to SSH in when it disconnects? If so, you might try restarting dump1090 from the command line.

As for your wifi switch - for a different application I used a Belkin WeMo switch for the same kind of scenario. Same price as your wifi switch:

amazon.com/WeMo-Enabled-Elec … emo+Switch

The reason you might like that more is you could create a convoluted solution to make it automatically reboot. Basically, set up an online monitoring service to ping your Pi, and send you an email if it goes down. Then, set up a gmail filter to put those emails into a folder. Then, set up an IFTTT workflow to power cycle the WeMo switch every time a new email is added to that folder :smiley:

I don’t know if the TP-link interfaces with IFTTT - but the WeMo switch does and this can be an easy way to set up a watchdog without any real programming required.

Convoluted, but if there’s an unfixable issue causing instability, that will automatically resolve it each time. But yes - those are hard reboots. the SD will eventually likely be corrupted.

Start with the powered hub and see if that helps.