2

I have a device that connects using Bluetooth Low Energy (BLE). I want it to communicate with a server over the internet using a smartphone as a gateway.

I have thought of different approaches and I would appreciate any objective input.

Approach 1

Write a smartphone app that processes data between the internet and Bluetooth. Data coming from the server would get sent over Bluetooth Low Energy to the device. Data coming from the device would be sent over to the server.

Since the smartphone is a gateway, it does not know where to send that data to over IP because the device may want to communicate with one of many servers. So the device would need to specify the address and other information along with the payload when sending it.

On the other hand, the server would have to somehow specify the device outside of the message payload. So the IP communication terminates at the smartphone. There can be more than one device connected to the smartphone. So this adds some overhead. We also have to take into account the speed of the transport medium, so some sort of buffer would have to be used.

Approach 2

Implement a simplified form of TCP/IP protocol over Bluetooth on the device. I am considering the MQTT protocol. In this case, I assume the device would have its own IP address so the server can directly address it. With this approach, the protocol is all TCP/IP end to end, but the transport medium is the same as before. Of course, this will significantly increase the code in the device.

I would appreciate input on which is the better design approach based on best practice and design trade-offs.

PeterJames
  • 127
  • 1
  • 1
  • 5

1 Answers1

0

A smartphone is likely to have a dynamically allocated and probably private IP address. That means that the server will not be able to initiate a connection to the smartphone.

This limitation almost immediately rules out Approach 2, because a device with a private IP address cannot act as an internet router to get the TCP packets from the server to the BLE device.

Approach 1 is more promising. But the fact that the smartphone is acting as a gateway does not mean it can't have knowledge of which server to communicate with and that can even be something that the user configures in the app. Also, the TCP/IP messages can contain additional information, like the BLE device being addressed, that is not forwarded to the BLE device.

The speed of the transport medium is in all cases something to account for.

Bart van Ingen Schenau
  • 71,712
  • 20
  • 110
  • 179