MQTT connection over BLE

Are there any examples showing use of the MQTT library using Bluetooth as the Link Layer? I see this on Zephyr's repo zephyr/subsys/net/l2/bluetooth at main · zephyrproject-rtos/zephyr (github.com). But struggling to see any way to "plug it in" to where it needs to go.

  • Hi,

    What exactly is it that you are trying to achieve? Why do you want to send MQTT over BLE?

    Best regards,

    Didrik

  • The use case is a device (nRF9160 with a nRF52820 on the same board, split BLE Host/Controller) that normally sends and receives data via MQTT to AWS IoT core over the LTE link. However, some customers are using the device in an area with poor cell coverage or internationally and we don't have a SIM card that works in all countries. In the cell denied case, we sell gateways that provide Internet connectivity with BLE being the link between device and gateway. All the data ends up at IoT Core, and the gateway is a dumb forwarder and has no use for the data it's receiving. I'm trying to reduce the amount of code I'm writing because I'm having to make all these BLE services and do translations on the gateway side in order for the gateway to send the device data to IoT Core correctly. It'd be nice to open an MQTT over the BLE link, send the data I need, and disconnect. Is this feasible?

  • You could try to look into CONFIG_NET_L2_BT.

    But I have a suspicion that having the gateway do the translation from BLE to MQTT will be easier, than trying to send IP over BLE. While it is technically possible, it was never widely adopted.

  • Gotcha, I'll take your advice. Was it not adopted due to the high amount of overhead being sent over the link?

  • I am not sure exactly why it never was widely adopted. Part of it might be that it required IPv6 support, before IPv6 was widely supported. Also, the lack of support in normal WiFi routers meant that everyone who wanted to use it had to also develop their own gateways.

    So it was probably a combination of several things. A chicken and egg problem with no devices using it, therefore no demands for routers that support it; and because of no routers that supported it, no devices that used it. No one with a really good use case for smaller devices connected directly to the internet, and bigger devices could use Wi-Fi. These days we have Thread and Wi-Fi 6. Etc.

Related