Skip to content

Commit 293ca76

Browse files
committed
Tutorials 4 5 Update
1 parent 31626c5 commit 293ca76

File tree

2 files changed

+41
-23
lines changed
  • content/hardware/04.pro/boards/portenta-x8/tutorials

2 files changed

+41
-23
lines changed

content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/content.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ hardware:
1212

1313
## Overview
1414

15-
The container infrastructure provided by Arduino contains a pre-built Python® image that you can use to run Python® applications on the Portenta X8. In this tutorial, we're going to build a container based on a provided one.
15+
The container infrastructure provided by Arduino contains a pre-built Python® image that you can use to run Python® applications on the Portenta X8. In this tutorial, we are going to build a container based on a provided one.
1616

1717
While all the peripherals are accessible from the iMX8 processor running the Linux environment, it can be useful to let the onboard microcontroller take care of certain peripheral handling and exchange only the required data between the microcontroller and the Python® application.
1818

19-
Thus you will learn how to do that. If you haven't done so, read through the [user manual](https://docs.arduino.cc/tutorials/portenta-x8/user-manual) to understand the fundamental concepts of the X8 and the provided infrastructure.
19+
You will be guided on how to achieve this setup. It is recommendable to familiarize yourself with the foundational elements of the Portenta X8 and its infrastructure by reading the [user manual](https://docs.arduino.cc/tutorials/portenta-x8/user-manual) if you have not already done so.
2020

2121
## Goals
2222

@@ -27,9 +27,9 @@ Thus you will learn how to do that. If you haven't done so, read through the [us
2727

2828
### Required Hardware and Software
2929

30-
- [Portenta X8](https://store.arduino.cc/products/portenta-x8) board
31-
- [Portenta breakout](https://docs.arduino.cc/hardware/portenta-breakout) board
32-
- Any sensor (in this example, we'll use an [BME680](https://www.bosch-sensortec.com/products/environmental-sensors/gas-sensors/bme680/) I<sup>2</sup>C module)
30+
- [Portenta X8](https://store.arduino.cc/products/portenta-x8)
31+
- [Portenta breakout](https://docs.arduino.cc/hardware/portenta-breakout)
32+
- Any sensor (in this example, we will use an [BME680](https://www.bosch-sensortec.com/products/environmental-sensors/gas-sensors/bme680/) I<sup>2</sup>C module)
3333
- [Arduino IDE 1.8.10+](https://www.arduino.cc/en/software), [Arduino IDE 2](https://www.arduino.cc/en/software), or [Arduino Web Editor](https://create.arduino.cc/editor)
3434

3535
## Python® on the X8
@@ -93,7 +93,7 @@ Make sure you have installed the **Arduino Mbed OS Portenta Boards** core and up
9393

9494
To check if the Arduino sketch is working correctly, you may want to read the messages from the `Serial.println` statements. You cannot currently read them directly in the serial monitor of the Arduino IDE. Instead, you can use a simple service called **`py-serialrpc`**, which listens for those messages and prints them to the console.
9595

96-
This service needs to run on the Linux side of the X8. You can get the files [here](assets/py-serialrpc.zip). From the command prompt of your local machine, navigate to the adb tool folder and upload the files to the X8 with command:
96+
This service needs to run on the Linux side of the X8. You can get the files [here](assets/py-serialrpc.zip). The compressed file will have every file needed to build a container as the docker compose app. From the command prompt of your local machine, navigate to the adb tool folder and upload the files to the X8 with command:
9797

9898
```bash
9999
adb push <local directory path>/py-serialrpc /home/fio
@@ -199,15 +199,19 @@ sudo docker build . -t python-sensor-rpc
199199
sudo docker compose up
200200
```
201201

202-
Alternatively, you could modify the files directly on the X8 using an editor such as *VIM*, so you do not need to upload the files every time. Rebuilding the container will be necessary in any case though.
202+
Alternatively, you could modify the files directly on the X8 using an editor such as **VIM**, so you do not need to upload the files every time. Rebuilding the container will be necessary in any case though.
203203

204-
If you wonder how to specify the Python® script that is executed when running a container, have a look at the `Dockerfile` file. There you will find the `ENTRYPOINT` command that takes multiple arguments. In our example: `ENTRYPOINT [ "python3", "m4_to_python.py"]`.
204+
If you wonder how to specify the Python® script that is executed when running a container, have a look at the `Dockerfile` file. There you will find the `ENTRYPOINT` command that takes multiple arguments. In our example:
205+
206+
```python
207+
ENTRYPOINT [ "python3", "m4_to_python.py"]`
208+
```
205209
206210
## Conclusion
207211
208212
In this tutorial, you learned how to use the docker infrastructure to build a container that runs a Python® application. You have also learned how to use the RPC mechanism to exchange data between the microcontroller and the iMX8, which runs the Linux operating system.
209213
210214
### Next Steps
211215
212-
- You may now further process the data that you receive from the Arduino sketch and e.g. upload it to a Cloud service or similar.
216+
- You may further process the data you receive from the Arduino sketch and, e.g., upload it to a Cloud service or similar.
213217
- Familiarize yourself with Docker commands to adjust the docker configuration to your needs.

content/hardware/04.pro/boards/portenta-x8/tutorials/05.docker-container/content.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ hardware:
1616

1717
## Overview
1818

19-
[Docker](http://docker.com) is a platform full of applications, called containers. Containers are isolated solutions, thus they don't have to depend on your environment. Making them portable and consistent throughout development, testing, and production.
19+
[Docker](http://docker.com) is a platform full of applications called containers. Containers are isolated solutions; thus, they do not have to depend on your environment, making them portable and consistent throughout development, testing, and production.
2020

2121
You can download, install, use, and share applications in the form of containers. You can find all the available container images on the [hub.docker.com](https://hub.docker.com) page.
2222

23-
In this tutorial, we will go through the steps of how to install, run and remove Docker's official [Hello-World image](https://hub.docker.com/_/hello-world)
23+
In this tutorial, we will go through the steps of how to install, run, and remove Docker's official [Hello-World image](https://hub.docker.com/_/hello-world).
2424

2525
## Goals
2626

@@ -31,7 +31,7 @@ In this tutorial, we will go through the steps of how to install, run and remove
3131

3232
### Hardware and Software Requirements
3333

34-
- [Arduino® Portenta X8](https://store.arduino.cc/products/portenta-x8)
34+
- [Portenta X8](https://store.arduino.cc/products/portenta-x8)
3535
- USB-C® cable (either USB-C® to USB-A or USB-C® to USB-C®)
3636
- Wi-Fi® Access Point with Internet Access
3737
- ADB: [Check how to connect to your Portenta X8](https://docs.arduino.cc/tutorials/portenta-x8/user-manual#out-of-the-box-experience)
@@ -41,17 +41,23 @@ In this tutorial, we will go through the steps of how to install, run and remove
4141

4242
## Using Docker
4343

44-
The Portenta X8 provides Docker CLI by default. The following command will help you verify if it is installed correctly:
44+
The Portenta X8 provides Docker CLI by default. To verify its correct installation, use the following command:
4545

4646
```bash
4747
docker -v
4848
```
4949

50+
Or as well:
51+
52+
```bash
53+
docker --version
54+
```
55+
5056
***To use this tool, you will need to connect to your device first. Check [how to connect using adb/ssh](https://docs.arduino.cc/tutorials/portenta-x8/user-manual#out-of-the-box-experience).***
5157

52-
You can check Docker's reference documentation, which covers all the features of the tool in depth at [docs.docker.com](https://docs.docker.com/).
58+
You can explore Docker's comprehensive reference documentation, covering all tool features in depth, at [docs.docker.com](https://docs.docker.com/).
5359

54-
The following steps will show how to install, run and uninstall the "Hello World" container.
60+
The following steps will show how to pull the **"Hello World"** image from Docker Hub, run the container, and view its status.
5561

5662
To avoid a lack of permissions while launching ```adb shell```, you may type the following: ```newgrp - docker```.
5763

@@ -61,7 +67,7 @@ The previous command and other important info about Linux on your Portenta are d
6167

6268
First, you will need to search for ["Hello World" container image](https://hub.docker.com/_/hello-world). The container image can be found within the Docker hub, where you will be able to find a variety of readily-available container images. It will be used to verify docker is working as intended with the Portenta X8.
6369

64-
The following command must be used to pull the `hello-world` image. The Docker hub page for images has the instructions to pull the image and deploy the container.
70+
The following command is used to pull the `hello-world` image. The Docker hub page for images has the instructions to pull the image and deploy the container.
6571

6672
```bash
6773
docker pull hello-world
@@ -71,17 +77,17 @@ docker pull hello-world
7177

7278
### Run The Installed Container
7379

74-
This is the command to begin the container instance.
80+
Use this command to begin a container from the `hello-world` image:
7581

7682
```bash
7783
docker run hello-world
7884
```
7985

8086
![Docker CLI running Hello World app](assets/docker-run.png)
8187

82-
***To be able to see an active container with `docker ps -a`, you will need to run it at least once with `docker run`***
88+
***To see a list of active and exited containers, `docker ps -a` should be used after running a container at least once with `docker run`***
8389

84-
### Listing The Installed Packages
90+
### Listing Active Containers And Available Docker Images
8591

8692
The following command will display the active containers and will show the `hello-world` container if it was able to run successfully. The `STATUS` message will let you know if the container is active or has finished operation depending on its purpose.
8793

@@ -99,17 +105,25 @@ docker images
99105

100106
![Docker CLI images](assets/docker-images.png)
101107

102-
### How to Uninstall A Container
108+
### How to Remove A Container
109+
110+
You will need to obtain an assigned `CONTAINER ID` to remove a container of your choice. This can be found by listing all containers, including inactive ones:
103111

104-
You will need to obtain an assigned `CONTAINER ID` to be able to remove a container of your choice. The list of active containers provides this information. The remove (`rm`) command is then used with the desired container identifier to proceed with the removal process.
112+
```bash
113+
docker ps -a
114+
```
115+
116+
The remove (`rm`) command is then used with the desired container identifier to proceed with the removal process.
105117

106118
```bash
107119
docker container rm <CONTAINER ID>
108120
```
109121

110-
For this example, the command `docker ps -a` will show the `CONTAINER ID` of the `hello-world` container designated as: `c44ba77b65cb`. If you encounter an error stating that the container cannot be removed, it may mean that the container has an actively ongoing operation which can be checked with `STATUS` message.
122+
For this example, the command `docker ps -a` will show the `CONTAINER ID` of the `hello-world` container designated as: **`c44ba77b65cb`**.
123+
124+
If you encounter an error stating that the container cannot be removed, it may mean that the container has an ongoing operation that can be checked with a `STATUS` message.
111125

112-
Granted that this is the case, you will need to stop the container and verify with `STATUS` message that it has exited successfully. To do this, the following command is used:
126+
If this is the case, you will need to stop the container and verify with a `STATUS` message that it has exited successfully. To do this, the following command is used:
113127

114128
```bash
115129
docker stop <CONTAINER ID>

0 commit comments

Comments
 (0)