0

Advertising Battery levels on a beacon

Cbutler gravatar image

asked 2014-03-29 00:05:13 +0100

updated 2014-03-31 16:04:23 +0100

Hey folks,

I am currently trying to use my nrf51822 evaluation board as a beacon. This is working pretty well but I need to have it broadcast its current battery level as well. From what I have seen this means I need to make some kind of interrupt to tell the chip to update the advertising message. Could anyone point me in the direction of some information on this topic?

If it helps I am currently basing everything off of the ble_app_beacon example code and that works just fine.

-Chris

edit retag flag offensive close delete report spam

Comments

2 answers

Sort by » oldest newest most voted
0
olha gravatar image

answered 2014-03-31 11:59:28 +0100

updated 2014-03-31 16:04:23 +0100

This is actually implemented in the nrf51-ble-app-temp, available here, so I'd recommend you to take a look on it. In summary, it uses app_timer to trigger a periodic timeout, in which it uses the ADC to measure the battery level, and updates the advertisement data.

edit flag offensive delete publish link more

Comments

I'm not sure I understand your question, but is it covered by either of these? https://devzone.nordicsemi.com/index.php/using-adc-to-measure-battery-voltagehttps://devzone.nordicsemi.com/index.php/what-voltage-range-can-be-measured-with-the-adc In that example, the value that comes out of the ADC is converted to a value between 0 and 100 (0x64) and then sent over the air. Please note that I'd rather recommend using manufacturer specific data for this, instead of the service data used by the example. The reason the example uses service data is for backwards compatibility with earlier apps.

Ole Morten ( 2014-03-31 16:10:05 +0100 )editconvert to answer

Those links help a good bit. I am still struggling with how exactly the calculation works and how I can verify it. Testing my actual battery voltage gives me 3.0v outside of the circuit, testing it in the working circuit gives 2.85v, the ACD however gives 0x55( or 85%) out of 3.0v which would correspond to 2.55v. When using the devlopement board with USB power it reads 0x65 when the max voltage is set to 3.0v in the code. What would be causing this discrepancy?

Chris Butler ( 2014-03-31 21:24:09 +0100 )editconvert to answer

Ole Morten, your example(nrf51-ble-app-temp) is How does the search?

GunMin ( 2015-04-24 12:27:57 +0100 )editconvert to answer

Thanks Ole. Have you ported this to SDK 11 and softdevice 130?

Carlos Villavicencio ( 2017-02-18 00:40:48 +0100 )editconvert to answer
0
Cbutler gravatar image

answered 2014-03-31 16:06:24 +0100

bugg gravatar image

updated 2015-01-22 10:07:14 +0100

Thanks a lot, this is exactly what I needed. I do have one question though, what does the battery reading the ADC sends back correspond to?

edit flag offensive delete publish link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

Stats

Asked: 2014-03-29 00:05:13 +0100

Seen: 1,648 times

Last updated: mars 31 '14