Raspberry Pi Pico W (Wireless WiFi) (CE08703)

The Pi Zero W is a linux operating system and very powerful with the capacity for huge storage via a Micro SD card. Multiple programs can be run at the same time.

The Pico is very different, it has small memory size and is designed to run just one program at a time.
I have ordered a Pico W but I don’t see it as having anything like the ability of the Pi Zero W. Micro Python or Circuit Python would need functions that allow access via the WiFi. I think they are working on that now. But don’t hold your breath for anything soon.

Regards
Jim

1 Like

Hi Fractal,

It looks like there is an experimental branch of the webrepl hitting github - it may not be as well supported or stable yet but there definitely exists options.

Like Jim said, they are completely different beasts for different tasks.
Other Micros have this functionality in the form of OTA updates: Over The Air

In fairness to the Pico setting it up was easy, in fact far easier than the Pi. As for the Zero, intention is to use the Pico in distributed networks where running a single python script in a small memory is not an issue. Have only played with it for a couple of days but Micropython seems to do all the things I need.

My gripe is that development and support with the Pico tied to a PC is a fail. As a minimum it should at least have Thonny working over WiFi. It seems to be a great piece of hardware with immature software support. But I am the only person complaining so perhaps there are hidden solutions out there.

2 Likes

How much power does the Pico W draw, particularly when connected to WiFi :question:

I intend to power it off my car’s USB port and use it as a “beacon” to tell an MQTT server on my network whether my car is home (i.e. connected to my home WiFi).

My car continues to supply USB power even when the ignition and everything else is switched off, so it’s perfect for this. But the last thing I want is a flat battery! :worried:

At the moment I’ve been using a battery powered BLE beacon with Bleak on a Raspberry Pi inside, but the results are a bit hit and miss.

For the Pico the data sheet gives detailed tables and graphs showing power consumption in full load, BOOTSEL, DORMANT and SLEEP modes. At max load 90mA is frightening but the typical load of around 10mA is good. Sleep mode has the load dropping down to around 1.4mA.

Alas for the Pico W the data sheet provides no information on power consumption, instead providing info on powering. I was wondering if the Pico is suitable for solar power. I do not have any way of measuring the current in the USB connector.

I recall the Zero pulls around 100mA making it fairly useless for battery or solar operation.

My car turns off USB power when the ignition switch is turned off so I would use a small auxiliary battery for the application you describe. Agree you have the potential for a flat battery!

2 Likes

I started a thread discussing SLEEP and DORMANT states for the Pico.

Micro Python and Circuit Python came no where near the claimed current levels using the inbuilt routines. Using C++ code I was able to get the rated levels.

To get it to work in Micro Python I used direct register manipulation.
With just the Pico in Dormant mode I was able to achieve 0.3mA.
The register manipulation had to occur within the same def() statement.

btw the Pico uses about 20mA when running.

Regards
Jim

PS to measure the current I used one of the USB breakout boards.

2 Likes

Hey Skua,

We just got them online: https://core-electronics.com.au/raspberry-pi-pico-w-with-soldered-male-headers.html?updated

Feel free to reply to this topic if you have any questions!
Pico W, Buy with Header pins attached and Soldered?

Liam

Hi Fractal

I have a Ruideng model AT34 in line device. Measures all sorts of things. Current down to 1mA resolution up to 4A volts 3.7 to 30V and much more. A really useful device.
There are several brands out there but some are for charging monitoring and stop working below I think about 100mA. The Ruideng continues to work down to 1mA.
Cheers Bob

2 Likes

These are excellent devices and worth looking into if you’re using RPi0’s as environment or IoT sensor gadgets and want something low power, durable and with a good form factor.

The only minor issue I have is the inability to set the hostname value of the device during the WiFi connectivity process. It will use the hard coded " PYBD" value found in the driver. OK if you have a single device deployed; NOK if you have a swarm of them deployed and want to ID by or resolve using DNS. :wink: Oh well, IPs it is then.

Relevant GitHub issue for AP mode (AP_IF) but is present in STA mode as well (STA_IF): Can't set hostname in AP mode · Issue #8906 · micropython/micropython · GitHub

5 Likes

Interesting! Until MicroPython supports it natively, a static IP would likely be easier around the house/workplace.

Many routers these days allow a device alias to be defined (functions similar to a hostname, though is managed on the router). Failing that (and what I use) Pi Hole & custom DNS entries.

I’ve found Pi Hole custom dns to be so handy for setting up A-records for printers/IoT devices/anything. Configuring a static IP is worthwhile for those types of devices, so adding an upstream custom DNS record has zero ongoing maintenance.

The only time I go to the effort of configuring local hostnames nowadays are for services where multiple domains are in use; Flask/Apache/etc

5 Likes

Thanks for the tip! I’ve got 4 wired up ready to program for a little IOT project (temperature monitoring) so I might have found that a bit frustrating.

Thinking about deploying a few devices… mine will be logging data to a webservice. Is there an easy way to identify the device between boots? Mac address? Or is it better to configure each device with a unique name/id?

2 Likes

I think the easiest path would be to use the MAC and have the device register itself via your web service, mapping the MAC to a user friendly name. Each device uses the same code and no additional specific settings for each device. You’d just end up with n number of devices on your net with the same name.

@Gramo 's very excellent suggestion to use the PiHole’s “Static DHCP leases configuration” option to create MAC → IP → host name entries to create a host A-rec is probably the easiest to implement and would achieve the DNS resolution function.

Before you rabbit hole this though you should checkout the ESPHome project.

Here is a discussion about the PiPico feature:

Not quite there yet but people are working on it at least. :wink:

3 Likes

Sorry to drive this topic away from the OP - but for those reading in the future, for simplicity’s sake, you can use your home/workplace router for DHCP and static IP leases. Layer 3 stuff like this is sometimes best kept on independent hardware. Life is generally easier that way.

Then use Pi Hole -just- for DNS, which includes Local DNS Records (and ad blocking, of course!)

It’s a good idea to own the top-level domain, or, use a TLD extension that doesn’t exist on the internet such as mydomain.belongstome (instead of mydomain.com). Fyi, if Pi Hole was offline then devices would use their secondary DNS to lookup IPs which could be a security vector.

I hope that info helps.

4 Likes

That looks pretty rabbit hole-y in itself :joy: 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

3 Likes

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!

1 Like

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.

3 Likes

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')
2 Likes

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?

4 Likes

Hey Fractal :slight_smile:

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 :partying_face:

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 :heavy_heart_exclamation:

4 Likes

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)

3 Likes