Giter Club home page Giter Club logo

bq76920's Introduction

BQ76920

This library is made for the STM32 HAL (Hardware Abstraction Library) platform. This is a Battery Monitoring AFE library from TEXAS for use with STM32XXX microcontroller.

MIT License

Usage/Examples

/* USER CODE BEGIN Includes */
#include "BQ76920.h"
/* USER CODE BEGIN PV */
BQ76920_t BMS;
/* USER CODE END PV */

int main(void)
{
    MX_I2C2_Init();
    BMS.i2cHandle = &hi2c2;
    BMS.bootPort = GPIOC;
    BMS.bootPin  = GPIO_PIN_9
    
    /* USER INIT*/
    BQ76920_Initialise(&BMS,&hi2c2);
    BQ76920_Enable_ADC(&BMS);

    /* while loop */
    /* USER CODE BEGIN WHILE */
    while (1)
    {
        /* USER CODE END WHILE */
        /* USER CODE BEGIN 3 */
        float Vcell[4], Vpack, Ipack, PackTemp;
        Vpack = getPackVoltage(&BMS);
        for(int i =0;i<=3;i++)
        {
            if( i == 3)
            {
                Vcell[i] = getCellVoltage(&BMS,VC4);
            }
            else
                Vcell[i] = getCellVoltage(&BMS,VC1+(2*i));
            HAL_Delay(15); 
        }
        Ipack = getCurrent(&BMS);
        PackTemp = getDieTemp(&BMS);
        
        
        EnableBalanceCell(&BMS);
        HAL_Delay(200);
        DisableBalanceCell(&BMS);

        BQ76920_Shutdown(&BMS);
    }
    /* USER CODE END 3 */
}

Features

  • Compatible with 4S Litium Battery
  • Get Cell Voltage
  • Get Battery pack Voltage
  • Get Battery pack Current
  • Get Die Temperature
  • Enable/Disable Balancing mode
  • Shutdown

Authors

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.