8 years, 8 months ago.

How to lower power consumption?

Hello, I run the BLE_Button example on an nRF51822 and I get the following readings: - On advertisment = 0.65 uA (no button pressed) with some spikes in power consumption due to advertisment. - On connection = 150-200 uA (no button pressed)

My question is: how can I reduce the power consumption when the device is connected to the bare minimum? This would mean to just maintain the communication channel open and inform the central device that the button has been pressed. Is it possible to achieve?

I have tried by reducing the latency but I did not get any changes. Maybe I need to change something on the Android application? Should these parameters be changed before starting the advertisement or when the device has been connected?

	Gap::ConnectionParams_t new_params;

	ble.gap().getPreferredConnectionParams(&new_params);

	new_params.minConnectionInterval = BLE_GAP_CP_MIN_CONN_INTVL_MAX;
	new_params.maxConnectionInterval = BLE_GAP_CP_MAX_CONN_INTVL_MAX;
	new_params.slaveLatency = BLE_GAP_CP_SLAVE_LATENCY_MAX;
	new_params.connectionSupervisionTimeout = BLE_GAP_CP_CONN_SUP_TIMEOUT_MAX;

	ble.gap().setPreferredConnectionParams(&new_params);

Thank you very much!

Question relating to:

A template for applications where some small amount of data needs to be notified to a phone app over BLE. It is a good starting point for notifications.

Thanks to Eirik and Rohit for the answers. I had also posted this question in the Nordic Developer Zone and I managed to fix it with Petter Myhre's help in this thread. As you all pointed out, the problem were the connections parameters. Android does not have an API for controlling this until API 21 (Lollipop) but it's not necessary. If the peripheral tells the central to update the paramters it works fine. Pushing the limits, the parameters I used are the ones in the code below. However, I strongly recommend reading this answer from Petter as the limits could not be a good idea due to clock drifts.

void connectionCallback(const Gap::ConnectionCallbackParams_t *params)
{
    Gap::Handle_t gap_handle = params->handle;
    Gap::ConnectionParams_t new_params;


    new_params.minConnectionInterval = 400; /* 500 msec */
    new_params.maxConnectionInterval = 420; /* 525 msec */
    new_params.connectionSupervisionTimeout = 3200; /* 32 seconds */
    new_params.slaveLatency = 29;
    ble.gap().updateConnectionParams(gap_handle, &new_params);
}


int main(void)
{
    ble.init();
    ble.gap().onConnection(connectionCallback);
    ...
}
posted by Sebastián Pastor 30 Jul 2015

2 Answers

8 years, 8 months ago.

Yes, its the Central that's governing the connection interval; although connection latency means something else and increasing the connection latency would be a good thing for reducing power consumption.

I looked for a while but could not find any Android APIs to affect connection latency; but I did not look too hard. Could you use a BLE medium sniffer to establish the connection interval your devices are actually using?

Accepted Answer

Thanks for answering Rohit. Unfortunately, I don't have a BLE sniffer :( I have looked and found little regarding how to control the connection parameters from Android. But I did find the "requestConnectionPriority()" method that sets the connection priority to balanced, high or low power. It does sound fine, but it's implemented in API level 21 (Lollipop) and I don't have a device with that version right now so I can't try it.

posted by Sebastián Pastor 24 Jul 2015
8 years, 8 months ago.

Reducing the latency would mean more frequent connection events, and so the power consumption will increase. So you have to do it the other way round.

You can set a higher slave latency, and ask for a higher connection interval. Note the "ask for"; It is the Central role (the phone) that decides these parameters, the peripheral can only state its preferences.

Thanks for your answer Eirik. I did try with both max and min slave latency with the same result. I guess that the Central is not changing it. Could you please tell me what would be the power consumption profile I can expect from a device when it's connected? Do you have a better example from which I can start over?

posted by Sebastián Pastor 24 Jul 2015