Badger 2040 W

Published on September 19, 2023
Learning GoalGet to know the Badger 2040 W digital badge and set it up to show your information.

In this lab, you will:

  • Explore the Badger 2040 W and learn how to use it.
  • Setup Thonny: the IDE you'll use to communicate and code your digital badge.
  • Learn to update the badge content to display your information.

What is a Badger 2040 W?

The Badger 2040 W is a programmable badge with an E Ink® display and wireless connectivity, powered by Raspberry Pi Pico W, made by Pimoroni. Below you see the badge set up to be used by Okta's Developer Advocate Jess Temporal following this same guide.

A Badger2040W set up to be used by Okta's Developer Advocate Jess Temporal

If you want to know more about the badge, check out Pimoroni's video on it.

What is Thonny?

Thonny is a Python IDE meant for learning programming. Its coolest feature is being capable of communicating with micropython-enabled devices, such as the badge.

This is the IDE Thonny

You'll use Thonny to update the badge contents and program it.

Not experienced in Python? No worries, in this lab you'll use code we already prepared for you, so you can learn Python as you go if you wish to do so.

Lab Setup

Required hardware and software

To complete this lab, you need a computer running macOS, Windows, or Linux.

You'll also need a Badger 2040 W full kit.

If your computer only has USB-C ports, you'll also need a USB-A to USB-C adapter.

Clone the repository

We prepared the code you are going to use ahead of time for you. Go ahead and click the button below to go to the repository:

You'll use the files in the project to update your badge later.

Install Thonny

To install Thonny you need to download the indicated version for your OS.

To do this go to the Thonny website, hover over the correct operating system, and click to download the version corresponding to your OS.

Thonny website

After installing it, you can open Thonny. Once opened click on View and make sure to select "Files" in the menu options, this will allow you to see your local files and your badge files.

Make sure to enable the Files under the View menu. You'll need this later.

Open the Badger 2040 W box

Now is a good time to open the box if you haven't already.

Inside you should see the following:

  • A badge
  • A cable
  • A lanyard
  • A battery pack
  • A velcro sticker
🎉 Congratulations! You just finished setting up, now move on to the next step to explore your badge. 😉

Explore Your Badge

Start on the back of your badge, there you'll see the reset button (arrow) and the connector for the batteries (circled).

Back of the badge showing the reset button (arrow) and the connector for the batteries (circled)

Keep the reset button in mind since you are going to use it soon.

Plugging in the batteries

To turn on your badge you need to provide power to it. One way to do so is by plugging in the batteries into the battery connector. The connector snugly fits the battery cable.

Badge lights up when the batteries are correctly plugged in and turned on

Once plugged in, make sure to turn the switch on the batteries to "ON", and press the reset button on the top right corner the see the badge light up.

Explore the main menu and run the badge application

Turn the front of the badge and you should be able to navigate through the badge's built-in applications.

Badger 2040 W main menu

You can use the navigation arrows to see all the applications available. All applications are Python scripts and clicking the buttons under each application will load it and update the display

To go back to the main menu press the buttons A and C at the same time and then release the buttons, the main menu should load up.

After you've taken a look around and seen the available applications, navigate until you find the application named "Badge" and click the button below it. The default badge should appear on the display. The information and format of the badge displayed by this application are what we are going to change in the next steps of this lab.

If you unplug the batteries the badge will continue to display the last information on the display. You can go ahead and unplug or turn off the batteries now.

Connecting the badge to the computer

Another way to power your badge is by connecting it to your computer. The USB cord that came with the kit, once connected to your computer will provide enough energy to power the badge.

Badger2040W microusb connector circled

Connect the USB-A side of the cable to your computer (here you might need the adapter for USB-C) and the MicroUSB to badge on the connector you can see circled in the image above.

Once plugged into your computer, the badge should continue to work as when it had the batteries plugged in.

🎉 Congratulations! You now know how to use the Badger 2040 W. Move on to the next step to explore the Thonny IDE. 😉

Explore Thonny

Understanding the interface

Thonny can be divided into 4 panes:

  1. Files: At the top you have your local computer files and at the bottom the files on your badge;
  2. Editor: Where you'll see the file's content and will be able to edit it;
  3. Shell: A Python shell where you can run your code, usually used for debugging;
  4. Interpreter selector: Where you can choose which Python flavor to run your code against.
Thonny IDE with all the panes identified by numbers
If you can't see the files pane make sure to enable it in the View menu by clicking on Files.

You'll also notice that above all panes you can see a collection of buttons you can use to run scripts, save changes, and more.

If you can't see the badge files on the corresponding pane that's ok, you'll take the steps to ensure you can see them in the next step.

Navigating to the correct folder

Now that you are familiar with the interface is a good time for you to navigate to where you have the cloned/downloaded repository.

The first time you access a new folder from within Thonny it may ask your permission to access that folder, so make sure to allow it to do so.

On the top section within the Files pane, you can double-click on the directory containing the repository until you get to the badger2040wifi/ folder. You should see something similar to the image below:

files pane on Thonny showing the contents of the badeger2040wifi folder
🎉 Congratulations! You just configured and learned how Thonny works. Now move on to the next step to personalize your badge with your information. 😉

Personalizing Your Badge

For simplicity's sake, you are going to replace the current contents of the badge. This will allow you to personalize your badge.

Choose your character

We made special characters you can use as the "profile" photo on the badge. Now you should pick your favorite, here are your options:

All characters options

Copy the path corresponding to your preferred character from the box below:


Now input the path information below. This field will update a part of this lab corresponding to your badge information in the next section automatically.

Updating the badge information

Fill in the two fields below with your information. This information will be displayed on your badge once you are finished updating your files according to the steps in this lab.

Start by adding your name. The badge will automatically adjust font size so you can display your full name.

Add your handle from social network. Remember to add the @ in the beginning.

Update the upload_these/badges/badge.txt by replacing its current contents with the text from the following text box, you'll notice that the text was personalized with the values you input in the fields above. 😉

Auth0 by Okta

Once you edited the file upload_these/badges/badge.txt to your satisfaction, save it.

Make sure that your badge.txt file has exactly 7 lines or you might have problems displaying the updated badge.

Replacing the contents of the badge

Let's make sure that you can see the files on the badge inside Thonny. To do that, ensure the badge is plugged in to your computer, that MicroPython (Raspberry Pi Pico) is selected on the interpreter (the pane on the bottom), and click the "STOP" button on the top part of Thonny. Use the image below as a reference.

Files from the badge being displayed

You are going to select all the files inside the upload_these/ folder. To make this step easier, double-click on the upload_these/ folder to open it.

Now click on the badges/ folder, press and hold the shift key on your keyboard, and click on the file. Release the shift key.

All files from the upload_these folder selected

Right-click on the selected files and on the menu that shows up, click on the option Upload to / like shown below:

Menu after left-clicking on selected files showing the Upload to / option

By clicking the Upload to /, you will replace the current files on the badge. This will allow you to see your information on the display. Make sure to confirm the replacement.

Reset your badge

This final step!

Click the reset button this will update the badge and should show your information on the display.

🎉 Congratulations! You have a fully personalized badge! Why not show it off? Post your brand-new badge on your preferred social network, use the #DevDay23 hashtag, and make sure to tag us. 😉


In this lab, you learned the following:

  • How to set up your badge to show your personalized information.
  • How to operate the Badger 2040 W.
  • How to use Thonny to update the badge files.
  • Bringing your own Identity to the real world can be fun.


Device busy

If you get a "Device is busy..." note it means that you are running a script.

Device busy notice from Thonny

Click "OK" and then click the "STOP" button on Thonny and then you should be able to perform the action you were trying to do before.


If you try to run the badge.txt file, you'll get a SyntaxError: Invalid syntax on your shell. In this particular case, that error means that you tried to run a non-script file. Make sure to always run .py files to avoid this problem.

Using your own photo on the badge

In case you want to display your own photo on the badge you'll need an image with the following dimensions:

  • width: 104px
  • height: 128px

Here's a Canva template you can use, it already has the correct dimensions.

Just remember to:

  1. Make a copy of the template to your Canva account;
  2. Add an image of your own (pro-tip: maybe you want to have a QR Code).

Share Your Badge

Why not show off your badge? Post your brand-new badge on your preferred social network, use the #DevDay23 hashtag, and make sure to tag us. 😉

Build Something New For Your Badge

Your badge is a wifi-enabled device, so why not build something with the knowledge you acquired today? Here's a tiny list of ideas to get you started.

  • Make a protected API request;
  • Grab your profile photo from an application (pro-tip: build a protected API that will send back the photo to be displayed);
  • Grab your information to display from a WebApp.

We'd love to see you stretch your coding muscles, make sure to post and tag us when you share what you build.