That looks pretty rabbit hole-y in itself I’ll keep it in mind.
Thanks @Gramo I’ve been meaning to set up a local DNS I’ve been thinking of running PiHole on my Synology, this might be the nudge I needs
That looks pretty rabbit hole-y in itself I’ll keep it in mind.
Thanks @Gramo I’ve been meaning to set up a local DNS I’ve been thinking of running PiHole on my Synology, this might be the nudge I needs
Hey everybody,
If I were to setup a Pico W as an access point network (I believe this means it basically creates it’s own network for other devices to connect to), does anybody know what kind of range the network would have?
Thanks!
Hey everybody,
If I were to setup a Pico W as an access point network (I believe this means it basically creates it’s own network for other devices to connect to), does anybody know what kind of range the network would have?
Thanks!
The range of a Pico W access point network can vary depending on various factors such as the environment, obstacles, and the power output of the Pico W module. Typically, the Pico W has a range of up to 50 meters in open spaces with no obstructions. However, in indoor environments with walls and other obstacles, the range may be reduced.
It’s also important to note that the antenna used with the Pico W module can also affect the range of the network. Some antennas are designed for long-range transmission, while others are designed for short-range transmission.
Ultimately, the range of your Pico W access point network will depend on your specific setup and environment. It’s a good idea to test the network in different locations and with different devices to determine the optimal range for your needs.
I have Pico W’s working in remote IOT applications and their reliability is amazing. The inbuilt RTC clock is great but I have noticed after several months it does drift a little.
To get around this I have written the code which sets the date/time as a function (set_datetime()) which gets called on startup and every midnight although seriously once a week would be good enough. The code snippet is.
# note the main program works on a 60 second loop so seconds are ignored
r = rtc.datetime()
if r[4] == 0 and r[5] == 0: # hours and minutes == 0 means midnight
set_datetime()
print('Midnight')
I occasionally have a Pico W which crashes leaving no error to diagnose and this often occurs if it has been operating continuously for several months. It has presumably ended up in a non recoverable state where only a reboot would work.
I examined the possibility of using the WDT watchdog timer to force a restart and it looked very promising. Only problem is that my code uses a 60s loop and the maximum timeout for the rp2040 WDT is 8388 ms which is so short it is fairly useless.
Does anyone have any other solutions?
Hey Fractal
Lot’s of ways to solve this but here is the solution I would use:
time_cache = 0
def get_uptime():
f = open("/proc/uptime", "r");
t = float(f.read().split()[0])
f.close()
return t
def main():
#MY AWESOME CODE GOES HERE
def dog_owner():
# We call this no matter what
wdt.feed()
# Here we see if 6000ms has elapsed since the last time this if statement passed.
if time_cache - get_uptime() < -6000:
# If so we reset the cache
time_cache = get_uptime()
# and call main
main()
If you need a computer once call many solution you can Curry your main function
A super neat design pattern
def dog_owner(param1, param2):
wdt.feed()
if time_cache - get_uptime() < -6000:
time_cache = get_uptime()
# We don't call main, we define an instance of it with the parameters we passed in.
def main():
return param1 * param2
#notice we omit the (), we are not calling it, just return the function itself.
return main
else:
#if we are not ready to call main because 60s haven't elapsed we can return a dummy func.
#it will just do nothing when it is called.
def _():
pass:
return _
#Get a curried main function with all the arguments pre-set
a_func = dog_owner(2, 3.141)
#Call this as many times as you want, it will work every time because we passed the 60 seconds test.
for _in range(0, 10):
a_func()
#Get another curried main function with different arguments.
a_different_func = dog_owner(3, 6.282)
#call it like normal, but nothing will happen because it has not been 60 seconds since we called dog_owner().
a_different_func()
Pix
Not a solution to the crash but, logging may help determine the cause of the crash.
I am starting the pico journey and have created the following rolling appender similar to what you might see on larger format systems.
inboxidau/uRollingAppenderLog: Simple micropython rolling appender logging (github.com)