La version de votre navigateur est obsolète. Nous vous recommandons vivement d'actualiser votre navigateur vers la dernière version.

Battery SOC Determination for PIC18F4550 MCU

                 

                      

            

Main Features

  • Suitable for Li-Ion and Li-Poly technologies

  • Cell Capacity : 1300 mA.h 

  • High accuracy State of Charge determination

  • SOC Determination based on Kalman Filter Algorithm 

Applications

  • All Applications needing battery state of charge determination 

General Description

The state of charge determination algorithm is offered to battery users who need a high precision SOC determination. This version is developed for Li-ion batteries with 1300mA.h capacity and can be downloaded from Yaslamen Website for free.

The state of charge determination algorithm is implemented on PIC18F4550 MCU. It gives users the ability to communicate the state of charge of battery via I2C or two 7-segment display.

Hardware configuration

Block Diagram 

Bill of Materials 

                   Component

Value

                          PIC18F4550

-

                        Resistor Bridge

                    4.7kΩ -  ¼ Watt – 5%

                        Resistor (Rsens)

                    0.22 Ω-  ¼  Watt - 1%

                        Resistor Bridge

                     1.0 kΩ- ¼ Watt - 5%

How to implement the state of charge determination firmware

Programming Your PIC18F4550

After downloading the Hex file “SOC_Determination_Algorithm_PIC18.hex”, you can implement it on your MCU PIC18F4550 using any type of Microchip programmer.  While using an ICSP programmer, such as Pickit3, you have to add a programming connector to the schematic presented before. 

Battery state of charge Communication

There are two ways to communicate the battery state of charge : either by displaying it on a 7-segment display or by sending it via I2C to any other application.

Via 7 segment display

Via I2

 


 Data Frame from slave to master 


 


Sample Arduino Sketch 


 

#include<Wire.h>

int adress_slave=9;

int data_bytes=15;

int i=0;

char tab[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

void setup()

{

Wire.begin();

Serial.begin(9600);

}

void loop(){

Serial.print("Battery Parameters");
Serial.print(":\n");
Wire.requestFrom(adress_slave,data_bytes);
while(Wire.available()==0);
for(inti=0;i<15;i++)
{
charc=Wire.read();
}
tab[i]=c;}
Serial.print('\n');
Serial.print("Vbat=");
Serial.print(tab[0]);
Serial.print(tab[1]);
Serial.print(tab[2]);
Serial.print(tab[3]);
Serial.print("mV");
Serial.print('\n');
Serial.print("Ibat=");
Serial.print(tab[4]);
Serial.print(tab[5]);
Serial.print(tab[6]);
Serial.print(tab[7]);
Serial.print("mA");
Serial.print('\n');
Serial.print("SOC=");
Serial.print(tab[8]);
Serial.print(tab[9]);
Serial.print(tab[10]);
Serial.print("%");
Serial.print('\n');
Serial.print("Battery Capacity=");
Serial.print(tab[11]);
Serial.print(tab[12]);
Serial.print(tab[13]);
Serial.print(tab[14]);
Serial.print("mAh");
Serial.print('\n');
delay(2000);
}