The objective is to showcase the capabilities of the STM32 Ecosystem for WBA customers. This demonstration features a BLE link, an AI algorithm, and motor control operating concurrently.
The selected use case is a fan equipped with anomaly detection, which is reported via BLE.
This example runs on STM32WBAxx DK board.
You need hardware to do the same demo:
- A Fan
- Arduino Motor Shield rev3
- 4 * LEDs Bar (Not mandatory)
- 3D Model that you can impress on yourself with the 3D files
- A phone or a PC
And also software:
- IDE (CubeIDE or IAR)
- NanoEdge AI
Schematic:
To use the system without the LED and the screen:
- Connect the Arduino shield to the WBA Development Kit (DK) using the ST Morpho connectors.
- Attach the fan's positive (+) and negative (-) terminals to the "Motor A" outputs.
- Connect a 12V power supply to the Vin and GND terminals.
To incorporate the LED bar:
- Follow the same initial steps for connecting the Arduino shield and the fan to the WBA DK.
- Proceed with the additional connections for the LED bar as specified in the provided schematic.
To use the DK Screen along with the Arduino shield:
- Disconnect the Arduino shield from the WBA Development Kit to ensure safety while making modifications.
- Carefully cut Pin 12 on the Arduino shield to prevent it from making a connection. This step is crucial to avoid conflicts with other functionalities that may be using this pin.
- Create a connection between Pin 12 and Pin 10. This can be done by connecting a wire between the two pins.
Once these steps are completed:
- Reconnect the Arduino shield to the WBA Development Kit using the ST Morpho connectors.
- Ensure that the fan is still connected to the "Motor A" terminals (+ and -).
- Reconnect the 12V power supply to the Vin and GND terminals.
The application contains two modes that can be selected in the app_conf.h
file.
The mode allows you to generate your own AI library using NanoEdge AI. It is recommended not to use the pre-existing library, as any discrepancies between your model and the provided model could significantly alter the data input to the AI.
To begin logging data for your AI model:
- Open the firmware project in your preferred Integrated Development Environment (IDE).
- Modify the
app_conf.h
file by settingDATA_LOGGER
to1
:
#define DATA_LOGGER 1
- Save the changes to the
app_conf.h
file. - Compile the project to build the firmware with the new configuration.
- Flash the compiled firmware onto the board.
For NanoEdge AI Studio:
- Start a new Anomaly Detection project.
- Generate both regular and abnormal signals, which will be sent via USB with a baud rate of 921,600 bps.
For more information, refer to the NanoEdge AI documentation
After generating your library, you can proceed to use the main application for anomaly detection.
- Open the firmware project in your preferred Integrated Development Environment (IDE).
- Edit the
app_conf.h
file by settingDATA_LOGGER
to0
:
#define DATA_LOGGER 0
- Save the changes to the
app_conf.h
file. - Compile the project to build the firmware with the updated configuration.
- Flash the compiled firmware onto the board.
If you wish to use the LEDs and the screen:
- Ensure the corresponding connections are made and the software is configured to interact with these components:
#define CFG_LED_SUPPORTED (1)
#define CFG_LCD_SUPPORTED (1)
To switch to the shield's power supply:
- Change the jumper JP4 to the
5VVIN
position to use an external power supply.
To use the Web App:
- Open the provided Web App link on a PC or Android smartphone.
- Connect to the Fan Control, which will likely be listed as "FC_XX".
- Select the desired fan speed through the app.
- Monitor for notifications from the app indicating when an anomaly is detected.
This setup allows for remote monitoring and control of the fan, with the added functionality of receiving notifications in case of detected anomalies.
Caution : Issues and the pull-requests are not supported to submit problems or suggestions related to the software delivered in this repository. The STM32WBA-BLE-AI-Fan-Control example is being delivered as-is, and not necessarily supported by ST.
For any other question related to the product, the hardware performance or characteristics, the tools, the environment, you can submit it to the ST Community on the STM32 MCUs related page.