|
| 1 | +--- |
| 2 | +featured: micropython-101 |
| 3 | +title: 'Installing MicroPython' |
| 4 | +description: 'Learn how to install MicroPython on your Arduino board.' |
| 5 | +author: 'Pedro Lima' |
| 6 | +tags: [MicroPython, Installation] |
| 7 | +micropython_type: test |
| 8 | +--- |
| 9 | + |
| 10 | +# Installing MicroPython |
| 11 | + |
| 12 | +In this article, we will go through the necessary tools needed to install and run MicroPython on an Arduino board. By the end of this guide, we will be ready to write and run our first MicroPython script. Let's get started! |
| 13 | + |
| 14 | +## Requirements |
| 15 | + |
| 16 | +Before we start, let's check the requirements: |
| 17 | + |
| 18 | +### MicroPython Compatible Arduino Boards |
| 19 | + |
| 20 | +MicroPython is officially supported on several Arduino boards. Here’s a list of the compatible boards: |
| 21 | + |
| 22 | +- [Portenta C33](https://store.arduino.cc/products/portenta-c33) |
| 23 | +- [Arduino GIGA R1 WiFi](https://store.arduino.cc/products/arduino-giga-r1-wifi) |
| 24 | +- [Portenta H7](https://store.arduino.cc/products/portenta-h7) |
| 25 | +- [Portenta H7 Lite](https://store.arduino.cc/products/portenta-h7-lite) |
| 26 | +- [Portenta H7 Lite Connected](https://store.arduino.cc/products/portenta-h7-lite-connected) |
| 27 | +- [Arduino Nano RP2040 Connect](https://store.arduino.cc/products/arduino-nano-rp2040-connect) |
| 28 | +- [Nicla Vision](https://store.arduino.cc/products/nicla-vision) |
| 29 | +- [Arduino Nano 33 BLE](https://store.arduino.cc/products/arduino-nano-33-ble) |
| 30 | +- [Arduino Nano 33 BLE Rev2](https://store.arduino.cc/products/nano-33-ble-rev2) |
| 31 | +- [Arduino Nano 33 BLE Sense Rev2](https://store.arduino.cc/products/arduino-nano-33-ble-sense-rev2) |
| 32 | +- [Arduino Nano ESP32](https://store.arduino.cc/products/arduino-nano-esp32) |
| 33 | + |
| 34 | + |
| 35 | +### Software Requirements |
| 36 | + |
| 37 | +- [MicroPython Firmware Installer](https://labs.arduino.cc/en/labs/micropython-installer) - the firmware installer is needed to install MicroPython on our Arduino board. |
| 38 | +- [Arduino Lab for Micropython](https://labs.arduino.cc/en/labs/micropython) - Arduino Lab for MicroPython is an editor where we can create and run MicroPython scripts on our Arduino board. |
| 39 | + |
| 40 | +***Note that the editor is also available online, at [Arduino Cloud - Arduino Labs for MicroPython](https://lab-micropython.arduino.cc/)*** |
| 41 | + |
| 42 | +## Install MicroPython |
| 43 | + |
| 44 | +1. First, download the [Micropython Firmware Installer](https://labs.arduino.cc/en/labs/micropython-installer) and launch it. |
| 45 | +2. Connect your board to your computer, it should be recognized by the installer. |
| 46 | +  |
| 47 | +3. Press **INSTALL MICROPYTHON**. A loading animation will appear. |
| 48 | + |
| 49 | + Once the firmware is installed a "Installation successful" message will appear. At this point you can safely close the installer as your board is now ready for tinkering! |
| 50 | +  |
| 51 | + |
| 52 | +## Editor Setup |
| 53 | + |
| 54 | +After installing MicroPython on your board, we will need an editor to write code. We now have the option to choose the **offline** or **online** option. |
| 55 | + |
| 56 | +### Offline Setup |
| 57 | + |
| 58 | +First, download the latest version of [Arduino Lab for MicroPython](https://labs.arduino.cc/en/labs/micropython) for your operative system. See instructions for MacOS / Windows below: |
| 59 | + |
| 60 | +#### MacOS |
| 61 | + |
| 62 | +Unzip the downloaded file, and run the application. |
| 63 | + |
| 64 | +#### Windows |
| 65 | + |
| 66 | +Unzip the downloaded file, and run the executable file (`.exe`). |
| 67 | + |
| 68 | +### Online Setup |
| 69 | + |
| 70 | +Alternatively, we can use the IDE without the need of installing anything. Simply visit the link below: |
| 71 | +- [Arduino Lab for MicroPython (online)](https://lab-micropython.arduino.cc/). |
| 72 | + |
| 73 | +## Connecting Board and IDE |
| 74 | + |
| 75 | +At this point in the tutorial, we have |
| 76 | +- Installed MicroPython on our board |
| 77 | +- Downloaded and installed the editor (or opted for the online version). |
| 78 | + |
| 79 | +We will now try out running a script on the board, to make sure things are working properly. |
| 80 | + |
| 81 | +1. Plug the Arduino board into the computer using a USB cable. |
| 82 | +  |
| 83 | +2. Press the connection button on the top left corner of the window. The connected Arduino board should appear (by its port name), and we can click it: |
| 84 | +  |
| 85 | + |
| 86 | +We have now set up all necessary steps for running a script! |
| 87 | + |
| 88 | +## Running a Test Script |
| 89 | + |
| 90 | +With the installation and setup complete, let's try out running a very simple script: **Hello World!** |
| 91 | + |
| 92 | +1. In the text area field of the editor, write `print("Hello World!")`, and then click on the play symbol (RUN). |
| 93 | +  |
| 94 | +2. After running it, you should see `Hello World!` in the black box. This is the board sending the **"Hello World!"** back to you, because the script is run on the board, not on the computer. This means everything is successful, and you are ready to start writing MicroPython scripts! |
| 95 | +  |
| 96 | + |
| 97 | +## Troubleshooting |
| 98 | + |
| 99 | +If you run into any issues during installation, here are some common problems and solutions: |
| 100 | + |
| 101 | +- **Board Not Detected** - if you cannot locate your board, ensure that your board is properly connected and the correct USB drivers are installed. Try using a different USB cable, or double tap the reset button on the board. If a light starts fading, it means it is in default mode, and is ready to be installed! |
| 102 | + |
| 103 | +- **Unable to Install Firmware** - double-check that the MicroPython Firmware Installer was able to install the firmware and that your board is compatible (it will not show up on the installer if it is not). Also, verify that no other software is using the same serial port. |
| 104 | + |
| 105 | +## Summary |
| 106 | + |
| 107 | +By following these steps, you should be able to successfully install MicroPython on your Arduino board and run your first script. |
| 108 | + |
| 109 | +### Next Steps |
| 110 | + |
| 111 | +This tutorial is **Part Two** of the **"First Steps"** series. We recommend you following the next tutorial that will allow you to control the Arduino board's LED. |
| 112 | +- [First Steps - My First Script](/micropython/first-steps/first-script) |
| 113 | + |
| 114 | + |
0 commit comments