When we think of multiple Bluetooth connections, we primarily think of a mobile phone with a bunch of things connected to it. The biggest trend in the Bluetooth market for phones is this idea of a wearable. These wearables are items such as watches, fitness trackers, headphones, and even cufflinks!
But what if you had a device that you wanted to connect to multiple phones at the same time?
A customer approached us with a product need to control their hardware (which we’ll call “the hardware” in the rest of this article) via multiple phones simultaneously while still allowing for internet connection with the phones, independent from the local interface between the phone and the device. Is this feasible? The assumed solution was Bluetooth.
DornerWorks has worked on several IoT projects in the past, but multiple concurrent Bluetooth connections with phones was a new use case.
DornerWorks first explored other possible solutions with the customer to ensure that multiple Bluetooth connections were the proper solution to the problem. The hardware would not be installed in something with internet access, so this ruled out using a solution based on a web service. Such a solution would have multiple phones connected to a web service, and the web service would send/receive data to the hardware through an internet connection.
Another possible solution was to use WiFi. This solution would make the hardware act as a WiFi router. The trouble with this solution is that smartphones assume that the WiFi network is the internet source for the phone when connected to a WiFi network. Since the hardware is not assumed to be connected to the internet this solution would prevent users from controlling the hardware and being on the internet at the same time. This was not considered an acceptable solution.
Given that most phones only have Wifi, Bluetooth, and internet connection capabilities, other wireless technologies were not an option either. The solution had to be Bluetooth, and it had to maintain 6 concurrent connections with mobile devices.
Bluetooth Low Energy (Bluetooth 4.x) has been around since 2010. The Bluetooth Specification has some terms that are relevant to the solution, so we should define them now. This is a bit oversimplified; however, it will serve well for the purposes of this discussion.
In Bluetooth 4.0, a peripheral device can advertise data, set desired connection parameters, and provide services. A peripheral cannot initiate a connection; it can only advertise itself as connectable. This is commonly referred to as the “slave” device. Common peripherals include smartwatches, headphones, and Bluetooth beacons. In Bluetooth 4.0, a “slave” can only have one “master”.
A central device is the “master”. The central is responsible for scanning for connectable peripherals, establishing a connection with the peripheral, discovery of the services provided by the peripheral, and managing that connection. In Bluetooth 4.0, a “master” can have multiple slaves. The most common “central” device is a mobile phone.
Phones have been able to connect multiple assets at the same time since the beginning of Bluetooth. So multiple connections via Bluetooth must be possible, right?
Remember that a peripheral cannot have multiple masters. This means that the phones must act as a peripheral, and the hardware must act as a central device in order to maintain 6 concurrent Bluetooth connections.
The solution was to have the hardware take the central role and scan for connectable phones.
The phone and the hardware device would both simultaneously be a central and a peripheral. It was possible for the phone to be near several pieces of the same hardware, so custom connection logic was needed. The hardware would advertise to tell the phone how to connect. The phone would read this advertising packet and then advertise what the hardware was expecting. The hardware would initiate the pairing process with phones that were advertising this custom packet.
After the connections were established, the hardware maintained concurrency between the connected phones. The majority of the work for this project was on the connection management and data management side of the central device.
Yes! The hardware is able to simultaneously maintain 6 connections with phones of different types. The user is able to use an application to scan for the hardware, “connect” to it and send/receive data. This solution provides the ability to maintain multiple connections to phones without the need for costly web services that require your hardware to have an internet connection. This solution also allows the user’s phone to stream Netflix via WiFi or 4G and still control the hardware.
Unfortunately, it seems like the Bluetooth peripheral mode functionality in the mobile phone market is not tested thoroughly enough. Older phones simply do not support peripheral mode, and the performance of peripheral mode from manufacturer to manufacturer is inconsistent. Now, more and more companies are coming out with applications that utilize peripheral mode (virtual beacons for example). Hopefully, the rise in peripheral mode usage on the mobile phone will encourage more thorough testing, helping the concurrent Bluetooth connection solution be more robust.