samples/boards/nrf/battery/README.html · samples/boards/nrf/battery/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Boards · Nordic ADC

Nordic Battery Voltage Measurement

Devicetree ADC 경로와 battery별 discharge curve를 사용해 5초마다 상태를 출력합니다.

Official pathsamples/boards/nrf/battery/README.html
Source filesamples/boards/nrf/battery/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

/vbatt, zephyr,user, regulator 오차와 LiPo·alkaline curve 차이를 설명합니다.

Path 1

/vbatt voltage-divider

Path 2

Vdd internal source

Interval

5 seconds

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 EA2F4B1BBFC4316652C43B21E60DCDD208181944D611CA9B7B432677CC50ECF4
.. _boards_nrf_battery:

Battery Voltage Measurement
###########################

Overview
********

This sample demonstrates using Nordic configurations of the Zephyr ADC
infrastructure to measure the voltage of the device power supply.  Two
power supply configurations are supported:

* If the board devicetree has a ``/vbatt`` node with compatible
  ``voltage-divider`` then the voltage is measured using that divider. An
  example of a devicetree node describing a voltage divider for battery
  monitoring is:

   .. code-block:: devicetree

      / {
         vbatt {
            compatible = "voltage-divider";
            io-channels = <&adc 4>;
            output-ohms = <180000>;
            full-ohms = <(1500000 + 180000)>;
            power-gpios = <&sx1509b 4 0>;
         };
      };

* If the board does not have a voltage divider and so no ``/vbatt`` node
  present, the ADC configuration (device and channel) needs to be provided via
  the ``zephyr,user`` node. In this case the power source is assumed to be
  directly connected to the digital voltage signal, and the internal source for
  ``Vdd`` is selected. An example of a Devicetree configuration for this case is
  shown below:

   .. code-block :: devicetree

      / {
         zephyr,user {
            io-channels = <&adc 4>;
         };
      };

Note that in many cases where there is no voltage divider the digital
voltage will be fed from a regulator that provides a fixed voltage
regardless of source voltage, rather than by the source directly. In
configuration involving a regulator the measured voltage will be
constant.

The sample provides discharge curves that map from a measured voltage to
an estimate of remaining capacity.  The correct curve depends on the
battery source: a standard LiPo cell requires a curve that is different
from a standard alkaline battery.  Curves can be measured, or estimated
using the data sheet for the battery.

Application Details
===================

The application initializes battery measurement on startup, then loops
displaying the battery status every five seconds.

Requirements
************

A Nordic-based board, optionally with a voltage divider specified in its
devicetree configuration as noted above.

Building and Running
********************

The code can be found in :zephyr_file:`samples/boards/nrf/battery`.

.. zephyr-app-commands::
   :zephyr-app: samples/boards/nrf/battery
   :board: thingy52/nrf52832
   :goals: build flash
   :compact:


Sample Output
=============

.. code-block:: console

   *** Booting Zephyr OS build zephyr-v2.2.0-318-g84219bdc1ac2  ***
   [0:00:00.016]: 4078 mV; 10000 pptt
   [0:00:04.999]: 4078 mV; 10000 pptt
   [0:00:09.970]: 4078 mV; 10000 pptt
   [0:00:14.939]: 4069 mV; 10000 pptt
   [0:00:19.910]: 4078 mV; 10000 pptt
   [0:00:24.880]: 4069 mV; 10000 pptt

Part 3

한국어 전문 번역

개요

이 sample은 Zephyr ADC infrastructure의 Nordic configuration을 사용해 device power-supply voltage를 측정합니다. 다음 두 power-supply configuration을 지원합니다.

  • Board devicetree에 voltage-divider compatible을 가진 /vbatt node가 있으면 그 divider를 사용해 voltage를 측정합니다. Battery monitoring voltage divider를 나타내는 devicetree node 예는 다음과 같습니다.
    / {
       vbatt {
          compatible = "voltage-divider";
          io-channels = <&adc 4>;
          output-ohms = <180000>;
          full-ohms = <(1500000 + 180000)>;
          power-gpios = <&sx1509b 4 0>;
       };
    };
  • Board에 voltage divider가 없어 /vbatt node도 없다면 zephyr,user node로 ADC configuration(device와 channel)을 제공해야 합니다. 이 경우 power source가 digital voltage signal에 직접 연결되었다고 가정하고 Vdd internal source를 선택합니다. 이 경우의 Devicetree configuration 예는 다음과 같습니다.
    / {
       zephyr,user {
          io-channels = <&adc 4>;
       };
    };

Voltage divider가 없는 경우에도 digital voltage가 source에서 직접 공급되지 않고 source voltage와 관계없이 고정 voltage를 내는 regulator를 거치는 일이 많습니다. Regulator가 포함된 configuration에서는 측정 voltage가 일정하게 나타납니다.

Sample은 측정 voltage를 남은 capacity 추정치로 mapping하는 discharge curve를 제공합니다. 올바른 curve는 battery source에 따라 달라집니다. Standard LiPo cell과 standard alkaline battery에는 서로 다른 curve가 필요합니다. Curve는 직접 측정하거나 battery datasheet를 이용해 추정할 수 있습니다.

Application 세부 정보

Application은 startup 때 battery measurement를 초기화한 뒤 5초마다 battery status를 표시하는 loop를 실행합니다.

요구사항

Nordic 기반 board가 필요합니다. 위에서 설명한 voltage divider를 devicetree configuration에 선택적으로 지정할 수 있습니다.

Build와 실행

Code는 samples/boards/nrf/battery에서 찾을 수 있습니다.

west build -b thingy52/nrf52832 samples/boards/nrf/battery
west flash

Sample 출력

*** Booting Zephyr OS build zephyr-v2.2.0-318-g84219bdc1ac2  ***
[0:00:00.016]: 4078 mV; 10000 pptt
[0:00:04.999]: 4078 mV; 10000 pptt
[0:00:09.970]: 4078 mV; 10000 pptt
[0:00:14.939]: 4069 mV; 10000 pptt
[0:00:19.910]: 4078 mV; 10000 pptt
[0:00:24.880]: 4069 mV; 10000 pptt

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.