cancel
Showing results for 
Search instead for 
Did you mean: 

Implement MQTT on STM32WB to communicate with the server.

AKetc
Associate III

Hi everyone,

I have made a custom board which has an on-board STM32WB Controller along with a 3G Modem to connect with the internet. On the internet, I have my custom Web Server where some parameters are present. I want to fetch those parameters from the web server and save them inside the Controller so that hardware can buzz at a specific time defined in those parameters. All the communication with server is supposed to occur over MQTT. However, I don't know how to get started. If someone can please guide me thoroughly. I'll be very thankful.

Warm Regards,

4 REPLIES 4
Remi QUINTIN
ST Employee

Let me refine your description to have a better understanding of what you are aiming to build.

MQTT/TCPIP/G3 connection to a remote web server on one side to get some parameters. Then a BLE connection as a BLE server (Peripheral) to send those parameter once a while to a BLE client (Central)... may be your mobile phone.

 If my view is correct, we do not have any example for the part related to the internet connection.

Then regarding the BLE connection, you can start with the BLE_p2pRouteur example but you will have to modify it to add your own service to send the parameters.

Or you can send them as data payload inside the advertising packets if the size is not too big.

The Client will have to perform a scan to get those data.

AKetc
Associate III

I have already done the part where we have to send BLE data to the client. I only require help in establishing connection with the web server via 3G Modem.

Remi QUINTIN
ST Employee

​Unfortunately we do not have any example have MQTT protocol over our TCP/IP stack.

There are some examples of TCP/IP connection in the L4 FW package. but this TCP/IP stack has not been used in any of our WB example. You will have to manage it yourself.

How do you connect the G3 modem to the STM32WB?

AKetc
Associate III

I have connected it via UART. I am thinking of implementing MQTT on 3G Modem by programming it using MircoPython since I checked and they have support available. Afterwards, I will have the 3G Modem communicate and send the data to MCU over UART. Thankyou very much for your help.