From bf37f33d1f95cec5a0bb44630bdcac171e0d6d74 Mon Sep 17 00:00:00 2001 From: TaddyHC Date: Wed, 3 Dec 2025 18:32:33 -0600 Subject: [PATCH 1/2] Portenta X8 RPC Links and example update --- .../assets/py-serialrpc.zip | Bin 1685 -> 0 bytes .../assets/python-sensor-rpc.zip | Bin 8805 -> 0 bytes .../content.md | 42 +++++++++--------- 3 files changed, 21 insertions(+), 21 deletions(-) delete mode 100644 content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/assets/py-serialrpc.zip delete mode 100644 content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/assets/python-sensor-rpc.zip diff --git a/content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/assets/py-serialrpc.zip b/content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/assets/py-serialrpc.zip deleted file mode 100644 index b79e56f25f34ce76ede2e15f67f7098aa69104ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1685 zcmWIWW@Zs#U|`^2u#Bw;iR~+YJQ>LQ1jO<{Tu`Z7oLZEbm{U}cte=vfoSj;vo1C9p zkYAjtSDBj=+INw!$$-c8{@<>)@@ED@lm79nyzpXDukPJ|Z{H6EH0%4mdwDWf`SfKT znU5?2MY54Rk(`I8G3IUFsN7`rzvAGri*rAo*N?GKo7Cd)&DBzDT9BKE(dXj}Hh!OM zyQxywaYadJ(1%Hn>h`v+y1MIV?i=s8Ndf;qd|a?2TlR>)zT+{Kx- z|FaK7E%DC}fcl34>>r>P;6NP6Lh%p6XE05WKv=WmlF|;K;+H_Ih+C5jI5^TWb5c|L z&w4o<3b=j$EaH4ktz19qmH*VF>U>U7&7(&ruvt%-?W4Z)!oIy;cX$4HkaMo_{Zanx zDc;u8YP>xy+#9YQew@^*T$pFyU6mg<({14-u63I1=X%QH^Y%QN^TnW0Pp@Sr;}3~H zw?AJ>HV=Kfs;$q3VP4x=KGS(>*DQ|RS(W{~Z5{Lfdy6+HJin!(y2VUfT0>^B?S@5H z>#xPXG4JI|xS0Pp&sgWT?z@XI^Jhq#m}&(Far)`8**}zqd7FXZW{Y^_xC4NPD_bKyW5$iiVsaZ$29Od}*xZcm&3)exw`2#7IKCL$(58uijMOT5qPc%IbR z6m;S8W%h+%&ItXz^JmJXIaiYYHl3Q(^T+1yqNbF)SGtbeX_^!A_tByhJqA?U3d=-7 z1Q{6^{sS?dumITxw_C5EGB@C0)?ovly}z|x^ve`l@-BEUY`^IL!mwqcrQfTwoy~8= zyk6}0@7lbj^`+A9moGj2x5?YOy>K?a_KV$JH^=FaZiiSc|HW@?ViWE=u{4J_7bN%v zCYS5p*D}1$pU}P{?8n|yEfNzqhAmrX>+`bkd}H*B^Dp%}SI#wM?zY*c*=M|L-h}>T zj>1h|MxLstSrWyMpY>dNVQaD1qL(=xY^i*^-5YNuSZxAR;AzTH? jk?45@VHgK9URS{*1DIn1yjj^m8rgwR5$J|E77z~rm^??8 diff --git a/content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/assets/python-sensor-rpc.zip b/content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/assets/python-sensor-rpc.zip deleted file mode 100644 index 45f3aa0061eb622e8cc1e01068b4882e55d09a72..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8805 zcmb_h1z1$u79LV!grO0nyE}%?E1g5fkTL_q4BdiABi$e(AV`NwDqRvHAO;GO0umwy zVE}KqUPUjw`{{jef8XJpIrGi`ueJ8SH*2q@r-_A44mcbI;Z$aSKK%8E7JYZ~_ky92 ze4dU-Pm~9rhnu|s6soPLtZQg0p!Z*Y$oJ1bJdXJd3J);Pn+r*x9GtU6L)4-#$=`+I zhZ?9Vs%We7yE@q0P}n=!*x77qYZ-468%OJ1#7v^b;sDWNxYL2cc4?`jF%y`W6!n&H z8La_5m@o}$l6ixHkIexwI5^<40B}q%TXAn07gr2h*&s$IV?@Ob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M8** on the Portenta breakout. +You can find the sketch and complete example [here](https://github.com/arduino/portenta-containers/tree/main/python-rpc-sensors). You may need to change the sketch depending on the choice of the sensor to read from. If you're using an I2C sensor, you can connect SCL to **PWM6** and SDA to **PWM8** on the Portenta breakout. That is because the labeled I2C pins on the Portenta Breakout are only available on the Linux side. If you are using an analog sensor, you can connect it to any analog pin. Please refer to the pinout diagram on the Portenta Breakout [documentation page](/hardware/portenta-breakout). @@ -129,16 +129,16 @@ Make sure you have installed the **Arduino Mbed OS Portenta Boards** core and up 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. -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: +This service needs to run on the Linux side of the X8. You can get the files [here](https://github.com/arduino/portenta-containers/tree/main/python-rpc-serial). Clone or download the repository to your local machine, then from the command prompt, navigate to the adb tool folder and upload the files to the X8 with command: ```bash -adb push /py-serialrpc /home/fio +adb push /python-rpc-serial /home/fio ``` -Log into the X8 shell with `adb shell` and navigate into the `serialrpc` folder. Build the container using +Log into the X8 shell with `adb shell` and navigate into the `python-rpc-serial` folder. Build the container using ```bash -docker build . -t py-serialrpc +docker build . -t python-rpc-serial ``` The `-t` flag assigns a tag to the container. Then run the container by executing `cd..` and then: @@ -181,16 +181,16 @@ rpc_client = RpcClient(rpc_address) temperature = rpc_client.call('temperature') ``` -The complete Python® application files are in the same package as the Arduino sketch (see above). Like in the previous step, upload the `python-sensor-rpc` folder to the Portenta X8 via: +The complete Python® application files are available in the repository [here](https://github.com/arduino/portenta-containers/tree/main/python-rpc-sensors). Clone or download the repository to your local machine, then upload the `python-rpc-sensors` folder to the Portenta X8 via: ```bash -adb push /python-sensor-rpc /home/fio +adb push /python-rpc-sensors /home/fio ``` -Log into the X8 via `adb shell`. Then navigate into the `python-sensor-rpc` folder and execute: +Log into the X8 via `adb shell`. Then navigate into the `python-rpc-sensors` folder and execute: ```bash -docker build . -t python-sensor-rpc +docker build . -t python-rpc-sensors ``` When it has finished, you can run the container with: @@ -202,22 +202,22 @@ docker compose up After a few seconds, you should see the output from the Python application featuring the sensor readings on the M4 that exchanges through the RPC mechanism. The output should look similar to the following: ```bash -python-sensor-rpc_1 | ============================================ -python-sensor-rpc_1 | == Portenta X8 Sensor reading == -python-sensor-rpc_1 | ============================================ -python-sensor-rpc_1 | -python-sensor-rpc_1 | Temperature: 25.904266357421875 -python-sensor-rpc_1 | Humidity: 25.564695358276367 -python-sensor-rpc_1 | Pressure: 976.4400024414062 -python-sensor-rpc_1 | Gas: 136.496 -python-sensor-rpc_1 | Altitude: 311.0769348144531 +python-rpc-sensors_1 | ============================================ +python-rpc-sensors_1 | == Portenta X8 Sensor reading == +python-rpc-sensors_1 | ============================================ +python-rpc-sensors_1 | +python-rpc-sensors_1 | Temperature: 25.904266357421875 +python-rpc-sensors_1 | Humidity: 25.564695358276367 +python-rpc-sensors_1 | Pressure: 976.4400024414062 +python-rpc-sensors_1 | Gas: 136.496 +python-rpc-sensors_1 | Altitude: 311.0769348144531 ``` Whenever you change anything in the Python® script on your computer, you will have to resync and push the new script to the Portenta X8 and rebuild the container. Following command sequence will help you to do this process: ```bash # On your computer -adb push python-sensor-rpc /home/fio +adb push python-rpc-sensors /home/fio ``` ```bash @@ -227,7 +227,7 @@ docker compose down ```bash # On the Portenta X8 -docker build . -t python-sensor-rpc +docker build . -t python-rpc-sensors ``` ```bash From ff130f866230d11fc58d4d58ce7b95e210161544 Mon Sep 17 00:00:00 2001 From: TaddyHC Date: Wed, 3 Dec 2025 18:56:20 -0600 Subject: [PATCH 2/2] Update for prebuilt image for OS 934 compatibility --- .../04.python-arduino-data-exchange/content.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/content.md b/content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/content.md index c247fc1648..29fe748181 100644 --- a/content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/content.md +++ b/content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/content.md @@ -181,6 +181,22 @@ rpc_client = RpcClient(rpc_address) temperature = rpc_client.call('temperature') ``` +You have two options to run the Python® application. For a quick setup, you can use the pre-built `arduino/python-rpc-sensors` image that's maintained. This makes sure you always have the latest compatible version: + +```bash +adb shell +``` + +Pull and run the pre-built image using following command: + +```bash +docker run --rm --network=host arduino/python-rpc-sensors +``` + +This approach is recommended as it's simpler and always uses the latest tested version compatible with the current OS. + +If you want to modify the Python® script or learn how the container is built, you can build the image from source. + The complete Python® application files are available in the repository [here](https://github.com/arduino/portenta-containers/tree/main/python-rpc-sensors). Clone or download the repository to your local machine, then upload the `python-rpc-sensors` folder to the Portenta X8 via: ```bash