Ive been reading up a bit on the PICO W with a possible use for it as a
set of networked domestic temperature sensors.
All seems possible with the usual input of hard work and head
scratching, but in order to do this each PICO W would need to be
uniquely identified and configured to connect to the nearest wifi access pint.
Now obviously this could be done in the source code itself, but really
I'd prefer to keep the source code constant and instead use the ability
of the flash RAM to appear as a USB storage device to drop a simple configuration file into that, and read it from the pico, but it seems
this is not as easy as it sounds.
From my limited research it appears that only the boot loader
understands the Flash file format.
Once booted you are on your own, so to speak.
There do seem to be some basic tools in Python, but I prefer to use C if possible.
Anyone played with this at all?
On 22/07/2023 09:33, The Natural Philosopher wrote:
Ive been reading up a bit on the PICO W with a possible use for it as a
set of networked domestic temperature sensors.
All seems possible with the usual input of hard work and head
scratching, but in order to do this each PICO W would need to be
uniquely identified and configured to connect to the nearest wifi access
pint.
Now obviously this could be done in the source code itself, but really
I'd prefer to keep the source code constant and instead use the ability
of the flash RAM to appear as a USB storage device to drop a simple
configuration file into that, and read it from the pico, but it seems
this is not as easy as it sounds.
From my limited research it appears that only the boot loader
understands the Flash file format.
Once booted you are on your own, so to speak.
There do seem to be some basic tools in Python, but I prefer to use C if
possible.
Anyone played with this at all?
For the actual task you might like to consider MQTT:
https://www.tomshardware.com/how-to/send-and-receive-data-raspberry-pi-pico-w-mqtt
Played with that and it does work.
I do recall reading something recently about auto-configuration, but I
don't recall where. Don't worry about Python - it's easy and there are
lots of examples out there.
Something like Thonny would enable you to add the appropriate
configuration file to the Pico - it works over USB so Wi-Fi isn't needed
at that stage. For example, look here for WIFI_CONFIG.py:
https://learn.pimoroni.com/article/getting-started-with-badger-2040
Thanks for all that. I will look into it.
I have been thinking more, and have decided that it really doesn't
matter if the pico C libraries can understand file systems or not, as it would be entirely possible to scan the*whole* flash memory for strings
like $SSID="MYWIFI" and $PASSWORD="rats.vomit" and $LOCATION="Kitchen"
etc etc
My ignorance here derives from a comment I found online that 'invoking BOOTSEL by powering the Pico on with the button pressed erases files
from the Pico's flash'.
And yet there is another piece of info describing how you need to run a program on the pico to erase it's flash!
I think I will risk the very few pence a Pico costs, plug it in, and see...
On 22/07/2023 10:47, The Natural Philosopher wrote:
Thanks for all that. I will look into it.
I have been thinking more, and have decided that it really doesn't
matter if the pico C libraries can understand file systems or not, as it
would be entirely possible to scan the*whole* flash memory for strings
like $SSID="MYWIFI" and $PASSWORD="rats.vomit" and $LOCATION="Kitchen"
etc etc
My ignorance here derives from a comment I found online that 'invoking
BOOTSEL by powering the Pico on with the button pressed erases files
from the Pico's flash'.
And yet there is another piece of info describing how you need to run a
program on the pico to erase it's flash!
I think I will risk the very few pence a Pico costs, plug it in, and
see...
Yes, but basic solution with Wi-Fi could easily be extended. Use Thonny
to write a file with the details you need, and get the Python app to
read those details. Works well for Wi-Fi.
You don't need to either read, or erase, the whole flash. Get the basic Python loaded (likely it will already be there) and use Thonny to look
at the Pico W contents. Thonny works on Windows, Linux, and the Mac.
I dont want to use python
On 22/07/2023 19:57, The Natural Philosopher wrote:
I dont want to use python
I didn't /want/ to use Python, but it's fast enough for the job, it's
already provided on the Pico, it's easy to use, there are plenty of
examples, and it's well supported.
For me, by far the easiest and quickest solution.
For you it may at least provide an source of ideas about customising a
setup without the need to read the whole flash memory.
All seems possible with the usual input of hard work and head
scratching, but in order to do this each PICO W would need to be
uniquely identified and configured to connect to the nearest wifi access pint.
Now obviously this could be done in the source code itself, but really
I'd prefer to keep the source code constant and instead use the ability
of the flash RAM to appear as a USB storage device to drop a simple configuration file into that, and read it from the pico, but it seems
this is not as easy as it sounds.
The problem - as I now understand it - is that the only easy use of the flash memory is to store the program code. At least all my research so
far shows that its a total bitch to access from the code stored in it.
With lots of gotchas.
Ive been reading up a bit on the PICO W with a possible use for it as a
set of networked domestic temperature sensors.
All seems possible with the usual input of hard work and head
scratching, but in order to do this each PICO W would need to be
uniquely identified and configured to connect to the nearest wifi access pint.
Now obviously this could be done in the source code itself, but really
I'd prefer to keep the source code constant and instead use the ability
of the flash RAM to appear as a USB storage device to drop a simple configuration file into that, and read it from the pico, but it seems
this is not as easy as it sounds.
From my limited research it appears that only the boot loader
understands the Flash file format.
Once booted you are on your own, so to speak.
There do seem to be some basic tools in Python, but I prefer to use C if possible.
Anyone played with this at all?
Dana Sat, 22 Jul 2023 09:33:47 +0100, The Natural Philosopher <tnp@invalid.invalid> napis'o:No. Nothing to do with what I want to do is it?
Ive been reading up a bit on the PICO W with a possible use for it as a
set of networked domestic temperature sensors.
All seems possible with the usual input of hard work and head
scratching, but in order to do this each PICO W would need to be
uniquely identified and configured to connect to the nearest wifi access
pint.
Now obviously this could be done in the source code itself, but really
I'd prefer to keep the source code constant and instead use the ability
of the flash RAM to appear as a USB storage device to drop a simple
configuration file into that, and read it from the pico, but it seems
this is not as easy as it sounds.
From my limited research it appears that only the boot loader
understands the Flash file format.
Once booted you are on your own, so to speak.
There do seem to be some basic tools in Python, but I prefer to use C if
possible.
Anyone played with this at all?
Have you looked at:
https://www.home-assistant.io/
https://esphome.io/index.htmlInst using rapsberry PI and isnt coded by me
https://esphome.io/components/rp2040.htmlNothing to do with a Raspberry PI either.
For you it may at least provide an source of ideas about customising a
setup without the need to read the whole flash memory.
The problem - as I now understand it - is that the only easy use of the flash memory is to store the program code. At least all my research so
far shows that its a total bitch to access from the code stored in it.
With lots of gotchas.
On 2023-07-23, The Natural Philosopher <tnp@invalid.invalid> wrote:
For you it may at least provide an source of ideas about customising a
setup without the need to read the whole flash memory.
The problem - as I now understand it - is that the only easy use of the
flash memory is to store the program code. At least all my research so
far shows that its a total bitch to access from the code stored in it.
With lots of gotchas.
How did you come to that conclusion?
I should be possible to have a flash filesystem (littlefs or similar) after the flash area used by cour code:
https://arduino-pico.readthedocs.io/en/latest/fs.html
Even when not using the arduino libraries, setting up a flash filesystem
uses the same concepts. Your code can then store configuration information
in a file in the filesystem.
Providing that configuration information is a separate topic: a menu or CLI on a serial port can easily be implemented in your code.
I tend to use a mixed approach (on ESP32, which is my go-to solution if I need WiFi): the default WiFi parameters that allow initial connection to my network are compiled into the firmware. The device then requests an IP address via DHCP and starts a web server that allows configuration of all relevant parameters (including WiFi SSID, password, static IP if needed plus parameters for the specific task, like MQTT server and credentials).
You could also use the unique ID of the board to request configuration data from a server - that way, no board-specific configuration storage is necessary.
Unfortunately the chief configuration required is the SSID & password
of the wifi, and the address of the server, all of which are needed
before you can ask the server for configuration data.
On 2023-07-25, The Natural Philosopher <tnp@invalid.invalid> wrote:
Unfortunately the chief configuration required is the SSID & password
of the wifi, and the address of the server, all of which are needed
before you can ask the server for configuration data.
Which should all be constant across all boards in your network, so no
problem to compile into the code.
If you don't want to do that, you can do the initial setup that configures these variables by hand (eg. via a serial port and terminal program on a
PC) on each board. The saved configuration on the device *should* survive a firmware upgrade (it does on ESP32, and a quick google search indicates that the RP2040 upload via BOOTSEL does *not* completely erase the flash - you need to upload a special binary do do a full erase).
cu
Michael
On 24/07/2023 02:21, Nikolaj Lazic wrote:
Dana Sat, 22 Jul 2023 09:33:47 +0100, The Natural Philosopher <tnp@invalid.invalid> napis'o:No. Nothing to do with what I want to do is it?
Ive been reading up a bit on the PICO W with a possible use for it as a
set of networked domestic temperature sensors.
All seems possible with the usual input of hard work and head
scratching, but in order to do this each PICO W would need to be
uniquely identified and configured to connect to the nearest wifi access >>> pint.
Now obviously this could be done in the source code itself, but really
I'd prefer to keep the source code constant and instead use the ability
of the flash RAM to appear as a USB storage device to drop a simple
configuration file into that, and read it from the pico, but it seems
this is not as easy as it sounds.
From my limited research it appears that only the boot loader
understands the Flash file format.
Once booted you are on your own, so to speak.
There do seem to be some basic tools in Python, but I prefer to use C if >>> possible.
Anyone played with this at all?
Have you looked at:
https://www.home-assistant.io/
https://esphome.io/index.htmlInst using rapsberry PI and isnt coded by me
https://esphome.io/components/rp2040.htmlNothing to do with a Raspberry PI either.
Dana Mon, 24 Jul 2023 14:29:55 +0100, The Natural Philosopher <tnp@invalid.invalid> napis'o:
On 24/07/2023 02:21, Nikolaj Lazic wrote:
Dana Sat, 22 Jul 2023 09:33:47 +0100, The Natural Philosopher <tnp@invalid.invalid> napis'o:No. Nothing to do with what I want to do is it?
Ive been reading up a bit on the PICO W with a possible use for it as a >>>> set of networked domestic temperature sensors.
All seems possible with the usual input of hard work and head
scratching, but in order to do this each PICO W would need to be
uniquely identified and configured to connect to the nearest wifi access >>>> pint.
Now obviously this could be done in the source code itself, but really >>>> I'd prefer to keep the source code constant and instead use the ability >>>> of the flash RAM to appear as a USB storage device to drop a simple
configuration file into that, and read it from the pico, but it seems
this is not as easy as it sounds.
From my limited research it appears that only the boot loader
understands the Flash file format.
Once booted you are on your own, so to speak.
There do seem to be some basic tools in Python, but I prefer to use C if >>>> possible.
Anyone played with this at all?
Have you looked at:
https://www.home-assistant.io/
And you've figured this out... which way?
This is the whole system. You want to do just a part of it.
So, use just a part of it.
It uses one server that holds all the configurations for your
sensors and compiles the firmware for each of the systems you
need.
https://esphome.io/index.htmlInst using rapsberry PI and isnt coded by me
This is a subsystem. And it is not coded by you.
https://esphome.io/components/rp2040.htmlNothing to do with a Raspberry PI either.
This is also a subsystem for home assistant.
Everything is done throught the same way.
Configuration -> compile -> upload -> flash -> report back to the server.
Am I missing something or are you trying to redo the same thing?
Sysop: | Weed Hopper |
---|---|
Location: | Clearwater, FL |
Users: | 14 |
Nodes: | 6 (0 / 6) |
Uptime: | 231:15:05 |
Calls: | 55 |
Calls today: | 1 |
Files: | 50,127 |
D/L today: |
29 files (3,538K bytes) |
Messages: | 275,358 |