Skip to content

Commit 6b96d5d

Browse files
committed
Major improvements in I2C communication and output. Detection of disconnect.
1 parent 9c8f087 commit 6b96d5d

File tree

3 files changed

+387
-186
lines changed

3 files changed

+387
-186
lines changed

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,23 @@ Extract: *Macbook batteries ship with a default unseal password (0x36720414). T
1717
Download and extract the repository. In the Arduino IDE open the sketch with File -> Open... and select the src/SBMInfo folder.
1818

1919
## Identifying the right connection
20-
Clock und Data connectors have often a resistance of 300 k to 1 MOhm to Ground.
20+
The minimal connector layout is: | GROUND | THERMISTOR (103AT) | CLOCK | DATA | VCC (11 or 14 volt) | (clock and data my be switched).
21+
- The thermistor connection has 10 kOhms to ground at 25 degree celsius.
22+
- Clock und data connectors have the same resistance (between 300 kOhm to 1 MOhm) to ground.
23+
- VCC may not be enabled. Sometimes it gets enabled when *Host Present* is connected to ground or clock and data are pulled high to 3.3 or 5 volt.
24+
If you see more connectors, the may be used for:
25+
- A second (adjacent) ground and / or VCC to reduce the connector resistance for the supply current.
26+
- A *Battery Present* signal. This connector is internally connected to ground at the battery pack and NOT connected to ground at the PC.
27+
- A *Host Present* signal. This connector has a pullup at the battery back and is connected to ground at the PC side.
28+
Examples:
29+
| GROUND | BatteryPresent | THERMISTOR ? | CLOCK | DATA | VCC | - seen at HP packs.
30+
| GROUND | GROUND | Alert ? | HostPresent | BatteryPresent | DATA | CLOCK | VCC | VCC | - seen at Dell packs.
31+
2132
After startup, the program scans for a connected I2C device.
22-
Just try different pin combinations until led stops blinking and `Found I2C device attached at address: 0x0B` is printed.
23-
After connecting`, full data is printed.
24-
Dynamic values are checked every 3 seconds and printed if changed.
33+
You can try different pin combinations until led stops blinking and `Found I2C device attached at address: 0x0B` is printed.
34+
If you connect clock or data with the thermistor connector, the scanning stops.<br/>
35+
After connecting, full data is printed.<br/>
36+
Dynamic values like temperature, voltage and current are checked every 3 seconds and printed if changed.
2537

2638
Tested with bq20z70, bq20z451, bq2084, bq80201DBT, bq40z50.
2739

@@ -43,8 +55,8 @@ Bei der Richtigen h
4355

4456
Bei den Laptop Battery Packs war Plus und Masse immer außen.
4557
Wenn mehr als 5 Kontakte vorhanden waren, waren sie wie folgt belegt:
46-
- Masse und Plus doppelt. z.B. + | + | Thermo | Data | Clock | - | -
47-
- Ein Enable (nur im Laptop mit Masse verbunden) und eine Signal Anschluss (nur im Battery Pack mit Masse verbunden). z.B. + | + | Clock | Data | Signal | Enable | Thermo | - | -
58+
- Masse und Plus doppelt. z.B. + | + | Thermistor | Data | Clock | - | -
59+
- Ein Enable (nur im Laptop mit Masse verbunden) und eine Signal Anschluss (nur im Battery Pack mit Masse verbunden). z.B. VCC | VCC | CLOCK | DATA | Signal | Enable | THERMISTOR | GROUND | GROUND |
4860

4961
Der Thermo-Sensor Anschluss war uneinheitlich, mal nicht messbar beschaltet, mal 1 MOhm, mal 1,6 Volt, mal 10 kOhm nach Masse.
5062

SBMInfo/SBMInfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
#define RESERVED_3 0x30 - 0x3B
5959

60-
#define CELL4_VOLTAGE 0x3C // r/w Word - OptionalMfgFunction4 - Individual cell voltages don't work on Lenovo and Dell Packs
60+
#define CELL4_VOLTAGE 0x3C // r/w Word - OptionalMfgFunction4 - Individual cell voltages don't work on Sony, Lenovo and Dell Packs
6161
#define CELL3_VOLTAGE 0x3D // r/w Word - OptionalMfgFunction3
6262
#define CELL2_VOLTAGE 0x3E // r/w Word - OptionalMfgFunction2
6363
#define CELL1_VOLTAGE 0x3F // r/w Word - OptionalMfgFunction1
@@ -74,7 +74,7 @@
7474
#define CHARGER_MODE 0x4000
7575
#define CAPACITY_MODE 0x8000
7676
const char StringCapacityModeCurrent[] = " mA";
77-
const char StringCapacityModePower[] = "0mW"; // 10mWh
77+
const char StringCapacityModePower[] = "0 mW"; // 10 mWh
7878

7979
/*
8080
* Bits of BatteryStatus
@@ -96,7 +96,7 @@ const char StringCapacityModePower[] = "0mW"; // 10mWh
9696
struct SBMFunctionDescriptionStruct {
9797
uint8_t FunctionCode;
9898
const char * Description;
99-
void (*ValueFormatter)(struct SBMFunctionDescriptionStruct * aDescription, uint16_t aValueToFormat); // no println() at the end!
99+
bool (*ValueFormatter)(struct SBMFunctionDescriptionStruct * aDescription, uint16_t aValueToFormat); // no println() at the end!
100100
const char * DescriptionLCD; // if output value should also be printed on LCD
101101
uint16_t lastValue; // used as storage for last value
102102
};

0 commit comments

Comments
 (0)