Battery Level Tutorial¶
This tutorial shows how to get the voltage of AA battery inserted in the Base Dock.
Requirements¶
- Base Dock Board
- nRF52832-MDK or nRF52840-MDK
- AA Battery
- Micro USB cable(for nRF52832-MDK), or Tpyc-C USB cable(for nRF52840-MDK)
How it works?¶
To get the battery voltage, a voltage divider circuit is connected to the battery. P0.04/AIN2
will be used to read out the voltage level. Here is the voltage divider circuit:
Build and Run the Example¶
The following steps show how to build and run the battery_level
example:
-
Navigate to the example directory:
# For nRF52832-MDK board $ cd ./base-dock/examples/batte_level/nrf52832_mdk/armgcc # For nRF52840-MDK board $ cd ./base-dock/examples/batte_level/nrf52840_mdk/armgcc
-
Connect nRF52832-MDK or nRF52840-MDK to your PC.
-
Build the example and flash to the board.
$ make flash_all
-
Start a terminal application like PuTTY or screen and establish a UART connection.
$ screen /dev/cu.usbmodem142310 115200
-
The battery voltage will be printed on the console.
Create an Issue¶
Interested in contributing to this project? Want to report a bug? Feel free to click here: