How to install MicroPython or CircuitPython
This guide will help you install MicroPython or CircuitPython on any compatible microcontroller (MCU for microcontroller unit) using a simple IDE (Integrated Development Environment) for the beginners in this awesome microcontroller Python world.
It's up to you to decide whether you want to work with MicroPython or CircuitPython. These two are very similar and in-fact CircuitPython is derived from MicroPython, however there are differences in supported libraries and MCUs.
So how do you decide which one to use
Pick the one which best serves the purpose. See if its supported by the MCU board you are using, which modules or sensors you wanna use and what they support. For example, for one of our projects we wanted to store and play MP3 without much fuss, so we decided to go with CircuitPython since it can natively play MP3.
Thonny is probably the easiest to use development environment for the beginners. Actually, not only for the beginners, it is one of the best even if you are experienced. Head to thonny.org to install, they have downloads for Mac, Windows and Linux.
For this guide we will be using Raspberry Pi Pico but you can use any compatible board.
Press the BOOTSEL button on your Raspberry Pi Pico and connect to the computer using a USB cable, leave the BOOTSEL button once the cable is connected.
Open Thonny and if the board is connected you should now see the options to install either MicroPython or CircuitPython.
Make your choice between MicroPython or CircuitPython. Depending on what you choose, you will be asked to choose variant (MCU type/brand) and version. Always work with the latest version unless your board or the library you are planning to use does not support the latest.
Press install once you have selected variant and the version. Install process with show you the progress which usually takes between 5-10 seconds.
Once installed, close the install window and we are now ready to code!
If its a first time install you should see a structure created for you including the start script code.py (for CircuitPython) or main.py (for MicroPython). If not, create a new file and name it code.py if you have installed CircuitPython or main.py if you have installed Micropython. We are naming the start script as such to make sure it automatically runs when you power up your device in any other way.
Now run the script using Thonny top menu and you should see the output. If the shell or the file viewer is not visible, you can make then visible from Thonny's 'view' menu.
Thats all, now you have all whats needed to program your new microcontroller.
Hope you have learned something new today. Ask us any question, small or big. We are full time makers based in Sydney, Australia.