Some of its features:
- 2.9" black and white E Ink® display (296 x 128 pixels)
- Powered by RP2040 (Dual Arm Cortex M0+ running at up to 133Mhz with 264kB of SRAM)
- 2MB of QSPI flash supporting XiP
- Five front user buttons
- Reset and boot buttons (the boot button can also be used as a user button)
- USB-C connector for power and programming
- JST-PH connector for attaching a battery (input range 2.7V - 6V)
I got one to play around with and to use as a digital lanyard / badge when attending meetups.
The Badger2040 ships with a custom MicroPython build and a graphics library PicoGraphics that contains useful utilities for drawing on the screen. There are also a couple of examples loaded on the device by default.
In order to write code or update / run the existing code samples, you’ll need to connect it to your computer and open up an IDE with MicroPython support i.e. Thonny.
One thing to note is you opt to use a different IDE is to make sure to name the file as
main.py as it will be
automatically run once uploaded to the device (this is the default behavior of the RP2040), otherwise your code will not
With the following built-in functions, we can draw text and shapes on the screen.
The screen dimensions are provided as constants.
import badger2040 WIDTH = badger2040.WIDTH # 296 HEIGHT = badger2040.HEIGHT # 128
There are 16 pen colours - or “shades of grey” - to choose, from 0 (black) to 15 (white).
import badger2040 display = badger2040.Badger2040() display.set_pen( colour # int: color from 0 to 15 )
The thickness of the lines drawn on the screen can be also be configured.
import badger2040 display = badger2040.Badger2040() display.set_thickness( value # int: thickness in pixels )
The font can be changed with the
set_font method and write using the
import badger2040 display = badger2040.Badger2040() # Available fonts # # Bitmap # - bitmap6 # - bitmap8 # - bitmap14_outline # # Vector # - sans # - gothic # - cursive # - serif_italic # - serif display.set_font(font) display.text( text, # the text string to draw x, # the destination X coordinate y, # the destination Y coordinate wordwrap, # number of pixels width before trying to break text into multiple lines scale, # size angle, # rotation angle (Vector only!) spacing # letter spacing )
There are quite a few functions available here, I just included the ones I used. You can check out the full list in the Pico Graphics function reference.
import badger2040 display = badger2040.Badger2040() display.line(x1, y1, x2, y2)
import badger2040 display = badger2040.Badger2040() display.rectangle(x, y, width, height)