Skip to content

[PXCT-198] Modulino Review #2268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,87 +1,117 @@
---

title: 'Modulino Installation'
description: 'Get started with using the Modulinos'
author: 'Hannes Siebeneicher, Sebastian Romero'
hero_image: "./hero-banner.png"

tags: [MicroPython, Package Installation]
---

This article will guide you through the installation process for programming the Arduino Modulinos with Micropython.
In this tutorial, we will go through the installation process required for programming the Arduino Modulinos with MicroPython.

## Goals

The goals of this tutorial are:

- learn how to install MicroPython on your Arduino board.
- learn how to install MicroPython packages.
- learn how to run a simpe sketch using MicroPython labs.
- Learn how to install a MicroPython package on an Arduino board (the Modulino package).

## Hardware & Software Needed

- [MicroPython Labs](https://lab-micropython.arduino.cc/)
We will need a MicroPython compatible board that works with the Modulinos:
- [Arduino Nano ESP32](https://store.arduino.cc/products/nano-esp32?queryID=undefined)
- [Arduino Nano RP2040 Connect](https://store.arduino.cc/en-se/products/arduino-nano-rp2040-connect)

We will also need the following software:
- [MicroPython Labs](https://lab-micropython.arduino.cc/)
- [MicroPython Installer](https://labs.arduino.cc/en/labs/micropython-installer)
- [Modulino MicroPython Package](https://github.com/arduino/arduino-modulino-mpy)
- [Modulino MicroPython package](https://github.com/arduino/arduino-modulino-mpy)

## Install MicroPython

If you haven't done so already, you need to install MicroPython on your Arduino board. The easiest way is to install it using the [MicroPython Installer](https://labs.arduino.cc/en/labs/micropython-installer).
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).

- Open the installer
- Connect your board.
- Open the installer.
- Connect the board to the computer.
- If it does not appear press the refresh button.
- Press "Install MicroPython".
- Wait for the installation to finish.

![MicroPython Installer](./assets/microPythonInstaller.png)

## Install Modulino Package

To program Modulinos using MicroPython you must first install the Modulino Package. It's where all the code, necessary to interact with the Modulinos is being stored.

The easiest way of installing it is using `mpremote`.

***If this is your first time using `mpremote`, check out the [Getting Started article]().***
***More details on installing MicroPython on our board are available in the [MicroPython Installation guide]().***

Once you have everything set up, run:

```bash
mpremote connect <PORT> mip install github:arduino/arduino-modulino-mpy
```

![MicroPython Package Installation](./assets/MicroPythonPackageInstallationDone.png)
## Install Modulino Package

This will install all necessary packages on your Arduino board.
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.

There are two ways of installing a package:
- Through a terminal
-

### Terminal Installation

The easiest way of installing it is using `mpremote`. Currently, we will need a version of Python installed on our computer.

1. Open a terminal, and write the following line:
```bash
pip install mpremote
```
This will install `mpremote`, which makes it possible to install packages on our board via our computer.
2. With `mpremote` installed, we need to run the following command to identify our board's serial port:
```bash
mpremote connect list
```

Which will give us something like this:

```bash
/dev/cu.usbmodem101 ecda3b60a4dccb3f 2341:056b Arduino Nano ESP32
```
- The port here is `/dev/cu.usbmodem101`. Copy this.

3. Now, run the following the command. Make sure to replace `<PORT>` with the port of our device obtained in the previous step.
```bash
mpremote connect <PORT> mip install github:arduino/arduino-modulino-mpy
```

Upon completion, we should see something like this in the terminal, to verify the success of the installation:
![Successful installation.](assets/package-installed.png)

4. Great job. We have now installed the Modulino package on our board!

**Troubleshooting:**
- Make sure your board is connected to your computer.
- Make sure it is **not** connected in the Arduino Lab for MicroPython, as this might disturb the connection.
- If you are unable to run `mpremote` in the terminal, this means it is not installed.
- 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/))
- If you have installed Python and it is still not working, try running `python3` and `pip3` instead.
- If you installed Python while having the terminal open, try closing the terminal and re-opening it.
- 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.

## MicroPython Labs

Let's verify that everything was installed and is working correctly. Go to [MicroPython Labs](https://lab-micropython.arduino.cc/) and click on the connect icon in the top left corner.
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.

![MicroPython Labs](./assets/microPythonLabs.png)

Select the board and press select "connect". You should, now be connected to your Arduino board.
Select the board and press select "connect". We should now be connected to our Arduino board.

***If you 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).***
***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).***

To verify that the Modulino package has been installed correctly, click on the file icon in the top bar of the Labs editor.

You should see a folder called `lib` and a file called `boot.py`. Go ahead and press on the `lib` folder and you should see several files and a folder called `modulino`.
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`.

![MicroPython Lab Files](./assets/microPythonLabsFiles.png)

If you see this, it means the package has been installed successfully. If you want to to go even deeper, you can open the modulino folder and have a look at the individual Modulino packages. Don't worry, you don't have to understand what those files mean exactly to continue.

## First Sketch

Copy the following line to the MicroPython Labs Editor and press "Run".

```python
print("Hello, World!")
```

You should see "Hello, World", being printed in the commandline.
If we see this, it means the package has been installed successfully.

## Next Steps

Now that you have successfully installed everything it's time to program your first Modulino.
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".

- [Modulino Distance](/micropython/modulinos/modulino-distance)
- [Modulino Pixels](/micropython/modulinos/modulino-pixels)
- [Modulino Buzzer](/micropython/modulinos/modulino-buzzer)
- [Modulino Buttons](/micropython/modulinos/modulino-buttons)
- [Modulino Knob](/micropython/modulinos/modulino-knob)
- [Modulino Movement](/micropython/modulinos/modulino-movement)
- [Modulino Thermo](/micropython/modulinos/modulino-thermo)
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
---

title: 'Modulino Distance'
description: 'Get started with using the Modulino Distance'
description: 'Get started with the Modulino Distance using MicroPython'
author: 'Hannes Siebeneicher, Sebastian Romero'
hero_image: "./hero-banner.png"

tags: [MicroPython, Time of Flight, Sensors]
---

This article will show you how to get started with the Modulino Distance and measure the distance to an object.
In this tutorial, we will get started with the Modulino Distance, which can measure the distance to an object.

***Note that the installation of the Modulino package is not covered in this tutorial. For details on how to install this, visit the [MicroPython - Modulino Package Installation tutorial](/micropython/modulinos/installation).***

## Goals

The goals of this tutorial are:

- learn how to connect a Modulino to the Arduino Nano ESP32.
- learn how to connect a Modulino to an Arduino using MicroPython
- learn how to program the Modulino Distance.

## Hardware & Software Needed

- [MicroPython Labs](https://lab-micropython.arduino.cc/)
- [Arduino Nano ESP32](https://store.arduino.cc/products/nano-esp32?queryID=undefined)
- [Modulino MicroPython Package](https://github.com/arduino/arduino-modulino-mpy)
For this tutorial, we will need the following hardware:
- [Modulino Distance](https://store.arduino.cc/products/plug-and-make-kit)
- [Arduino Nano to QWIIC Connector Carrier]()
- [Arduino Nano ESP32](https://store.arduino.cc/products/nano-esp32?queryID=undefined) or [Arduino Nano RP2040 Connect](https://store.arduino.cc/en-se/products/arduino-nano-rp2040-connect)

We will also need the following software:
- [MicroPython Labs](https://lab-micropython.arduino.cc/)
- [Modulino MicroPython Package](https://github.com/arduino/arduino-modulino-mpy)

## Connect the Modulino

Before programming it, you need to first connect your Modulino Distance to your Arduino Nano ESP32. Follow the diagram below to connect your Modulino Distance and Nano ESP32.
Before we start programming, we will need to connect our Modulino Distance to our Arduino board. For this we can follow the circuit diagram below:

![Circuit Diagram]()

## Code
## Modulino Distance Code Example

Copy the code below and run it in Arduino MicroPython labs connected to your Arduino Nano ESP32.
Copy the code below and run it in Arduino MicroPython labs, while connected to our board.

```python
from modulino import ModulinoDistance
Expand All @@ -43,4 +46,5 @@ distance = ModulinoDistance()
while True:
print(f"📏 Distance: {distance.distance} cm")
sleep_ms(50)
````
```

Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
---

title: 'Modulino Pixels'
description: 'Get started with using the Modulino Pixels'
description: 'Get started with the Modulino Pixels using MicroPython'
author: 'Hannes Siebeneicher, Sebastian Romero'
hero_image: "./hero-banner.png"

tags: [MicroPython, RGB, Pixel Strip]
---

This article will show you how to get started with the Modulino Pixels and control RGB LEDs.
In this tutorial, we will get started with the Modulino Pixels and control its RGB LEDs.

***Note that the installation of the Modulino package is not covered in this tutorial. For details on how to install this, visit the [MicroPython - Modulino Package Installation tutorial](/micropython/modulinos/installation).***

## Goals

The goals of this tutorial are:

- learn how to connect a Modulino to the Arduino Nano ESP32.
- learn how to connect a Modulino to an Arduino board.
- learn how to program the Modulino Pixels.

## Hardware & Software Needed

- [MicroPython Labs](https://lab-micropython.arduino.cc/)
- [Arduino Nano ESP32](https://store.arduino.cc/products/nano-esp32?queryID=undefined)
- [Modulino MicroPython Package](https://github.com/arduino/arduino-modulino-mpy)
For this tutorial, we will need the following hardware:
- [Modulino Pixels](https://store.arduino.cc/products/plug-and-make-kit)
- [Arduino Nano to QWIIC Connector Carrier]()
- [Arduino Nano ESP32](https://store.arduino.cc/products/nano-esp32?queryID=undefined) or [Arduino Nano RP2040 Connect](https://store.arduino.cc/en-se/products/arduino-nano-rp2040-connect)

We will also need the following software:
- [MicroPython Labs](https://lab-micropython.arduino.cc/)
- [Modulino MicroPython Package](https://github.com/arduino/arduino-modulino-mpy)

## Connect the Modulino

Before programming it, you need to first connect your Modulino Pixels to your Arduino Nano ESP32. Follow the diagram below to connect your Modulino Pixels and Nano ESP32.
Before we start programming, we will need to connect our Modulino Pixels to our Arduino board. For this we can follow the circuit diagram below:

![Circuit Diagram]()

## Code
## Modulino Pixels Code Example

Copy the code below and run it in Arduino MicroPython labs connected to your Arduino Nano ESP32.
Copy the code below and run it in Arduino MicroPython labs, while connected to our board.

```python
from modulino import ModulinoPixels, ModulinoColor
Expand Down Expand Up @@ -86,4 +89,4 @@ for j in range(0, 3):
# Turn off all LEDs
pixels.clear_all()
pixels.show()
````
```
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
---

title: 'Modulino Buzzer'
description: 'Get started with using the Modulino Buzzer'
description: 'Get started with the Modulino Buzzer using MicroPython'
author: 'Hannes Siebeneicher, Sebastian Romero'
hero_image: "./hero-banner.png"

tags: [MicroPython, Piezo, Speaker]
---

This article will show you how to get started with the Modulino Buzzer, a piezo speaker.
In this tutorial, we will get started with the Modulino Buzzer, a piezo speaker that can output sound.

***Note that the installation of the Modulino package is not covered in this tutorial. For details on how to install this, visit the [MicroPython - Modulino Package Installation tutorial](/micropython/modulinos/installation).***

## Goals

The goals of this tutorial are:

- learn how to connect a Modulino to the Arduino Nano ESP32.
- learn how to connect a Modulino to an Arduino board.
- learn how to program the Modulino Buzzer.

## Hardware & Software Needed

- [MicroPython Labs](https://lab-micropython.arduino.cc/)
- [Arduino Nano ESP32](https://store.arduino.cc/products/nano-esp32?queryID=undefined)
- [Modulino MicroPython Package](https://github.com/arduino/arduino-modulino-mpy)
For this tutorial, we will need the following hardware:
- [Modulino Buzzer](https://store.arduino.cc/products/plug-and-make-kit)
- [Arduino Nano to QWIIC Connector Carrier]()
- [Arduino Nano ESP32](https://store.arduino.cc/products/nano-esp32?queryID=undefined) or [Arduino Nano RP2040 Connect](https://store.arduino.cc/en-se/products/arduino-nano-rp2040-connect)

We will also need the following software:
- [MicroPython Labs](https://lab-micropython.arduino.cc/)
- [Modulino MicroPython Package](https://github.com/arduino/arduino-modulino-mpy)

## Connect the Modulino

Before programming it, you need to first connect your Modulino Buzzer to your Arduino Nano ESP32. Follow the diagram below to connect your Modulino Buzzer and Nano ESP32.
Before we start programming, we will need to connect our Modulino Buzzer to our Arduino board. For this we can follow the circuit diagram below:

![Circuit Diagram]()

## Code
## Modulino Buzzer Code Example

Copy the code below and run it in Arduino MicroPython labs connected to your Arduino Nano ESP32.
Copy the code below and run it in Arduino MicroPython labs, while connected to our board.

```python
from modulino import ModulinoBuzzer
Expand Down Expand Up @@ -89,4 +92,4 @@ siren_melody = generate_siren(440, 880, 4000, 200, 2)

for note, duration in siren_melody:
buzzer.tone(note, duration, blocking=True)
````
```
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
---

title: 'Modulino Buttons'
description: 'Get started with using the Modulino Buttons'
description: 'Get started with the Modulino Buttons using MicroPython'
author: 'Hannes Siebeneicher, Sebastian Romero'
hero_image: "./hero-banner.png"

tags: [MicroPython, Pushbuttons, Digital Input]
---

This article will show you how to get started with the Modulino Buttons, a three-button Modulino.
In this tutorial, we will get started with the Modulino Buttons, a three-button Modulino.

***Note that the installation of the Modulino package is not covered in this tutorial. For details on how to install this, visit the [MicroPython - Modulino Package Installation tutorial](/micropython/modulinos/installation).***

## Goals

The goals of this tutorial are:

- learn how to connect a Modulino to the Arduino Nano ESP32.
- learn how to connect a Modulino to an Arduino board.
- learn how to program the Modulino Buttons.

## Hardware & Software Needed

- [MicroPython Labs](https://lab-micropython.arduino.cc/)
- [Arduino Nano ESP32](https://store.arduino.cc/products/nano-esp32?queryID=undefined)
- [Modulino MicroPython Package](https://github.com/arduino/arduino-modulino-mpy)
For this tutorial, we will need the following hardware:
- [Modulino Buttons](https://store.arduino.cc/products/plug-and-make-kit)
- [Arduino Nano to QWIIC Connector Carrier]()
- [Arduino Nano ESP32](https://store.arduino.cc/products/nano-esp32?queryID=undefined) or [Arduino Nano RP2040 Connect](https://store.arduino.cc/en-se/products/arduino-nano-rp2040-connect)

We will also need the following software:
- [MicroPython Labs](https://lab-micropython.arduino.cc/)
- [Modulino MicroPython Package](https://github.com/arduino/arduino-modulino-mpy)


## Connect the Modulino

Before programming it, you need to first connect your Modulino Buttons to your Arduino Nano ESP32. Follow the diagram below to connect your Modulino Buttons and Nano ESP32.
Before we start programming, we will need to connect our Modulino Buttons to our Arduino board. For this we can follow the circuit diagram below:

![Circuit Diagram]()

## Code
## Modulino Buttons Code Example

Copy the code below and run it in Arduino MicroPython labs connected to your Arduino Nano ESP32.
Copy the code below and run it in Arduino MicroPython labs, while connected to our board.

```python
from modulino import ModulinoButtons
Expand Down
Loading
Loading