on 2026-01-27 6:56 AM
Setting up an IoT system with a gateway and sensor board to get inference data over Bluetooth has never been easier. Through this guide, you build and deploy an IoT system with a Raspberry Pi and an STEVAL-MKBOXPRO board. Additionally, how to run a decision tree on the machine learning core (MLC) intelligent sensor, and send inference data to the cloud. This enables you to collect events on the cloud that you can use to create your own vertical application.
The gateway connects to the Internet through either Wi-Fi or Ethernet. Gateway operation from behind a proxy/firewall is currently not supported.
Open the "My IoT Systems" view to see the IoT systems related to your previously cloned "getting started" projects. Each entry represents a system that you can configure and deploy to a real setup.
Figure 1: ST AIoT Craft – My IoT Systems
Click the [View Details] button of a selected system to access its information page.
In case the selected project has just been cloned, proceed with its deployment by clicking the [Configure and deploy] button. This brings you to the list of items needed to set up the system itself, as mentioned above.
Figure 3: ST AIoT Craft – New IoT deployment (deployment details and what you will need)
The [Start] button opens a wizard that guides you through the configuration and deployment of the system. You can go back at any time to the previous steps by pressing the Back button.
Setting up the gateway is the first step and implies provisioning the gateway so that it can connect to ST AIoT Craft and to the underlying IoT Hub.
Figure 4: ST AIoT Craft – Gateway setup
Follow the steps below:
After selecting your device model, choose the image file downloaded during step 2. as the target operating system. Complete the configuration by plugging in a microSD™ card into your host and selecting the proper mass storage drive.
Do not apply any OS customization settings in the next view, as the image file has already everything set up and changing the expected configuration may result in system failures.
Flash the image and remove the microSD™ card when done.
Figure 7: Raspberry Pi Imager - Flash the image and remove the microSD card when done
After flashing the image, click the [Deploy cloud resources] button to enter a view where you can trigger the deployment of the needed resources to the cloud.
For an initial evaluation, a preconfigured cloud environment, fully managed by ST, can be used by selecting ST Azure cloud.
If the solution fits your needs, you can deploy the entire IoT system to your own cloud subscription by selecting [Cloud stacks]. You can find specific instructions online.
Instantiate the resources needed by clicking the [Deploy devices] button.
Next, generate an staiotcraft_config.ini configuration file containing the necessary parameters for the gateway to connect to the Azure IoT Hub. This includes the DPS’ scope ID, the gateway’s registration ID, its security key, as well as the Wi-Fi credentials, if specified.
Download this configuration file and copy it to the bootfs partition of the microSD™ card (which maps to the /boot/firmware folder of the Raspberry Pi OS file system) and insert the card in the gateway.
Position the gateway and ensure it is ready to communicate with the cloud by checking your router and/or Ethernet cable.
Power on the gateway to let it start configuring itself. Once completed, you see the status update within the deployment details.
This step prepares the leaf device by flashing it with the correct firmware. First, select the connectivity you want to use, such as Bluetooth® LE in this case.
Switch to the USB-based IoT systems step-by-step guide in case you want to deploy the system wired with USB connectivity. You are able to the system again and select Bluetooth® LE connectivity at any time if needed.
Notes:
In case of Bluetooth® LE connection, the ai_ssm firmware is flashed onto the sensor board. It performs realtime inference on collected data by running a decision tree model on the MLC intelligent sensor and transmits results over Bluetooth® LE in beacon mode using a proprietary protocol.
Flashing the sensor board can be done in either of the following ways:
Let us see how to deal with them in the following chapters.
The web portal can flash the firmware onto the board by connecting it to the host PC.
In particular:
Notes:
When the flashing is complete, turn the board on. If it has a charged battery inside, it boots in Bluetooth® LE direct-connection mode signaling that it is waiting for connection by means of a blue LED always on.
Jump to the "Complete the deployment" section to finish the deployment procedure.
Flashing the board in case the selected connectivity is Bluetooth® LE can also be handled by the official ST AIoT Craft mobile app. It is available at the QR codes shown on the right side of the following panel:
Once you have the mobile app installed on your mobile device, open it (a) and scan the QR code of the project (b) shown on the left side of the webpage above.
|
|
|
(a) |
(b) |
The app shows the boards nearby (a), tap on your target device and start updating the firmware over-the-air (b).
|
|
|
(a) |
(b) |
The updating process initiates (a) and goes on (b) until completion (c).
|
|
|
|
(a) |
(b) |
(c) |
When done, your device reboots with the new firmware in Bluetooth® LE direct-connection mode signaling that it is waiting for connection by means of a blue LED always on. Tap on the board to let the app connect to it (a) and start configuring it (b) by setting its advertised name (syx7qZc in this case) (c) and uploading the MLC model available in the project (d).
|
|
|
|
|
(a) |
(b) |
(c) |
(d) |
The 7-characters name is advertised along with inference data, so that the mobile app and the gateway recognize the sender device. You can now validate the model on the mobile app.
Press the All done, check the deployment status button to go ahead with the deployment of the IoT system.
During the first execution, the gateway configures itself and the sensor node. In particular, the gateway expands the file system partition on the microSD™ card to the available space and configures all required services. Moreover, the web portal sends a deployment manifest file to the gateway, to make it run the set of Docker modules required to handle the IoT system.
Figure 15: ST AIoT Craft – System configuration monitoring
This process may take several minutes, depending also on the speed of your Internet connection. Moreover, although the provided gateway image includes all the necessary edge modules, any new version must be downloaded from the official container registry, adding to the startup time.
Clicking on the Inspect gateway button opens a new tab in the browser that shows the modules running on the gateway in real time.
This view can be accessed by your host PC only if the gateway and the PC are connected to the same network, Multicast DNS (mDNS) is enabled, and the host OS allows it. For example, this might not be true behind a MITM proxy.
Figure 16: ST AIoT Craft Gateway Monitor – Docker modules
From this monitoring page, you can see modules’ log, restart modules, and reboot or shutdown the gateway at any time. For instance, the picture below shows the log of the edgeMLC main application module, from which you can get to know what is happening on the gateway.
Figure 17: The log of the edgeMLC main application module
As soon as the system warms up, you see some modules going up and running.
At a certain point, you are asked to authorize the gateway to connect to the ST AIoT Craft services, just like you did for the browser or any other client.
Figure 19: ST AIoT Craft – Authorize the gateway to connect to the ST AIoT Craft services
At the end of the deployment process, all the gateway modules are up and running. The devices are provisioned and visible in the IoT Hub being used as well as in the IoT systems view of the ST AIoT Craft web portal.
Click the Start monitoring button to move forward and play with the inference mode.
Data logging is disabled with Bluetooth® LE connectivity, for the time being.
From this view, you can set the system to Inference mode to assess the pretrained ML model on the MLC sensor of the real deployed system.
The gateway downloads the model from your workspace in the cloud and flashes it to the sensor board in a few seconds. You can then start the inference algorithm on the target by pressing the Start button.
Figure 22: ST AIoT Craft – Start the inference algorithm on the target
In case of the Smart Asset Tracking get-started project, a plot like the one above is shown.
Events detected by the MLC in the sensor node are gathered by the gateway and forwarded to the cloud.
An orange LED turns on each time an advertisement message is sent over Bluetooth® LE.
Should you hit any issues when setting up an IoT system, refer to the Debugging and troubleshooting page.
In this article, we describe how to set up an IoT system with a gateway and sensor board to get inference data over Bluetooth. You can now build and deploy an IoT system with a Raspberry Pi and an STEVAL-MKBOXPRO board, run a decision tree on the machine learning core (MLC) intelligent sensor, and send inference data to the cloud. Try it out!
Refer to the online IoT Systems documentation for further information, where you also find how to deploy an IoT system based on USB connectivity.