Badger 2040 and Badger 2040 W Documentation
repository·main·Indexed 42 days ago
https://github.com/pimoroni/badger2040Firmware, examples, and hardware specifications for the Badger 2040 and Badger 2040 W, RP2040 and Pico W powered E Ink badge wearables. Includes guides on installing MicroPython firmware, using the Badger OS launcher, managing the 296x128 monochrome display via PicoGraphics and jpegdec, and implementing low-power sleep and wake cycles using the PCF85063A RTC on the W model.
What's inside Badger 2040
- The Badger 2040 series consists of small, low-power, badge-style boards featuring a 2.9" monochrome e-paper display with a resolution of 296x128 pixels. These boards are optimized for use with MicroPython, and Pimoroni provides custom firmware with built-in drivers to facilitate development.
Overview of Badger 2040 MicroPython Examples
mainThe Badger 2040 MicroPython examples serve as a functional 'OS' for the Badger 2040 and Badger 2040 W. They provide a foundation for various applications including clocks, ebook readers, weather displays, and QR code generation. These examples are intended to be used as templates for custom development.Differences between Badger 2040 W and Badger 2040
mainThe Badger 2040 W is a networking-capable version based on the Raspberry Pi Pico W. Key differences include:
- Networking Modules: Includes
network,mip,ntptime,urequests,urllib.urequest, andumqtt.simple. - Memory/Storage: Available filesystem size is reduced to 848K (vs 1,408K on standard) and available RAM is reduced to 166K (vs 192K on standard) due to WiFi drivers and libraries.
- Buttons: Does not have a "user" button (the
BUTTON_USERconstant isNone) because the BOOTSEL button is on the attached Pico W. - RTC: Includes a PCF85063A real-time clock that can wake the device from a power-off state.
- Networking Modules: Includes
Hardware specifications for Badger 2040 W
mainThe Badger 2040 W is a wireless version of the board. Key differences include:
- Wireless Connectivity: Uses a Pico W instead of a standard RP2040.
- Real-Time Clock (RTC): Includes a PCF85063A RTC, which allows the device to be woken up from a power-off state.
Hardware specifications for Badger 2040
mainThe standard Badger 2040 is powered by an onboard RP2040 chip and includes 2MB of flash memory.Getting Started with Badger 2040
mainTo begin programming your Badger 2040 or Badger 2040 W using MicroPython, you must import the
badger2040module and create an instance of theBadger2040class. This instance, typically namedbadger, provides access to the display, buttons, and other hardware features.Note for Badger 2040 W users: You should first populate a
WIFI_CONFIG.pyfile with your WiFi credentials to utilize networking features.import badger2040 badger = badger2040.Badger2040()Migrate drawing functions to PicoGraphics compatibility
mainIf you are porting code from an older Badger 2040 release to the current version, you must update several drawing function names to match the PicoGraphics API:
- Rename
pen()toset_pen() - Rename
font()toset_font() - Rename
update_speed()toset_update_speed() - Rename
thickness()toset_thickness()(Note: this now only applies to Hershey fonts)
Deprecated/Removed Features:
image()andicon()are deprecated; use JPEGs instead.invert()is no longer supported.
Hardware Note: If porting to the Badger 2040 W, be aware that the
USERbutton is not available. You must adjust your control scheme to compensate.- Rename
Install firmware on Badger 2040
mainTo install MicroPython firmware on a standard Badger 2040:
- Connect the device to your computer using a USB A to C cable.
- Enter bootloader mode: Hold the BOOT/USR button and press the RST button next to it.
- A drive named
RPI-RP2will appear on your computer. - Drag and drop the appropriate
badger2040.uf2file onto theRPI-RP2drive. - The device will reset. If you installed a
with-badger-osvariant, the Badger OS Launcher will appear.
Download Badger 2040 firmware
mainFirmware files can be downloaded from the latest GitHub releases.
There are two types of
.uf2builds available:Standard builds: These include only the MicroPython firmware and preserve your existing files on the device.
pimoroni-badger2040-vX.X.X-micropython.uf2pimoroni-badger2040w-vX.X.X-micropython.uf2
with-badger-osbuilds: These contain a full filesystem image. Warning: Using these will overwrite both the firmware and all existing files on your Badger device.pimoroni-badger2040-vX.X.X-micropython-with-badger-os.uf2pimoroni-badger2040w-vX.X.X-micropython-with-badger-os.uf2
Navigate the List example
mainThe
list.pyexample functions as a checklist for to-dos or shopping. Use the following controls:- A/C and Up/Down: Navigate through the list.
- B: Check or uncheck an item.
Display images with the Image example
mainThe
image.pyexample displays JPEG images stored in the/imagesdirectory on the device.Controls:
- Press button B to toggle the visibility of the image filename.
Install firmware on Badger 2040 W
mainTo install MicroPython firmware on a Badger 2040 W:
- Connect the device to your computer using a USB A to microB cable.
- Enter bootloader mode: Hold the BOOTSEL button (onboard the Pico W) and press the RESET button (located next to the qw/st connector).
- A drive named
RPI-RP2will appear on your computer. - Drag and drop the appropriate
badger2040w.uf2file onto theRPI-RP2drive. - The device will reset. If you installed a
with-badger-osvariant, the Badger OS Launcher will appear.