Badger2040w app provisioning over wifi

App provisioning

Using Thonny to copy your code and apps on to the badger2040W can be a bit of a pain. This functionality allows a user to provision a list of apps to the device remotely over a wifi connection. The main function here is that you can write an app and stick it in an ‘examples’ folder on a github repo or other source. The ‘apps’ app then consults a json file which maintains a list of the apps that you currently want on your badger2040W. It downloads the apps from your repo (it also removes apps not currently on the list), then restarts the launcher to update the badger’s homepage.

You’ll need to make a new file provisioning_manifest.json

{
  "files": [
    "examples/weather.py",
    "examples/icon-weather.jpg",
    "examples/space.py",
    "examples/icon-space.jpg",
    "examples/power.py",
    "examples/icon-power.jpg"
  ]
}

Don’t forget to add an icon for each app, or the system will freeze.

The first time you want to run the provisioning app, you’ll need to manually install it with thonny.
You’ll also need the WIFI_CONFIG.py to be configured.

Finally, you’ll need to set the target for the repo.

Change the line github_repo_url = "https://raw.githubusercontent.com/chrissyhroberts/badger2040w_code/main/"
to match your own target. Put the provisioning_manifest.json file in the root of the repo.

After the first install you won’t need Thonny anymore.


Full details and code here

3 Likes