Measure coin cell voltage on nRF52840 DK

I'm trying to make a demo with nRF52840DK. And I want to power it using the coin cell. So I want to check the voltage (percentage) so that I can know how long can the device keep running without changing the battery.

I searched a little bit and I have a few questions:

  • I found a previous thread that solves the exact the same issue. Martin provided a demo ble_app_battery_service.7z in the thread.
    • I viewed the code and flashed the hex on my 52840DK board. But I don't know how to see the output. As I understand, the demo uses `nrf_drv_saadc_sample` to get the voltage and uses `NRF_LOG_INFO` to print it. I tried two ways: 1. open a serial console (in Putty, baudrate 115200, I think the port is correct) 2. use JLink and JLinkRTTClient. But from both I cannot see any output. How can I see the output?
    • I always connect my 52840DK to my PC using a USB cable (since I need to read the output from it). However, in this way, will the power source always be the USB instead of the coin cell? As I read the doc, turn the power source to 'VDD', and the coin cell will be used when there is no USB. How can we force the power source to be the coin cell (or make sure we are measuring the coin cell's voltage)
  • The previous thread was a long ago (4 years). Is it still the best way to do so for my requirement? Is there any better choice. I recently set up the environment (include nRF Connect SDK and VSCode) following the tutorials. But I don't see find a good sample for my requirement. Is there a good sample for that?

Thanks!

Parents Reply Children
No Data
Related