Skip to content
View in the app

A better way to browse. Learn more.

Power Forum - Renewable Energy Discussion

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Solar Assistant - Losing Internet connectivity for remote monitoring

Featured Replies

Hi there,

Every week or so I lose Internet connectivity to my solar system (Orange Pi) System is fine but just internet access goes off.

I have a standard router upstairs with a wifi Extender closer to the kitchen pantry downstairs. Reasonable connectivity but extender was required.

The router and extender are on the same Wifi Channel 4. No neighbours on similar wifi channels.

As soon as I reset the unit (turn off/on) everything is back to normal but is irritating when I'm travelling to monitor my system.

Any suggestions Please...

Had frustrating WiFi connection with my Pi as well. The WiFi on the Pi is not one of it's strong points, unless it's really close.
Cable connection sorted that out. Never had an issue since

 

I had a similar issue when I started with SA a couple of years back. But I would get connectivity drops 3 or 4 times a day. So kind of lived with it. The easy fix is with a dedicated network cable.

A few months ago I had to upgrade my wifi router at home and the SA Pi has been solid ever since.

MdF

Edited by MdF

@BillC, what you could do, is run a shell script via cron on the Orange Pi, which sends a ping request to a know device on the internet, that should respond, like 8.8.8.8 and if it responds, no further action required, since your connection is obviously up, but if no response, for 3 times in a row, lets say, then do a reboot... run said shell script every minute, so you could be down for 3 minutes before it initiates a reboot...

Best option still a wired connection, like @TimCam suggested, but if this can't be done, the above suggestion has been used many a times over many a decade, where flaky connections are problematic...

9 hours ago, MdF said:

There is no easy fix with a dedicated network cable.

Not quite sure why you would have had a LAN cable issue, unless of course your router was wonky. If a LAN cable has issues then its either the cable or a port issue.
As stated, if the WiFi is intermittent, the Network cable will resolve it, and there are enough reports on the Net about Pi and the limited WiFi range. 

15 hours ago, zsde said:

Not quite sure why you would have had a LAN cable issue, unless of course your router was wonky. If a LAN cable has issues then its either the cable or a port issue.
As stated, if the WiFi is intermittent, the Network cable will resolve it, and there are enough reports on the Net about Pi and the limited WiFi range. 

I was in a rush typing and didn't read my message properly. Meant to say The easy fix is a dedicated network cable.

MdF 

  • Author

Hi All,

Many thanks for your advice and suggestions. Unfortunately the dedicated network cable is not a starter as my router is too far away from the Pi device.

I had a thought that I might try to replicate the WiFi dropping out by switching off both my Router and Extender - simultaneously and separately. When the Wifi then restored itself, access to SA was instant and available. Didn't have to restart the Pi device !!

So, I am not sure if that proves that the "connectivity" is not an issue..and points to the Pi Device itself..currently everything going well with the system

Kalahari Meerkat - I need to get my head around what a shell script via cron can do for me and if this reboot can be done remotely (via phone preferably)

1 hour ago, BillC said:

Kalahari Meerkat - I need to get my head around what a shell script via cron can do for me and if this reboot can be done remotely (via phone preferably)

Not sure SA allows remote or local login to the Linux system. Anyone tried?

18 hours ago, BillC said:

Kalahari Meerkat - I need to get my head around what a shell script via cron can do for me and if this reboot can be done remotely (via phone preferably)

#!/bin/bash

ping -c 3 -i 3 8.8.8.8

if [ $? -ne 0 ]; then
        if [ -f /tmp/two ]; then
                rm -f /tmp/one /tmp/two
                sync
                shutdown -rf now
                exit 1
        fi
        if [ -f /tmp/one ]; then
                rm -f /tmp/one
                touch /tmp/two
                sync
                exit 1
        fi
        touch /tmp/one
        sync
        exit 1
fi
rm -f /tmp/one /tmp/two
exit 0

The above script, for the bash shell, for instance, should do the trick. It should be saved in root's home directory with the name check-for-network-link to make sense in regards to the rest of the reply.

I assume sa lets you have shell access locally, then you'd either as root run "crontab -e" or as a normal user, run "sudo crontab -e" and insert a line at the bottom of that file, which reads...
* * * * * /bin/bash ~/check-for-network-link 2>&1 /dev/null

the *'s meaning are... every minute, every hour, every day of the month, every month and every day of the week

then the command that would be executed would be bash to run the shell script named check-for-network-link which should be located in the home directory of root, hence the ~/ and any and all output 2>&1 (errors out & normal output) sent to /dev/null and this would run once a minute.

The shell script itself would send 3 ping echo requests to 8.8.8.8, which is one of google's DNS servers, which do reply with and ping echo reply, with 3 seconds between packets. If your sa box cannot get responses it will try again a minute later and yet again a minute later, if it fails three times (three) in a row, then it will execute "shutdown -rf now" which is a reboot, fast via shutdown, all running tasks will get told to terminate and eventually the machine will reboot, which should, hopefully get its network connection working again.

Since the network connection is the problem, according to you, getting you to reboot it from the outside, is not likely, unless you can add some extra hardware you can control from the outside, that yanks the power out from under the machine in question and then powers it up again... bad idea, not a clean shutdown etc.

So, letting the machine, based on its inability to reach a known entity on the internet, decide that after 3 minutes and 3 tries each time, with a 3 second delay in between, reboot automatically, if probably the best way of doing it.

One more option, one could just re-initalise the wi-fi interface, somehow, but not having sa and in general not connecting via wi-fi myself, you'd have to get someone more in the know to help you replace the "shutdown -rf now" with something that rather than reboot, just re-initalises the wi-fi interface, which hopefully will also get the machine talking again...

20 hours ago, BillC said:

So, I am not sure if that proves that the "connectivity" is not an issue..and points to the Pi Device itself..currently everything going well with the system

Did you test reaching the local IP interface during the "internet connection" outage? You can access SA unauthenticated through the local IP of the PI

  • 3 weeks later...
On 2024/02/20 at 6:20 PM, BillC said:

...

The router and extender are on the same Wifi Channel 4. No neighbours on similar wifi channels.

...

Best practice would be to have your router and extender on different channels, not the same channel. This will let your client device think it is the same access point.

Change the channel to 1 on the router and 6 on the extender. If you have neighbours that use these channels, then try 4 on the router and 8/9 on the extender.

  • Author

Thanks for the feedback.

Solid advice..😀 will try it as even my home laptop is jumping between my router and the extender !!

 

I had a similar problem with Pi3B's and Pi Zero's.  After months of trying everything I could find on the net with regard to Pi settings ( nothing worked ), the problem turned out to be a router setting.  By default, my Asus router came with Airtime Fairness enabled.  Once disabled, the issue was no more. The Pi's haven't dropped since

Edited by hilt_ctn

  • Author

Thanks for the advice.

Can't see Airtime Fairness on my TP link router...at the moment everything is working well and hasn't dropped out so I'm holding thumbs 

On 2024/02/23 at 11:07 AM, Kalahari Meerkat said:
#!/bin/bash

ping -c 3 -i 3 8.8.8.8

if [ $? -ne 0 ]; then
        if [ -f /tmp/two ]; then
                rm -f /tmp/one /tmp/two
                sync
                shutdown -rf now
                exit 1
        fi
        if [ -f /tmp/one ]; then
                rm -f /tmp/one
                touch /tmp/two
                sync
                exit 1
        fi
        touch /tmp/one
        sync
        exit 1
fi
rm -f /tmp/one /tmp/two
exit 0

The above script, for the bash shell, for instance, should do the trick. It should be saved in root's home directory with the name check-for-network-link to make sense in regards to the rest of the reply.

I assume sa lets you have shell access locally, then you'd either as root run "crontab -e" or as a normal user, run "sudo crontab -e" and insert a line at the bottom of that file, which reads...
* * * * * /bin/bash ~/check-for-network-link 2>&1 /dev/null

the *'s meaning are... every minute, every hour, every day of the month, every month and every day of the week

then the command that would be executed would be bash to run the shell script named check-for-network-link which should be located in the home directory of root, hence the ~/ and any and all output 2>&1 (errors out & normal output) sent to /dev/null and this would run once a minute.

The shell script itself would send 3 ping echo requests to 8.8.8.8, which is one of google's DNS servers, which do reply with and ping echo reply, with 3 seconds between packets. If your sa box cannot get responses it will try again a minute later and yet again a minute later, if it fails three times (three) in a row, then it will execute "shutdown -rf now" which is a reboot, fast via shutdown, all running tasks will get told to terminate and eventually the machine will reboot, which should, hopefully get its network connection working again.

Since the network connection is the problem, according to you, getting you to reboot it from the outside, is not likely, unless you can add some extra hardware you can control from the outside, that yanks the power out from under the machine in question and then powers it up again... bad idea, not a clean shutdown etc.

So, letting the machine, based on its inability to reach a known entity on the internet, decide that after 3 minutes and 3 tries each time, with a 3 second delay in between, reboot automatically, if probably the best way of doing it.

One more option, one could just re-initalise the wi-fi interface, somehow, but not having sa and in general not connecting via wi-fi myself, you'd have to get someone more in the know to help you replace the "shutdown -rf now" with something that rather than reboot, just re-initalises the wi-fi interface, which hopefully will also get the machine talking again...

 

On 2024/02/21 at 8:03 AM, Kalahari Meerkat said:

@BillC, what you could do, is run a shell script via cron on the Orange Pi, which sends a ping request to a know device on the internet, that should respond, like 8.8.8.8 and if it responds, no further action required, since your connection is obviously up, but if no response, for 3 times in a row, lets say, then do a reboot... run said shell script every minute, so you could be down for 3 minutes before it initiates a reboot...

Best option still a wired connection, like @TimCam suggested, but if this can't be done, the above suggestion has been used many a times over many a decade, where flaky connections are problematic...

1) Isn't the SA device "locked down" so that less hacker types can't get shell access?
2) Instead of "shutdown -rf now" try restarting the WiFi.
eg.
ifconfig wlan0 down
ifconfig wlan0 up
iw reg get
iw list
iw wlan0 scan
wpa_cli -i wlan0 scan_results

I had an issue with the RPI4 WiFi to a Cell-Phone hotspot on the 5Ghz.
The RPI regulatory domain for 5Ghz bands for ZA was different from the Phone bands for ZA.
Intermittency, the RPI could not see the hotspot.

 

Edited by system32

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.