Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to add Battery as a service in advertisement packet?

Hello,

I am running the ble_app_beacon example and want to add battery percentage in the advertising packets, how to do that. And is it possible for ble_app_beacon example to broadcast once every 5 mins i.e it will broadcast then it should go to sleep then after 5 mins it again starts broadcasting.

Parents
  • Hi,

    You can use the ADC to measure the battery voltage. Depending on your battery type you can measure Vdd directly or, if Vdd is higher than 3.6 V, use an external voltage divider to scale the input voltage down to a safe level. Then you can add the ADC value to the Manufacturer Specific Data field in the advertising packet. 

    You can use the app_timer library for example, to set up a timer that makes your device broadcast every 5 minutes. 

Reply
  • Hi,

    You can use the ADC to measure the battery voltage. Depending on your battery type you can measure Vdd directly or, if Vdd is higher than 3.6 V, use an external voltage divider to scale the input voltage down to a safe level. Then you can add the ADC value to the Manufacturer Specific Data field in the advertising packet. 

    You can use the app_timer library for example, to set up a timer that makes your device broadcast every 5 minutes. 

Children
Related