Send Battery Level notifications to nRF Connect app when battery level reaches certain level

Hello,
I am new to BLE and I need help with Battery Service notifications. I am using nrf52840dk, nrf sdk 17.1.0 and I am using ble_app_proximity example which already uses Battery Service.
I need to send a pop up notification from device to nRF Connect mobile app when battery level reaches 40%. Whenever battery level reaches 40%, a notification should pop up telling us that battery level has reached 40% please charge.

Can anyone please help me with this?

Thanks,
Kanthi Deep.

Parents
  • Hello Kanthi Deep,

    Can anyone please help me with this?

    Absolutely, you've come to the right place! :) 

    I am new to BLE and I need help with Battery Service notifications. I am using nrf52840dk, nrf sdk 17.1.0 and I am using ble_app_proximity example which already uses Battery Service.
    I need to send a pop up notification from device to nRF Connect mobile app when battery level reaches 40%. Whenever battery level reaches 40%, a notification should pop up telling us that battery level has reached 40% please charge.

    In the default ble_app_proximity application the battery notification will be sent as part of the handling for the NRF_DRV_SAADC_EVT_DONE event, through the call to ble_bas_battery_level_update. If you would only like it to update when it is 40% or lower you will need to implement a check or conditional here that verifies that the condition is met before the notification is sent.
    You could probably also reduce the sampling rate to be much more seldom before you are at < 40% for the first time, to conserve power, for instance.

    Best regards,
    Karl

  • Hello Karl,
    Thank you for replying so fast.
    I have a doubt about the function that you mentioned ble_bas_battery_level_update I thought it will just update the battery level in the app, but I need a pop up notification on the screen when the battery level is 40% like the one you receive on your phone when it is 20%.

    Thanks,
    Kanthi Deep.

  • I do not think so, unfortunately.
    However, if you were to create your own smartphone application you could easily add this as a feature based on the received BAS notification.

    Best regards,
    Karl

  • Oh ok, so it is not possible for nRF Connect.

    Sorry to keep bothering you but suppose I have new smartphone application which has that ability then what changes should I make in the ble_app_proximity code so that my condition is met?

    Thanks,
    Kanthi Deep.

  • Kanthi Deep said:
    Oh ok, so it is not possible for nRF Connect.

    Unfortunately not, no.

    Kanthi Deep said:
    Sorry to keep bothering you but suppose I have new smartphone application which has that ability then what changes should I make in the ble_app_proximity code so that my condition is met?

    No need to apologize! :) 

    In this case you should not have to make any changes to the ble_app_proximity application - it will keep sending its BAS notification after each sampling.
    However, for a real life application I would recommend that you modify the sampling interval for the time before you hit 40%, since you are not really interested in this section it seems. Reducing the unnecessary samplings will reduce your overall current consumption.

    Best regards,
    Karl

  • Okay Karl, I will try what you have mentioned.
    Thank you so much for your helpBowBow

    Thanks,
    K.Kanthi Deep.

  • No problem at all, Kanthi Deep - I am happy to help! :) 

    Please do not hesitate to ask if you should have any follow-up questions, or open another ticket if the subject diverges from the original issue in this ticket.

    Good luck with your development! :) 

    Best regards,
    Karl

Reply Children
No Data
Related