So you’ve decided to learn about microcontrollers and programming electronics. That’s great! There is a whole world of fun and exciting things to do in this realm, but for some, it can be a bit overwhelming when first getting started.
Fear not – the newest iteration of microcontrollers from the Raspberry Pi institute is here, and it’s about the size of a stick of gum. Welcome to the Raspberry Pi Pico.
Basic Pi Knowledge
Before we get started working with the Pico, there are a few things to know. This tutorial is not meant to be an exhaustive lesson on the Pico itself, but there are some different variations that will come in handy to understand as you are getting things set up.
There are two primary variations of the Pico, and there are two ways you can receive the processor. The two versions are wired and wireless, and the two ways they ship are with and without headers pre-soldered onto the board.
The traditional formats are Pico with no headers and Pico H with the headers pre-soldered. The wireless versions are the Pico W and Pico WH.
This is important when we get to selecting and installing the proper Python interpreter for Thonny, the Integrated Development Environment (IDE) used to write the Python code that will control the devices used in your Pico projects.
With that out of the way, let’s jump into Thonny, where you will make all the magic happen!
Downloading and Installation on Mac and Windows
Once you have connected your Pico to your computer, you will need to download the Thonny installer from their website at https://thonny.org/.
From there, you will see a box on the main page where you can download the package for Windows, Mac, or Linux here:
🐧 Linux: While there is a download link for Linux, we will focus on Mac and Windows, as the typical beginner is not likely to be on a Linux platform, and there’s no need to add any complexity in this tutorial.
Another thing we will assume here is that you do not currently have Python installed on your computer and that you will use the full installation package with Python included.
👉 Recommended Tutorial: How to Install Python?
🍎 MacOS: First, let’s start with Mac since the process is about as straightforward as it gets. For Mac users, it’s simply a matter of clicking the link to download and then clicking on the downloaded file to initiate the installation. That’s it. Easy-peasy.
🪟 Windows: With Windows, the process depends partly on what browser you typically use. If you’re using Firefox, Chrome, or some clone thereof, again, it’s generally a simple process. However, if you use Microsoft Internet Explorer, get a new browser (ha!). All kidding aside, if you use IE or Microsoft Edge, you may run into a SmartScreen Filter issue.
SmartScreen Filter was introduced with Windows 8 in order to make it more difficult to download and install malware onto your system, and it is known to flag Thonny as “unsafe”. If this happens, there are two ways to move forward.
First, if you see this:
Click “View Downloads”, where you should see a window that looks something like this:
Simply click on the option that says “Run anyway”, and the installation will proceed.
The other option is to open your Downloads folder and just run the program from there.
If you’re prompted with the question “Do you want to run this file?” or “Are you sure you want to run this file?”, click run, and you’re good to go. This is not an unsafe file, but sometimes, unfamiliar
.exe files trigger this response so it’s good to know about it beforehand.
Installation of Python Interpreter
Now that you have installed Thonny along with Python, you will need to make sure that you are using the correct Python interpreter for your Pico.
Once you have downloaded and installed Thonny, you should be prompted to run the program. If not, simply open it just like any other program or app, and take a look at the bottom right-hand corner.
It should say something like “Local Python 3 ● Thonny’s Python” like so:
You’ll notice that my Thonny has already been configured, but yours will not be yet. You will not have dark mode enabled, and you will not have other Python interpreters installed. First, let’s choose a Python interpreter.
Since the Pico is a simple microcontroller, we will be using Micropython, and the version you choose will depend on which kind of Pico you have. If you have a standard Pico or Pico H, select the corresponding interpreter, and if you have a wireless Pico W or Pico WH, select that interpreter and install.
NB: If you have the Pico plugged in, but it doesn’t seem to be recognized by your system, you may need to reconnect it while holding the “BOOTSEL” button next to your micro USB port. Once you release the BOOTSEL button, you should see the Pico connected.
🌍 Recommended Tutorial: Learn the Basics of MicroPython for Absolute Python Beginners
Customization of Settings
Alright, now let’s configure the settings as we like them. I happen to be a big fan of dark mode for most things, as it is easier on the eyes for me. First, you’ll need to select “Tools” in order to get to the options dialog:
Here, you will have several configuration options.
For most intents and purposes, Thonny’s default configurations will get the job done for programming your Pico. That said, you may not like the theme and font options (I wasn’t a big fan), so you can change them as you see fit.
There are a few different light and dark modes, as well as font options for both your editor and your shell (IO). You can see how I have set mine up for my own tastes.
That’s really it for getting started. You may need to restart Thonny for the changes to take effect. Now that you have installed and configured your Thonny, you are ready to start programming your Raspberry Pi Pico and dreaming up your own projects. Have fun!
👉 Recommended Tutorial: Top 5 Hardware Developer Job Roles