Battery voltage and how to read it

General discussion on Hexiwear development kit.
Post Reply
Author
Message
MDonati11
Posts: 2
Joined: 31 Aug 2020 18:46

Battery voltage and how to read it

#1 Post by MDonati11 » 31 Aug 2020 18:58

Hello everyone!

I recently bought Hexiwear for personal use and I think it is such a great product.
The only thing I am not sure about is the voltage provided by the battery. It doesn't seem to be specified in the hardware documentation.

Looking at the original firmware on GitHub I saw that the voltage (mV) of the battery can be measured as specified below:

Code: Select all

// convert data to milivolts
    bat_mvolts = ( uint16_t )
        ( ( ( float )input[idx] * ( 3.3 / 65535.0 ) ) * 1000 );

    if( bat_mvolts > 2670 )
    {
        output[idx] = 100;
    }
    else if( bat_mvolts > 2500 )
    {
        output[idx] = ( mE_t )( 50 + 50.0 * ( ( bat_mvolts - 2500 ) / 170.0 ) );
    }
    else if ( bat_mvolts > 2430 )
    {
        output[idx] = ( mE_t )( 30 + 20.0 * ( ( bat_mvolts - 2430 ) / 70.0 ) );
    }
    else if ( bat_mvolts > 2370 )
    {
        output[idx] = ( mE_t )( 10 + 20.0 * ( ( bat_mvolts - 2370 ) / 60.0 ) );
    }
    else
    {
        output[idx] = 0;
    }
(ref. https://github.com/MikroElektronika/HEX ... r_driver.c)

So I guess the battery voltage it is 3.3V at max. Am I right? The code I posted allows to display the percentage of the remaining battery life, but I really don't understand how the value of output[idx] is calculated. Where do those formulas come from? Can anyone help me?

Thank you very much!

MDonati11
Posts: 2
Joined: 31 Aug 2020 18:46

Re: Battery voltage and how to read it

#2 Post by MDonati11 » 02 Sep 2020 18:38

I just opened Hexiwear to read the label written onto the battery and it says "3,7V 190mAh".
So now I'm a little confused. Why is the battery voltage calculated as mentioned in the previous post?

Thank you.

Post Reply

Return to “Hexiwear”