Battery SOC Determination for Arduino For PIC18F4550

advertisement
Battery SOC Determination for Arduino
For PIC18F4550 MCU
Main Features
Suitable
for
Li-Ion
and
Li-Poly
technologies
Cell Capacity : 860 mA.h (3.2Wh),
High
accuracy
State
of
Charge
determination,
SOC Determination based on Coulomb
Counting
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 860mA.h (3.2Wh) capacity and can
be downloaded from Yaslamen Website for free.
The state of charge determination algorithm is implemented on Arduino Board. It gives users the
ability to communicate the state of charge of battery via I2C or two 7-segment display.
Index
Hardware Configuration
How to implement the state of charge determination firmware
Battery State of charge Communication
Contact Us
Page | 1
Page2
Page3
Page3
Page4
©Yaslamen2016
Hardware configuration
Block Diagram
Bill of Materials
Component
Arduino Board
Resistor (R1,R2)
Resistor (Rs)
Resistor (R3,R4)
Value
4.7K Ohm - ¼ Watt – 1%
0.22 Ohm - 1 Watt - 1%
15 K Ohm - ¼ Watt - 1%
How to implement the state of charge determination firmware
Programming Your Arduino Board
Download the Hex File “SOC_Determination_Arduino” from our website. Choose the specific Hex File
for your Board (Arduino Uno, Arduino Leonardo, Arduino Mega or Arduino Yún). You can program
your Arduino board via USB connection by using XLoader. XLoader helps you to upload the *.hex file
to Arduino boards using the Bootloader without the need of a programmer.
Download The
Soc_Determination
Algorithm.hex
Page | 2
Donwload XLoader
Start the software
and upload the
program
Test the Algorithm
©Yaslamen2016
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
MCU Pin Name
Pin5
Pin6
Pin7
Pin8
Pin9
Pin10
Pin11
Pin12
Pin13
7-Seg Pin Name
Seg-A
Seg-B
Seg-C
Seg-D
Seg-E
Seg-F
Seg-G
1st Digit
2nd Digit
Via I2C
Data Frame from slave to master
0
10
Charge
Page | 3
1
2
3
Battery Voltage
11
12
13
Battery Capacity
4
5
6
Current Value
7
8
9
State of
14
©Yaslamen2016
I2C Specifications
Device Slave Address
Serial Port Clock Frequency
Data Length
0x09
125 KHz
15 Bytes
Sample Arduino Sketch
#include <Wire.h>
int adress_slave = 9 ;
int data_bytes = 15 ;
int i = 0 ;
int 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(int i=0;i<15;i++)
{
int c = 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);
}
Contact Us
Address:
Europarc de Pichaury –Bat B5
Email: Contact@yaslamen.com
1330 avenue Guillibert de la lauzière
13856 Aix en Provence Cedex 3
Web Site : www.yaslamen.com
Page | 4
©Yaslamen2016
Download