This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

If I want to read the battery level, can I just use ADC?

I would like to send the current status of the battery as a beacon.

ADC and a few resistors and what do I need?

I am currently using nrf51822.

I know nrf51822 to support the 10bit ADC.

Just supply the + and - connections on the battery level nrf51822 Can I read?

And do I need additional hardware is what?

And do I need additional software (Source) is what?

  • If Your battery is directly connected to nrf51822 as power source, You can just set CONFIG.INPSEL register to set VDD (with 1/3 or 2/3 voltage division) as ADC source. If You are using newest SDK, You can find ADC driver there which could be helpful.

  • Thank you. I am using the nrf51_sdk_v6_1_0_b2ec2e6. Do I need to use a higher version than the SDK? um .. Are you saying newest SDK is higher than I use?

  • I don't know if SDK7 does provide ADC driver, but SDK8 which i am using right now does for sure.

    What You can do is:

    • change SDK
    • write ADC driver by yourself (not a big deal, with nrf51 reference manual it is quite easy)
    • just download newer SDK and copy existing ADC driver implementation and use it in Your project
  • Hi

    You can find the most recent SDKs here
    You can find many ADC examples here, with and without softdevice.
    There is also an ADC example in the latest nRF51 SDK 8.0.0

    Update 23.3.2015 As I understand your comments, you want to continue to advertise beacons, but want to include battery level information in your advertising packet, am I correct?

    I am a little confused if you intend to make your device iBeacon compatible, or you just wish to broadcast proprietary data. To make the Beacon kit compliant with iBeacon, look at this blog. If you include battery level information in your beacon packet, it can not be compatible with iBeacon.

    A beacon is a non-connectable advertising packet with a 31 byte payload. The payload of a BLE advertising packet is maximum 31, so there is no room for any additional information in the packet. To include the battery level information, I suspect you need to do one of the following:

    • Replace some of the information in the advertising packet with the battery level information
    • Include the battery level information in a scan response packet. The central device would need to perform a scan request to receive the battery information data
    • Advertise iBeacon data, stop advertising, reconfigure advertising with custom data, start advertising custom data, stop advertising, reconfigure advertising with iBeacon data, advertise iBeacon data
  • Thank you for reply.

    Hi, I saw ble_app_beacon example and ble_app_hrs example.

    I both know the source of the beacon role.

    In my opinion ble_app_hrs, the service was used ble_app_beacon has not been used by the service.

    My idea is that correct?

    And it is curious.

    ble_app_hrs provides battery service.

    However, there is no part that reads the ADC value.

    When I saw the other posts, they spoke him/her using the ADC.

    But I know that if the beacon, depending on the value of the UUID, Major and Minor device segment.

    I will continue to make a device that broadcasts the data as a beacon. (Remaining battery level, Rssi, Txpower) and If I want to make a search with my smartphone to be immediately read the data.

    Can you give me an example of recommendation?

    And I'm sorry,Can you give advice about my development?

Related