Creating a load on a battery using the radio

I am in a need to measure a battery level under a constant load. Rather than adding a custom electronics, I am considering using the radio. I believe there is a way of doing that (see https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/peripheral/radio_test/README.html).

For my use case I need something very simple, that could be embedded in our standard, production software. Would you please advise on the right register configuration ?

nRF52833

SDK 17

  • Hi!

    What level of load is needed? if ~3mA is okay, then the easiest is just to let the CPU run, and not put it into idle mode.

    Snippet:

    While(true)

    {

        __NOP();

    }

    https://docs.nordicsemi.com/bundle/ps_nrf52833/page/_tmp/nrf52833/autodita/CURRENT/parameters.i_cpu.html

  • Thanks for the response. I need more than that. 10 to 20mA would be ideal.

  • Hi!

    Then putting the radio in TX is likely the option.

    Could you elaborate on how this should work in practice?

    Would it be something used in your normal application hex?

    Would it be some test-mode you put the chip into, instead of booting the normal application?

    Or something that you would need to do every x amount of time while running the normal application?

  • The test is intended too be executed only during a power-on of the normal application

    1. Normal application starts

    2. Put radio in TX by a direct configuration of radio registers

    3. Measure battery voltage for 1 to 2s

    4. Disable radio

    4. If battery ok, continue with initialization of the app, start the Soft Device.......

  • I do something similar for measuring coin cell capacity by monitoring voltage decay under a known load via Bare-metal Radio Transmit. Similar to solar_sensor_beacon sample on the Nordic GitHub repo. The code can be run before nRFConnect stuff if using nRFConnect environment.

    solar_sensor_beacon

    advertising-using-raw-radio-registers

    Edit: I wrote these notes, might be useful if you want to actually have detectable advertising packets. Note also that you can get a fixed load by using Rx instead of Tx if you want to keep the environment cleaner.

    // BLE Advertising Packet
    // ======================
    // Every packet begins with an 8 bit preamble, an alternating binary sequence. This is followed by a 32 bit access
    // address (AA) which can be thought of as a unique identifier which defines a particular connection. When a
    // device (master or slave) transmits on an advertising channel it uses a fixed value of 0x8e89bed6 as the access
    // address.
    // Following the 32 bit access address are optional S0, LENGTH and S1 fields then a variable length Protocol Data
    // Unit (PDU) which contains the message data payload. Finally all packets end with a 24 bit CRC.
    // By default, the Nordic BLE address is derived from the NRF_FICR->DEVICEADDR[] and is 48 bits in length (6 bytes)
    // If S0, LENGTH or S1 are specified with zero length their fields will be omitted in memory, otherwise each
    // field will be represented as a separate byte, regardless of the number of bits in their on-air counterpart
    // For the field sizes defined in bits, the occupation in RAM will always be rounded up to the next full byte size
    // (for instance 3 bit length will allocate 1 byte in RAM, 9 bit length will allocate 2 bytes, etc.).
    // On-air packet layout (Note Header in RAM is 3 bytes if S0INC is '1')
    // +-------------------------------------------------------------------------------------------------------------------------+
    // |                                         BLE Advertising Packet - Legacy                                                 |
    // +-------------------------------------------------------------------------------------------------------------------------+
    // |                                         1MHz: 47 octets max total length                                                |
    // +--------+-------+------------------------------------------------------------------------------------------+------+------+
    // |        |Access |                                                                                          | Add  |      |
    // |Preamble|Address|                   Protocol Data Unit PDU                                                 | On   | CRCC | Tone Ext
    // +--------+-------+------------------------------------------------------------------------------------------+------+------+
    // |   1(2) |   4   |                                    2 - 39                                                | (0)  |  3   | 16 - 160uSec
    // |        |       +-----------------+------------------------------------------------------------------------+      |      |
    // |        |       |    Header       |                  Payload                                               |      |      |
    // |        |       +-----------------+------------------------------------------------------------------------+      |      |
    // |        |       |       2         |                  0 - 37                                                |      |      |
    // |        |       +-----+-----+-----+------------------------------------------------------------------------+      |      |
    // |        |       | Opt | Opt | Opt |  MAC Addr  |     AdvData List (example 3 fields)                       |      |      |
    // |        |       | S0  | Len | S1  +------------+-----------------------------------------------------------+      |      |
    // |        |       |-----+-----+-----|    6       |     0 - 31                                                |      |      |
    // |        |       | (1) | (1) | (1) |            +-------------------+-------------------+-------------------+      |      |
    // |        |       |     |     |     |            |    AdvData Flags  |    AdvData Name   |   (AdvData Data)  |      |      |
    // |        |       |     |     |     |            +-------------------+-------------------+-------------------+      |      |
    // |        |       |     |     |     |            |        3          |          6        |       0 - 22      |      |      |
    // |        |       |     |     |     |            +-----+------+------+-----+------+------+-----+------+------+      |      |
    // |        |       |     |     |     |            | Len | Type | Data | Len | Type | Data | Len | Type | Data |      |      |
    // |        |       |     |     |     |            +-----+------+------+-----+------+------+-----+------+------+      |      |
    // |        |       |     |     |     |            |  1  |  1   |  1   |  1  |  1   |  4   |  1  |  1   |  20  |      |      |
    // |        |       |     |     |     |            |     |      |      |     |      |      |     |      |      |      |      |
    // |  1(2)  |  4    | (1) | (1) | (1) |   6        |  1  |  1   |  1   |  1  |  1   |  4   |  1  |  1   |  20  | (0)  |  3   |
    // +--------+-------+-----+-----+-----+------------+-----+------+------+-----+------+------+-----+------+------+------+------+
    //         0x8E89BED6     |     |      \
    //                /       |     |       \
    //               /  RAM uses 2+ bytes    \
    //              / 1 byte | 2 bit | 6 bit  \
    //             /                           \
    //            /  OTA only 2 bytes for BLE   \
    //           |                         |     |
    //           Type RFU ChSet TxAdd RxAdd Length
    //    bits:    4   1    1     1     1     8
    

Related