Using Adafruit-Blinka on the Pico with Micropython

It’s so confusing trying to find good code on the Internet. Between people not dating their webpages and not documenting what version of python they’re running, I’m out of my mind! Then compound that with Adafruit switching away from their old libraries and only supporting Blinka! OK. Let’s get Blinka up-and-running in Thonny so we can play with some hardware programming.

Install Blinka and PlatformDetect

First, download the “Source code (zip)” files from here and here

Unzip each to your desktop.

To install PlatformDetect, use Thonny’s Files pane to navigate to the location where you unzipped the files and upload the adafruit_platformdetect folder to the Pico. I like to create a directory called /lib to store this stuff. You may need to navigate into a couple of folders to get the right one. You’ll know you have the correct folder when the next directory down is “bin”.

To install Blinka, navigate to your Desktop Adafruit_Blinka-6.20.1\src\adafruit_blinka\microcontroller, select all the files, and then CTRL-click the microcontrollers that you use (to unselect them), and then delete the rest. Now, you can upload the entire contents of the SRC folder to the PICO into the /lib directory.

Install only the needed libraries!

Next, you’ll need the Libraries. Go here and download adafruit-circuitpython-bundle-py-<date>.zip This is a 7MB file which will never fit on your Pico. Unzip it, pick the libraries for the hardware that you’re using, and upload each to the PICO.

Run your program and see what deps fail.

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
ImportError: no module named 'ssd1306'

I needed to copy to the PICO and then rewrite the IMPORT line to match the python library name. Then, I tried to run the program again, and I got the message:

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "", line 17, in <module>
ImportError: no module named 'adafruit_bus_device'

So, I just scrolled up on the top window of my local files, found adafruit_bus_device, right clicked, and uploaded that to the PICO as well. Now, my program runs! Not too bad!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.