Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:17 15 Feb 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : WebMite reconnect

Author Message
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 2031
Posted: 11:09pm 13 Feb 2026
Copy link to clipboard 
Print this post

I am using a WebMite for my outdoor weather station, it sends data to the indoor unit using HC-12 modules and it is also connected to the web so that I can get the information on my phone or PC. Problem is the outdoor weather unit runs off a UPS so that I don't lose rain data in a power outage, in a power outage however my Modem drops out and I lose the connection to the outdoor unit. When power is restored the WebMite does not auto reconnect to my WiFi. Is there any way I can test to see if I have lost the connection and restart the CPU.
Edit.
I wrote the code for sending to my phone with the help of TBS member Luc's web tutorial.     Here
Edited 2026-02-14 09:12 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3006
Posted: 11:33pm 13 Feb 2026
Copy link to clipboard 
Print this post

Having the code below in the main loop works for me.
As you want your outdoor unit to keep recording it might be best if it is in a Sub that the main loop only calls every few minutes or longer.
Or perhaps via a long tick interrupt.
 If MM.Info(ip address) = "0.0.0.0" Then    'test for WiFi link
   Print "WiFi not found";
   Pause 8000
   Print "...Rebooting now"
   CPU restart  'endless re-boot until WiFi found
 EndIf


After the WiFi is back up you may need to wait for your ISP to restore the internet connection before sending over that. I wait for the Pico Date$ to be restored by a NTP server. This will need modifying to suit your application.
Sub Internet    'TZ+DS = time zone (10) and daylight saving (0 or 1)
 Do While Date$ = "01-01-2024" 'test internet connection, wait for date$ to update.
   On error skip
   WEB NTP TZ+DS, "203.12.160.2" 'Second choice is 0.au.pool.ntp.org or 1.au.pool.ntp.org
  Inc n : Print n; " tries", DateTime$(now),
  Pause 2000
  If n=15 Then Exit Sub 'give up!
 Loop
End Sub

Edited 2026-02-14 10:08 by phil99
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 2031
Posted: 12:20am 14 Feb 2026
Copy link to clipboard 
Print this post

Thanks Phil, I'm not using WEB NTP for time, a bit unreliable, I am using an RTC.
Checking MM.Info(ip address) will work. Thanks for that.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026