In the second part of this article series, we discussed BLE GAP roles, possible states in each of the roles and how to optimise power consumption in the advertising state.
In this part, we will talk how to optimise power consumption in scanning and initiating states.
Power optimisation in the scanning state
Scanning state is used by observer devices who listen to the advertising packets. So, power optimisation in scanning state is the key to saving power in observer devices. Power consumption in scanning state depends on the ratio of scanning window to scanning interval, duplicate filtering, whitelist and receiver gain.
The device consumes radio current continuously during the scanning window. As discussed in the first part of the series, continuous current of high magnitude reduces battery capacity significantly and hence shall be looked into more carefully in such designs. Devices with small scanning window to scanning interval ratio (with small scanning window values) consume less average current. But, it also reduces the chances of receiving an advertisement packet quickly. So, this parameter shall be selected appropriately based on the application.
Let us take an example where the observer is intended to receive sensor data from a wireless sensor node that is broadcasting measured data. Wireless sensor node usually reads the data from sensors at fixed intervals and advertise the data once in all advertising channels. Let’s say the advertising interval is ‘x’ milliseconds. Whenever device reads the sensor data, it updates the advertising packet. To receive the advertising packets from this wireless sensor node, observer’s scanning window, wireless sensor node’s advertising event and the channel number of both must overlap. To reduce the power consumption on the observer side, the device has to be configured in such a way that scanning window is shortened and also gets aligned with the advertising event.
After power ON, scanning window may not be aligned with the advertising event. To get advertisement packet quickly for the first time, set a large scanning window that increases the chances of receiving advertising packet (Figure 1). Once observer receives the advertising packet for the very first time from the broadcaster, stop scanning and restart the scanning after ‘x-y’ millisecond where ‘y’ is around 1 milliseconds (‘y’ is the time required for the device to start scanning window when start scanning command is issued from application). Set scanning window to ’13+y’ milliseconds (to accommodate adv random delay of 10 milliseconds and time taken to advertise in all channels in an advertising event) and set the scanning interval to ‘x-y’ milliseconds as shown in Figure 1. Though the scanning window is set to ‘13+y’ milliseconds, once the advertisement packet is received, scanning shall be stopped immediately and restarted after ‘x-y’ milliseconds. This helps to reduce the scanning window and current consumption.
Figure 1: Aligning scan window with advertising event after power on
Every time observer receives an advertising packet, it shall follow the same process as explained above. In case observer fails to receive an advertising packet during any scan interval, scanning window shall be increased by 10 milliseconds in every consecutive interval until it receives an advertising packet or scanning window reaches the limit set by the application (Figure 2). This example assumes application know when scanning window is over so that scanning can be stopped and restarted with updated scanning window and timings can be maintained to receive advertising packet in next scanning interval. If the application doesn’t know when scanning window ends then restart scanning with initial scanning window and scanning interval values instead of increasing scanning window size as shown in Figure 2.
Figure 2: Adjusting scanning window after missed advertisement packet
However, the above method will not work if the observer has to receive sensor data from more than one broadcaster. To receive advertisement packets from multiple broadcasters, a time synchronisation mechanism shall be implemented between all the broadcasters and the observer. This is to help the broadcasters to avoid packet collision and let the observer receive a packet from each device without fail. The observer can start scanning few milliseconds before the time at which a particular broadcaster will advertise. Time synchronisation can be done by either broadcasting the current time stamp from one of the devices and all other devices get synchronised by receiving the current stamp in the broadcasted packet and updates the local timer or establishing a connection with the peer device which is used for synchronising the local time after connection. However, connection based method is a time and power consuming method. This time synchronisation has to be done regularly to avoid the drifts due to clock inaccuracies. To implement time synchronisation method, senor nodes/broadcasters should be capable of either acting as observers and broadcasters or peripherals to establish connections.
The above suggestions are under the assumptions that advertising interval is known. For applications where system designer doesn’t have control over broadcasters, values of scan windows and scanning interval based on your power budget and how quickly you want to get the packet.
Duplicate filtering and whitelist features can help saving some power in observer devices. Duplicate filtering filters duplicate advertisement packets for application layer which helps in reducing CPU processing time. Whitelist helps in filtering devices from which device does not want to receive advertising packet. So, if a device is not in the whitelist, application layer does not need to be involved. In Bluetooth Low Energy v4.2 the resolving list is maintained in the link layer that is used to resolve Resolvable Private Addresses (RPA) and hence can resolve and filtered RPA as well at the link layer and hence save more power.
Receiver gain directly impacts peak and average power during scanning state and is the most important parameter to be tuned while optimising power consumption in scanning state Most BLE devices allow to select receiver gain that in turn determines receiver sensitivity and hence gain. If a broadcaster is in close proximity to the observer or transmitting at high power, receiver gain can be set to minimum to save power.
Power optimisation in Initiating state
The initiating state is used by a central device to scan for a particular peripheral device and establish a connection. Current consumption during an initiating state in a central device is similar to scanning state in the observer. However, a central device is in the initiating state for a very small period of time compared to scanning state in an observer. The ratio of scanning window to scanning interval should be higher to quickly get and advertisement packets and send a connection request. One can set scan window as following:
Scan window = scan interval = advertising interval+10 ms
It helps in establishing the connection faster. But this approach doesn’t help in reducing current if advertising interval of the peripheral is large. Current consumption during initiating state depends on advertising interval and type of advertisement as well. If the peripheral is doing high duty cycle directed advertisement, central can receive the advertisement packets quickly that helps in reducing time to establish a connection and current consumption during initiating state. If a central device is able to receive first advertisement packet and send connection request quickly, it helps reducing peripheral’s power consumption as well. So, if the central device operates on a rechargeable battery or wall powered and can afford a higher power consumption, it is better to keep high scanning window to scanning interval ratio to help reduce power consumption at peripheral side.
Similar to scanning state, receiver gain effects the current consumption by radio during initiating state. So, receiver gain shall be selected based on peripheral’s proximity and transmit power.
In a nutshell, to optimise power consumption in scanning and initiating states, receiver gain shall be set to the minimum possible if allowed by the device and application. Appropriate selection of scanning interval and scanning window to scanning interval ratio are key to decide power consumption in these two states. Duplicate filtering, whitelist, resolving list is also very useful in optimising power in scanning states
In part 4 of this series, we will talk about power optimisation in connection state.