This repository provides an example implementation of MQTT (Message Queuing Telemetry Transport) protocol for STM32 microcontrollers using the SIM900 module through AT commands. MQTT is a lightweight messaging protocol commonly used in IoT (Internet of Things) applications to enable communication between devices.
Note In this example, a Stm32 microcontroller is used, but it can be replaced with any other microcontroller (Arduino,Pic, NXP) , As is the case with the GSM/GPRS model SIM900, You can change the model with any other supports AT commands and TCP
- MQTT Client: This implementation demonstrates how to establish an MQTT client on an STM32 microcontroller using the SIM900 module and AT commands.
- STM32 microcontroller board (e.g., STM32F103, STM32F407, etc.)
- SIM900 module (or compatible GSM/GPRS module)
- Serial communication interface (UART) between STM32 and SIM900
STM32Cube HAL (Hardware Abstraction Layer): This project is built using the STM32Cube HAL library, which provides a high-level abstraction layer for STM32 peripherals and middleware components.
-
Clone this repository to your local machine or download the source code.
-
Open the project in your STM32CubeIDE.
-
Configure the necessary UART parameters (baud rate, parity, stop bits, etc.) to establish communication between the STM32 microcontroller and the SIM900 module.
-
Adjust the MQTT broker settings, such as the broker address, port number (default : 1883) , authentication credentials, and topic subscriptions, as per your requirements.
-
Build the project and flash it onto your STM32 microcontroller.
-
Connect the SIM900 module to the microcontroller and power it up.
-
Monitor the debug output or LED indicators on your microcontroller board to track the MQTT connection status and message exchange.
Contributions to this project are welcome. If you find any issues or have suggestions for improvements, please feel free to submit a pull request or open an issue on the GitHub repository.
This project is licensed under the Creative Commons Zero v1.0 Universal License. Feel free to use and modify the code according to your needs.