This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Broadcaster or Peripheral? Which should I use?

Expert 1595 points

I am working on a project where I need to send a notification to my phone when a push button is pressed on the bluetooth device. Its basically what the keyfob is doing. I thought of two ways to do this but I don't know which is most efficient and battery saving on both the bluetooth device and on the phone.

Method 1: Bluetooth device as a peripheral and the phone connects to it and subscribe to notifications via the GATT service. In this case, the phone needs to maintain the connection all the time. 

Method 2: Bluetooth device as a broadcaster (something like ibeacons). Basically when the button is pressed, the bluetooth device broadcast for 5 seconds and stops after that. Waiting for another button press. On the phone side, it scans on a very regular interval (scan for 1 sec, sleep for 4 secs and repeat).

I am not sure if a permanent bluetooth connection on the phone or constant scanning consumes more battery on the phone. Anyone has any thoughts on this?

  • In advertising, you are encouraged to send packets on all 3 advertising channels, a connection only uses one. x3  the packets, x3 the power. You can only advertise on one channel, but that decreases your chances of being discovered.

    You could also decrease the advertising interval to save power. Suppose you set the advertising interval to once every 4 seconds; If your scanning device just happens to miss 2 packets, you now have to wait 12 seconds for a response. The lag is a combination of how often you advertise, what channels you advertise on, and how often the phone scans.

    The big positive aspect of the method 1 is that the broadcasting device can be in PM3 (lowest power mode) until the button is pressed.

    In a connection, there are mandatory handshaking packets that must occur at least every 16 seconds.  Also, this requires you to stay in PM2 (not a huge deal, 1uA extra). 

    From the phone's perspective, I think maintaining a constant connection is more efficient than scanning all the time. If the app kills my phone after 5 hours I'd be upset

  • I think method 2 is the way to go for my application. Like you mentioned, I don't want to kill the phone in a few hours.

    Though not important at this stage, the problem with method 2 is that I cannot have multiple phones listening to a single bluetooth device. Once a connection is established, other phones cannot discover that device anymore. Is that right?

  • No, other phones can discover a connected peripheral. A peripheral may still advertise while in a connection, but they have to be non-connectable advertisements because a slave can only have one master (and therefor only one connection). It would be a combination of the methods. 

  • Agreeing with Peter. It depends on how critical your requirement is.

    If you can afford to miss the advertisement that comes at every 5 seconds, I think it is better to go with Method 2. As it requires less power compared to Method 1.

    And if you can't afford it, you should go with Method 1. 

    In any of the method you may consider to reduce the transmission power based on your application. Please note, that reducing the transmission power will also affect the range of BLE.

    Hope this helps!!

  • Dhaval,

    I don't understand when you say I can afford to miss the advertisement that comes every 5 seconds. For example, like in the keyfob, I can press a button to start advertising for 5 secs. Within this 5 seconds, my phone will connect to the keyfob and start registering from notifications from the GATT service. Once the connection is established, the phone will be guaranteed to receive the push button status right? The keyfob no longer needs to broadcast if I am just interested in a 1-1 connection.

  • Hi Kian,

    In method2, you are broadcasting data within Advertising Packets. And if the central device is not in scanning mode when the broadcaster is enable then it won't be able to get the missed packets. And it has to wait for the next advertising, 5 seconds in your case.

    Thanks,

    Dhaval