|
| 1 | +--- |
| 2 | +title: 'Modulino Installation' |
| 3 | +description: 'Get started with using the Modulinos' |
| 4 | +author: 'Hannes Siebeneicher, Sebastian Romero' |
| 5 | +tags: [MicroPython, Package Installation] |
| 6 | +--- |
| 7 | + |
| 8 | +In this tutorial, we will go through the installation process required for programming the Arduino Modulinos with MicroPython. |
| 9 | + |
| 10 | +## Goals |
| 11 | + |
| 12 | +The goals of this tutorial are: |
| 13 | + |
| 14 | +- Learn how to install a MicroPython package on an Arduino board (the Modulino package). |
| 15 | + |
| 16 | +## Hardware & Software Needed |
| 17 | + |
| 18 | +We will need a MicroPython compatible board that works with the Modulinos: |
| 19 | +- [Arduino Nano ESP32](https://store.arduino.cc/products/nano-esp32?queryID=undefined) |
| 20 | +- [Arduino Nano RP2040 Connect](https://store.arduino.cc/en-se/products/arduino-nano-rp2040-connect) |
| 21 | + |
| 22 | +We will also need the following software: |
| 23 | +- [MicroPython Labs](https://lab-micropython.arduino.cc/) |
| 24 | +- [MicroPython Installer](https://labs.arduino.cc/en/labs/micropython-installer) |
| 25 | +- [Modulino MicroPython package](https://github.com/arduino/arduino-modulino-mpy) |
| 26 | + |
| 27 | +## Install MicroPython |
| 28 | + |
| 29 | +To follow this tutorial, we will need to install MicroPython on our Arduino board. The easiest way is to install it using the [MicroPython Installer](https://labs.arduino.cc/en/labs/micropython-installer). |
| 30 | + |
| 31 | +- Open the installer. |
| 32 | +- Connect the board to the computer. |
| 33 | +- If it does not appear press the refresh button. |
| 34 | +- Press "Install MicroPython". |
| 35 | +- Wait for the installation to finish. |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +***More details on installing MicroPython on our board are available in the [MicroPython Installation guide]().*** |
| 40 | + |
| 41 | +## Install Modulino Package |
| 42 | + |
| 43 | +To program Modulinos using MicroPython we must first install the Modulino package. It's where all the code, necessary to interact with the Modulinos is being stored. |
| 44 | + |
| 45 | +There are two ways of installing a package: |
| 46 | +- Through a terminal |
| 47 | +- |
| 48 | + |
| 49 | +### Terminal Installation |
| 50 | + |
| 51 | +The easiest way of installing it is using `mpremote`. Currently, we will need a version of Python installed on our computer. |
| 52 | + |
| 53 | +1. Open a terminal, and write the following line: |
| 54 | + ```bash |
| 55 | + pip install mpremote |
| 56 | + ``` |
| 57 | + This will install `mpremote`, which makes it possible to install packages on our board via our computer. |
| 58 | +2. With `mpremote` installed, we need to run the following command to identify our board's serial port: |
| 59 | + ```bash |
| 60 | + mpremote connect list |
| 61 | + ``` |
| 62 | + |
| 63 | + Which will give us something like this: |
| 64 | + |
| 65 | + ```bash |
| 66 | + /dev/cu.usbmodem101 ecda3b60a4dccb3f 2341:056b Arduino Nano ESP32 |
| 67 | + ``` |
| 68 | + - The port here is `/dev/cu.usbmodem101`. Copy this. |
| 69 | + |
| 70 | +3. Now, run the following the command. Make sure to replace `<PORT>` with the port of our device obtained in the previous step. |
| 71 | + ```bash |
| 72 | + mpremote connect <PORT> mip install github:arduino/arduino-modulino-mpy |
| 73 | + ``` |
| 74 | + |
| 75 | + Upon completion, we should see something like this in the terminal, to verify the success of the installation: |
| 76 | +  |
| 77 | + |
| 78 | +4. Great job. We have now installed the Modulino package on our board! |
| 79 | + |
| 80 | +**Troubleshooting:** |
| 81 | +- Make sure your board is connected to your computer. |
| 82 | +- Make sure it is **not** connected in the Arduino Lab for MicroPython, as this might disturb the connection. |
| 83 | +- If you are unable to run `mpremote` in the terminal, this means it is not installed. |
| 84 | +- If you are unable to run `python` in the terminal, make sure you have installed Python (you can download and install it [here](https://www.python.org/downloads/)) |
| 85 | +- If you have installed Python and it is still not working, try running `python3` and `pip3` instead. |
| 86 | +- If you installed Python while having the terminal open, try closing the terminal and re-opening it. |
| 87 | +- If you run `mpremote` and there's no board appearing in the list, try re-installing the firmware on your board as it might have failed during installation. |
| 88 | +
|
| 89 | +## MicroPython Labs |
| 90 | +
|
| 91 | +We can now verify that everything was installed correctly. Go to [MicroPython Labs](https://lab-micropython.arduino.cc/) and click on the connect icon in the top left corner. |
| 92 | +
|
| 93 | + |
| 94 | +
|
| 95 | +Select the board and press select "connect". We should now be connected to our Arduino board. |
| 96 | +
|
| 97 | +***If we experience any issues, try disconnecting and connecting the board again and reinstall MicroPython using the [MicroPython Installer](https://labs.arduino.cc/en/labs/micropython-installer).*** |
| 98 | +
|
| 99 | +To verify that the Modulino package has been installed correctly, click on the file icon in the top bar of the Labs editor. |
| 100 | +
|
| 101 | +We should see a folder called `lib` and a file called `boot.py`. Go ahead and press on the `lib` folder and we should see several files and a folder called `modulino`. |
| 102 | +
|
| 103 | + |
| 104 | +
|
| 105 | +If we see this, it means the package has been installed successfully. |
| 106 | +
|
| 107 | +## Next Steps |
| 108 | +
|
| 109 | +Now that we have successfully installed everything it's time to program our first Modulino. Below are links to the documentation for all Modulinos. They are also accessible in the side menu at [Arduino Docs - MicroPython](https://docs.arduino.cc/micropython/), under "Modulinos". |
| 110 | + |
| 111 | +- [Modulino Distance](/micropython/modulinos/modulino-distance) |
| 112 | +- [Modulino Pixels](/micropython/modulinos/modulino-pixels) |
| 113 | +- [Modulino Buzzer](/micropython/modulinos/modulino-buzzer) |
| 114 | +- [Modulino Buttons](/micropython/modulinos/modulino-buttons) |
| 115 | +- [Modulino Knob](/micropython/modulinos/modulino-knob) |
| 116 | +- [Modulino Movement](/micropython/modulinos/modulino-movement) |
| 117 | +- [Modulino Thermo](/micropython/modulinos/modulino-thermo) |
0 commit comments