|
| 1 | +.. _npm2100_fuel_gauge: |
| 2 | + |
| 3 | +nPM2100: Fuel gauge |
| 4 | +################### |
| 5 | + |
| 6 | +.. contents:: |
| 7 | + :local: |
| 8 | + :depth: 2 |
| 9 | + |
| 10 | +The fuel gauge sample demonstrates how to calculate the state of charge of a supported primary cell battery using `nPM2100 <nPM2100 product website_>`_ and the :ref:`nrfxlib:nrf_fuel_gauge`. |
| 11 | + |
| 12 | +For more information about fuel gauging, see `Using the nPM1300 Fuel Gauge`_. |
| 13 | + |
| 14 | +Requirements |
| 15 | +************ |
| 16 | + |
| 17 | +The sample supports the following development kits: |
| 18 | + |
| 19 | +.. table-from-sample-yaml:: |
| 20 | + |
| 21 | +The sample also requires an `nPM2100 EK <nPM2100 EK product page_>`_ that you need to connect to the development kit as described in `Wiring`_. |
| 22 | + |
| 23 | +Overview |
| 24 | +******** |
| 25 | + |
| 26 | +This sample allows the calculation of state of charge from a battery connected to the nPM2100 PMIC. |
| 27 | + |
| 28 | +Battery models for Alkaline AA, AA, LR44, and Lithium-manganese dioxide coin cell CR2032 batteries are included. The active battery model can be changed using a shell command, as illustrated in `Testing`_. |
| 29 | + |
| 30 | +Wiring |
| 31 | +****** |
| 32 | + |
| 33 | +Note that the nPM2100 EK is here configured to supply power to your DK. |
| 34 | +In order prevent leakage currents and to continue being able to program the DK, do not remove the DK USB connection. |
| 35 | + |
| 36 | +The following preparations should be made to the DK in order to power the nRF5x SoC from nPM2100 EK: |
| 37 | + |
| 38 | +#. nRF52840 DK: |
| 39 | + |
| 40 | + * Set switch **SW9** ("nRF power source") to position "VDD". |
| 41 | + * Set switch **SW10** ("VEXT -> VnRF") to position "ON". |
| 42 | + |
| 43 | +#. nRF5340 DK: |
| 44 | + |
| 45 | + * Set switch **SW9** ("nRF power source") to position "VDD". |
| 46 | + * Set switch **SW10** ("VEXT -> VnRF") to position "ON". |
| 47 | + |
| 48 | + |
| 49 | +#. nRF54L15 DK: |
| 50 | + |
| 51 | + * Remove jumper from **P6** ("VDDM CURRENT MEASURE"). |
| 52 | + |
| 53 | +#. Connect the TWI interface and power supply between the chosen DK and the nPM2100 EK as described in the following table: |
| 54 | + |
| 55 | + .. list-table:: nPM2100 EK connections. |
| 56 | + :widths: auto |
| 57 | + :header-rows: 1 |
| 58 | + |
| 59 | + * - nPM2100 EK pins |
| 60 | + - nRF52840 DK pins |
| 61 | + - nRF5340 DK pins |
| 62 | + - nRF54L15 DK pins |
| 63 | + * - SDA |
| 64 | + - P0.26 |
| 65 | + - P1.02 |
| 66 | + - P1.11 |
| 67 | + * - SCL |
| 68 | + - P0.27 |
| 69 | + - P1.03 |
| 70 | + - P1.12 |
| 71 | + * - VOUT |
| 72 | + - P21 External supply |
| 73 | + - P21 External supply |
| 74 | + - P6 VDDM current measure, middle pin |
| 75 | + * - GND |
| 76 | + - GND |
| 77 | + - GND |
| 78 | + - GND |
| 79 | + |
| 80 | +#. Make the following connections on the nPM2100 EK: |
| 81 | + |
| 82 | + * Remove the USB power supply from the **J4** connector. |
| 83 | + * On the **P6** pin header, connect pins 1 and 2 with a jumper. |
| 84 | + * On the **BOOTMON** pin header, select **OFF** with a jumper. |
| 85 | + * On the **VSET** pin header, select **3.0V** with a jumper. |
| 86 | + * On the **VBAT SEL** pin header, select **VBAT** with a jumper. |
| 87 | + * Connect a battery board to the **BATTERY INPUT** connector. |
| 88 | + |
| 89 | +Building and running |
| 90 | +******************** |
| 91 | + |
| 92 | +.. |sample path| replace:: :file:`samples/pmic/native/npm1300_one_button` |
| 93 | + |
| 94 | +.. include:: /includes/build_and_run.txt |
| 95 | + |
| 96 | + |
| 97 | +Testing |
| 98 | +******* |
| 99 | + |
| 100 | +|test_sample| |
| 101 | + |
| 102 | +#. |connect_kit| |
| 103 | +#. |connect_terminal| |
| 104 | + |
| 105 | +If the initialization was successful, the terminal displays the following message with status information: |
| 106 | + |
| 107 | +.. code-block:: console |
| 108 | +
|
| 109 | + PMIC device ok |
| 110 | + V: 1.5, T: 23.06, SoC: 90.00 |
| 111 | + nRF Fuel Gauge version: 1.0.0 |
| 112 | + Fuel gauge initialised for Alkaline AA battery. |
| 113 | + V: 1.188, T: 20.62, SoC: 25.00 |
| 114 | +
|
| 115 | +.. _table:: |
| 116 | + :widths: auto |
| 117 | + |
| 118 | + ====== =============== ================================================== |
| 119 | + Symbol Description Units |
| 120 | + ====== =============== ================================================== |
| 121 | + V Battery voltage Volts |
| 122 | + T Temperature Degrees C |
| 123 | + SoC State of Charge Percent |
| 124 | + ====== =============== ================================================== |
| 125 | + |
| 126 | +The active battery type can be determined by using the following shell command: |
| 127 | + |
| 128 | +.. code-block:: console |
| 129 | +
|
| 130 | + $ battery_model |
| 131 | + Battery model: Alkaline AA |
| 132 | +
|
| 133 | +The same shell command can be used to change the active battery type: |
| 134 | + |
| 135 | +.. code-block:: console |
| 136 | +
|
| 137 | + $ battery_model Lithium_CR2032 |
| 138 | + Fuel gauge initialised for Lithium CR2032 battery. |
| 139 | +
|
| 140 | +Dependencies |
| 141 | +************ |
| 142 | + |
| 143 | +The sample uses the following `sdk-nrfxlib`_ library: |
| 144 | + |
| 145 | +* :ref:`nrfxlib:nrf_fuel_gauge` |
| 146 | + |
| 147 | +In addition, it uses the following Zephyr libraries: |
| 148 | + |
| 149 | +* :ref:`zephyr:logging_api` |
| 150 | +* :ref:`zephyr:shell_api` |
0 commit comments