adrian5750
Posts: 27
Joined: Mon Mar 06, 2017 10:10 pm

VNC problems when wif-fi signal lost

Fri Aug 17, 2018 7:46 am

HI

Question - if you were running a python script on an RPi headless (via VNC / wi-fi) - what would you expect to happen if the wi-fi connection was lost for a short period of time?

Background. I have a python script that logs temperature vs time in a glass-fusing kiln (which is in an outside workshop) - and draws a nice graph on the screen.
I also have a (possibly flaky) wi-fi router - supplied by the people who provide my microwave-linked internet access and voip phone.
They don;t give users access to the 'insides' of the router - so I can't access error logs / config.

When set up on the bench beside my PC (within 6 ft of the router), the software runs OK (via VNC / Wi-fi)

When installed in the workshop (20 ft and severall walls away), it runs & then stops - showing the blank GUI (i.e. no trace of the program that was running)

So - if you start a python script via a VNC-connected gui, and the wi-fi connection then drops, does the RPi kill the program?

If so - is there a way round this?

Many thanks
Adrian

mattmiller
Posts: 1954
Joined: Thu Feb 05, 2015 11:25 pm

Re: VNC problems when wif-fi signal lost

Fri Aug 17, 2018 8:40 am

So - if you start a python script via a VNC-connected gui, and the wi-fi connection then drops, does the RPi kill the program?
The Pi won't kill the program but if the program needs/expects WiFi to be running then it could cause it to error out and stop

adrian5750
Posts: 27
Joined: Mon Mar 06, 2017 10:10 pm

Re: VNC problems when wif-fi signal lost

Fri Aug 17, 2018 10:58 am

mattmiller wrote:
Fri Aug 17, 2018 8:40 am
So - if you start a python script via a VNC-connected gui, and the wi-fi connection then drops, does the RPi kill the program?
The Pi won't kill the program but if the program needs/expects WiFi to be running then it could cause it to error out and stop
OK - thanks.
Is there any kind of diagnostic I can run on the Pi to see if it is getting WI-fi dropouts?
It failed again overnight (this time on the bench - so 5 bars on the wifi (when it's connected)).
My script was running, so was htop - but, checking in via VNC just now, the Pi's back to an 'empty' gui screen - no programs running...

Thanks
Adrian

mattmiller
Posts: 1954
Joined: Thu Feb 05, 2015 11:25 pm

Re: VNC problems when wif-fi signal lost

Fri Aug 17, 2018 5:26 pm

Are you running your Python prog via some autostart method?

If so - stop it and run it manually from a terminal

You should then see the error on the screen when it fails

adrian5750
Posts: 27
Joined: Mon Mar 06, 2017 10:10 pm

Re: VNC problems when wif-fi signal lost

Fri Aug 17, 2018 6:27 pm

mattmiller wrote:
Fri Aug 17, 2018 5:26 pm
Are you running your Python prog via some autostart method?

If so - stop it and run it manually from a terminal

You should then see the error on the screen when it fails
I was running it from a shortcut on the main menu.
I left it running on the bench this afternoon when I went out for a few hours - and (strangely) it failed.
Now running it through Thonny, to see if it gives me some kind of a clue when/if it fails this time...

Thanks
Adrian

mattmiller
Posts: 1954
Joined: Thu Feb 05, 2015 11:25 pm

Re: VNC problems when wif-fi signal lost

Fri Aug 17, 2018 7:21 pm

Is it possible that your Pi is simply resetting itself when your not looking at it?

adrian5750
Posts: 27
Joined: Mon Mar 06, 2017 10:10 pm

Re: VNC problems when wif-fi signal lost

Fri Aug 17, 2018 7:24 pm

mattmiller wrote:
Fri Aug 17, 2018 7:21 pm
Is it possible that your Pi is simply resetting itself when your not looking at it?
Rebooting, you mean?
It's possible - but why would it do that..?

mattmiller
Posts: 1954
Joined: Thu Feb 05, 2015 11:25 pm

Re: VNC problems when wif-fi signal lost

Fri Aug 17, 2018 8:04 pm

Dodgy PSU would do it

Faulty Pi itself

Who knows?

But it would explain why you never see an error message

Maybe try opening up another Terminal (but don't run anything in it)

The next time your prog fails, if you can't see the other window, then I'd say the Pi is def resetting - if its still there - then just a Python prog issue

Is it worth posting you code on here - would we be able to run it without your hardware temp device?

adrian5750
Posts: 27
Joined: Mon Mar 06, 2017 10:10 pm

Re: VNC problems when wif-fi signal lost

Fri Aug 17, 2018 8:34 pm

HI Matt

Thanks for the comments...

Darn thing just reset itself! - sitting right here on the bench..... (good strong wi-fi signal)

So

- dodgy psu?
I've seen the same behaviour with two separate psu's - both rated 2.5A

- Faulty Pi?
It's a possibility. I've 2 x 3b's and one PiZero here.
I seem to recall that I swapped out the previous 3b for the current one - but I could swap it back, just to see....

Out of curiousity, I set a led flashing in the program's idle loop (it takes a temperature reading then sleeps for 60 secs before taking the next one).
Seemed to flash perfectly happily until, suddenly, the Thonny window closed itself and terminated the program.
I don't think the Pi was 'out' long enough to have rebooted, but it dropped communications with the VNC Viewer on the PC.

One or two of the previous times it 'reset' itself, I had htop running - but, when I came back to the machine the htop window wasn't active... which, as you say, suggests that the Pi had reset itself...

Just noticed that I'd soldered (badly!) a reset pushbutton to the reset pads - soldering clearly not good enough as one of the leads to the board just parted company with the pad on the board.. Wonder if it's been waving around and causing a (seemingly random) reset?
Reset wires now removed - we'll watch & wait.....

If that proves _not_ to be the problem then I'll happily post the code. It's a scruffily-hacked version of the Adafruit MAX31855 test program - so nothing particularly exotic. I think, without a 31855 attached it'd likely sit there until hell freezes over, waiting to read the device....

Anyway - I'll run this thing for a bit and see what happens...

During this 'debug' journey, I did find a line in the original code that would cause the program to terminate if the MAX31855 returned a 'NAN' (not a number) result, which could happen if noise found its way into the thermocouple circuit.
The kiln it's monitoring has a 7.5kw / 240v heating element, switched via heavy-duty contactors, so it's not the cleanets of electrical environments!

Thanks again for your suggestions - I'll report back!
Adrian

Return to “Troubleshooting”