Summary of IoT Node with STM32F4 Discovery, MKR1000 and Azure IoT Hub
This project demonstrates sending accelerometer telemetry from an STM32F4 Discovery Board to Azure IoT Hub via an Arduino MKR1000. Since the STM32 lacks WiFi, it communicates serially with the MKR1000, which handles the cloud connection using the Azure IoT Hub library. The system captures X-axis acceleration data, transmits it byte-by-byte over UART, and uploads it to the cloud for visualization.
Parts used in the IoT Node with STM32F4 Discovery, MKR1000 and Azure IoT Hub:
- STMicroelectronics STM32F407G-DISC1
- Arduino MKR1000
- AdaCore GNAT Community
- Arduino IDE
- Azure IoT Hub Library for Arduino
- LIS3DSH Accelerometer
- Serial communication cables (Tx/Rx)
With MKR1000 and Azure IoT Hub, STM32F4 Discovery Board is used to send acceleration and other random telemetry data to Azure IoT Hub.

Things used in this project
Story
Overview
.
The original idea of this project involves a WiFi component so that telemetry data will be sent thru internet to a cloud IoT hub. Since the lack of the WiFi part, this project uses the Tx/Rx serial together with MKR1000 to send data to an Azure IoT Hub.
.
Set Up Azure IoT Hub
.
I have set up an IoT hub and an IoT device on the Azure cloud following this quickstart tutorial. Take note of the hub name, device name and their corresponding connection string. These info is needed for the configuration in the code.
The ReadDeviceToCloudMessages.js shows the messages sent to the IoT hub. There is a picture showing a list of telemetry messages below.
.
Set Up MKR1000
.
Set up WiFi for MKR1000 by following the instruction at this link.
Azure IoT Hub library for Arduino is used to allow MKR1000 communicating to Azure IoT hub.
.
Set Up STM32F4 Discovery Board
.
For STM32F4 info, refer here.
Download the required and install the software. They can be found here. Both the gnat-community-2018-20180611-x86_64-windows-bin.exe and gnat-community-2018-20180523-arm-elf-windows64-bin.exe are needed.
Check out video tutorials here.
.
Some Pictures
.
.

.

.

Some Codes
.
The following is the code fragment which gets accelerometer values and sends the X value thru Tx/Rx communication a byte at a time.
Accelerometer.Get_Accelerations (Values);
F := Float (Values.X);
Move(Float'Image (F), Fs);
for C of Fs loop -- arbitrary
Put_Blocking (USART_1, Character'Pos (C));
My_Delay (1000);
end loop;
.
STM32F4 MKR1000
PB7 (Rx) ------> D14 (Tx)
PB6 (Tx) ------> D13(Rx)
Above is the pin configuration between STM32F4 Discovery Board and MKR1000.
.
Future Works
.
- Make use of WiFi component
- Add more sensors
- Builld a dashboard for visualization
- Build using other IoT plaforms
.
Summary
.
This is a very simple setup of a STM32F4 node sending telemetry data to Azure IoT Hub. Different sensor devices like gas and air quality sensors can be add to the setup to make a more practical project.
.
Code
Source : IoT Node with STM32F4 Discovery, MKR1000 and Azure IoT Hub
- How is telemetry data sent to Azure IoT Hub when the STM32 board lacks WiFi?
The project uses Tx/Rx serial communication between the STM32F4 Discovery Board and the MKR1000, which handles the WiFi transmission to the cloud. - What software is required to compile the Ada code for the STM32 board?
AdaCore GNAT Community must be downloaded and installed, specifically the Windows binary files for x86_64 and arm-elf architectures. - Which pins are used to connect the STM32F4 Discovery Board to the MKR1000?
PB7 on the STM32 connects to D14 (Tx) on the MKR1000, and PB6 connects to D13 (Rx). - Can additional sensors be added to this setup?
Yes, different sensor devices like gas and air quality sensors can be added to make the project more practical. - What transport protocol is selected by default in the iot_configs.h file shown in the article?
The HTTP protocol is selected by default, indicated by the uncommented #define IOT_CONFIG_HTTP line. - How does the MKR1000 read the floating-point acceleration values sent from the STM32?
The MKR1000 reads characters serially until it encounters a space or negative sign, then converts the buffer to a float value. - What tool is used to view the messages sent to the IoT hub in the article?
A JavaScript file named ReadDeviceToCloudMessages.js is used to display the list of telemetry messages received. - Does the project support future dashboard visualization?
Yes, building a dashboard for visualization is listed as a planned future work item for the project.


_D43FVifteF.png?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff)
