In a current project we have a nRF52 Bluetooth application where the Central communicates directly with a Peripheral (also nRF52). The nRF5 SKD V14.0.0 or newer is used for this.
The application is now extended with a cloud connection (Azure IoT). To achieve this, a Wifi module is to be used with the Bluetooth Central, which can be controlled with AT commands.
It is a standard Wifi module to be used which has the TCP/IP stack and encryption already included. The MQTT application layer is to be implemented on the nRF52 (host controller), which then sends the commands to the Wifi module via UART interface (AT commands).
There are, in my view, the following approaches:
- use the MQTT libraries from Nordic and adapt the transport layer for AT commands over UART
- Paho MQTT
- Azure IoT SDK C client
- others ?
What is the best or most efficient apporach to it? E.g. if I look on the requirements for Azure IoT SDK Client they are too high for the nRF52.
Are there any examples for an MQTT application that provides communication to a external module (Wifi, GPRS...) through an interface (UART, SPI...)?
Hello Siebesiech, Can you please elaborate on what WiFi module you are using? Usually, the nRF52 would send data to the WiFi module which handles the MQTT layer, of course, if you're using e.g. ESP32. Have a look at the MQTT chapter in our SDK, and the examples on MQTT subscriber and MQTT publisher.
use the MQTT libraries from Nordic and adapt the transport layer for AT commands over UART
If the examples are sufficient for you, then I see no reason why your first approach can't be used.Kind regards,Øyvind
Øyvind said:Can you please elaborate on what WiFi module you are using?
At the moment it is not defined which module is used. However to be more flexible (for example, when choosing the Wifi module) it is planned to use a module which has not implemented the MQTT layer.
Øyvind said:If the examples are sufficient for you, then I see no reason why your first approach can't be used.
I have to take a closer look at this example. As I have seen, the communication is implemented via Bluetooth and thus via a Bluetooth router. Therefore I have to analyze which parts are not needed as they are made by the module (e.g. encryption).
So it would help me and also save time if I could build on an example where this transport layer was adapted to a UART. This does not have to be complete, but can only be a small part of it. Do you know such an example?
The only example I know of it the Simple MQTT for the nRF9160, a fully integrated SiP for cellular IoT with built-in GPS. Have you considered this device instead? Our forum does have some similar questions, e.g. this thread