I've introduced my project Smart Drive in my previous blog post.
My project requires a secure connection with Internet to exchange information. I've selected MQTT protocol as it is open, lightweight (low power consumption), supports data confidentiality (TLS) and widely adopted (including client for STM32).
The following characteristics of Nucleo Wi-Fi expansion board X-NUCLEO-IDW01M1 enable my communication requirements for a secure connection with Internet to exchange information over MQTT protocol.
- low power IEEE 802.11 b/g/n transceiver
- integrated SMD antenna
- integrated protocol stacks: TCP/IP, TLS/SSL
X-NUCLEO-IKS01A2 - Motion MEMS and environmental sensor expansion board for STM32 Nucleo will provide sensor reading related to acceleration and orientation.
I've connected Nucleo Wi-Fi expansion board and Nucleo Motion MEMS and environmental expansion board X-NUCLEO-IKS01A2 - Motion MEMS and environmental sensor expansion board for STM32 Nucleo - STMicroelectronics with Nucleo development board
mbed os cloud IDE
I've try several development IDEs for STM32. I've decided to use mbed os IDE https://os.mbed.com/compiler/ . It is fast, easy to use. It has some constraints in terms of debugging, but serial communication from the board provides capability to get log output.It is acceptable for me way to debug after my previous experience in a similar setup with other MCUs. As well it is possible to export project from mbed os and import into other IDEs. But I run into some errors when I've tried to build the project with STM System Workbench.
MQTT and WiFi Configuration
MQTT protocol support comes with one of the several STM32 ODE Function Packs - STMicroelectronics I've decided to try FP-CLD-BLUEMIX1, as it was build by IBM, which created MQTT protocol.The MQTT client implementation is based on Apache Paho project. The documentation and MQTT server hosted in the cloud. I've created a new mbed-os project using FP-CLD-BLUEMIX1 template. Then I've configured WiFi parameters in the project and removed references to a NFC board.
Build, Deployment and Debugging
I've connected STM modules over USB to a serial terminal. Then after a successful compilation of the project I've uploaded the binary to STM32 USB disk. The program start execution right away after the upload. The board was able successfully connect to my WiFi access point and to the MQTT server in the cloud.
I was able to confirm MQTT connection from the cloud server by entering my board MAC address,