You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***For more detail about how data exchange between Arduino and Linux layer works and to understand how to debug, please read [Data Exchange Between Python on Linux and an Arduino Sketch](https://docs.arduino.cc/tutorials/portenta-x8/python-arduino-data-exchange)***
127
127
128
+
Let us now dive into develop a multi-protocol gateway using Portenta X8 and Max Carrier!
129
+
128
130
## Coding Multi-Protocol Gateway
129
131
130
-
As everything sounds beautiful, now it is important to land all the requirements into a operational task that will orchestrate every protocols we are going to use. We will create the following files and the required codes for multi-protocol gateway.
132
+
Everything sounds beautiful, but now it is important to land all the requirements into a operational task that will orchestrate every protocols we are going to use. We will create the following files and the required codes for multi-protocol gateway.
131
133
132
134
We will need the Docker files that will configure and let us build a working container.
133
135
@@ -163,7 +165,7 @@ paho-mqtt
163
165
164
166
### Multi-Protocol
165
167
166
-
This is the main Python script that will handle overall networking process. We will highlight important fragments of the code to help you understand why they are important and how will it be handled accordingly in brief.
168
+
This is the main Python script that will handle overall networking process. We will highlight important fragments of the code to help you understand how these codes pieces together to build a gateway based on multiple protocol.
167
169
168
170
First up, is the configuration for M4 Proxy Server, which is the parameter to handle communication with M4 core that extend the Arduino layer. The `m4_proxy_port` is configured to 5001, as it is the port used by clients to send the data to M4.
With these parameters configured, we have secured the connection between The Things Network. The Things Network would be our end-point where the sensor datas are going to be sent over. And to send data, we need to begin by gathering this data, which can be from sensors or modules with status feedback. A sensor can be attached directly communicating via Arduino layer to receive the data, wrap it, and send it to The Things Network. On the other hand, we will need to have a mechanism that will be able to intercept data sent over WiFi connectivity using MQTT protocol.
215
217
216
-
<WIP>
218
+
```
219
+
# WiFi - MQTT protocol handler
220
+
```
221
+
222
+
This will help to receive sensor data from any external device, for example using Arduino MKR WiFi 1010 with a sensor attached, using MQTT protocol. This capability will help to increase the scalability of the multi-protocol gateway. For this to work, we will also need sketch for Arduino layer that will help us expose and retrieve the data in between Arduino and Linux layer.
223
+
224
+
```
225
+
# Arduino side sketch
226
+
#include <RPC.h>
227
+
#include <SerialRPC.h>
228
+
```
229
+
230
+
The sketch above will help to expose and transfer the data that is processed within the Linux side. By exposing, it means you will bring forth the data received within the Linux side to the Arduino side to feed the loca-device as a control input. It can be used to display the data if you wish to for instance. Transferring data to Linux side can be seen as a direct communication, as the sensor connected and monitored via Arduino side will send this data to send over LoRa connectivity. The sketch will have both options open to assist you on further extending the possibilities within.
0 commit comments