MacBook battery diagnostics and repair

==Disclaimer==
We strongly do not recommend you to refurbish / repair batteries for further customer use unless you know what are you doing, and you are qualified(which is clearly not the case if you read this article).
Batteries are highly explosive and dangerous products, this is exactly a red line where consumer electronics repair stops being safe, so we do not recommend re-celling batteries since good li-pol cells is not something you can confidently buy in electronics store. 
There are very few cases where you might try to fix the battery instead of installing a new one:
- if you have slightly over-discharged battery.
- If your battery had short circuit on board in 100% charged condition. Such lock might also happen if you had 19V on your PPBUS line, but it would also burn the fuse. Usually short circuit causes temp.fail condition which is reset if BMS sees current flow in opposite direction(which means from Laptop TO battery). Since "FULLY_CHARGED" flag will prevent the battery from opening its mosfet, charging the battery won't reset this flag. Some old PC laptop batteries could be discharged with external load(use digital controlled load only) on cells to reset this flag. 
- if you need to backup customer's data before fixing charging circuit / ordering a new battery, etc. 
==Theory==
Moderns notebook batteries are quite sophisticated devices(also known as smart battery) with its own microcontroller and balancing electronics. Check MacBook OEM, Aftermarket, and Knock-Off Batteries for comparison and photos of Macbook Battery internal parts. 
#Battery controller (Texas instruments b20 series) This part of the battery stores all the service information like remaining capacity (calculated during charge), cycles, fail flags, etc.
#Cell charging/balancing system. Say, there are 3 cells in your battery in series, each is discharged to 3V. We apply 13V to the battery pack. Each cell has its own capacity, resistance and charging performance. To keep batteries charged evenly we need to control and balance them by injecting voltage between cells during charge or withdrawing excess charge from "overcharged" cells during discharge. Balancing algorithm is dependent on BMS and cell pack design. If the difference between cells is more than 0.2V, Temporary FAIL flag might be triggered and battery will stop charging. Further read
#Fuse. Macbooks use self-burning fuse which has 4 pins. there is a heating element which melts solder blob between two B+ poles. This event is triggered if battery is shorted in use, or overvoltage is detected. In some cases battery might even report itself as a "perfect condition". it will pass AHT, but still, there would be no charge and no output.
#Cells. In most macbooks there will be 3S(3 Cells/Cell Packs in SERIES) battery with 10-12.8v output voltage. PPBUS voltage when running from power supply is approximately same voltage as a fully charged battery. PPBUS Voltage is set by CELL pin on charger IC.
#Thermal couple on battery pack. Small, but really important thing. In some cases thermal couple gets damaged by drop damage, it might also be damaged during transport or battery installation. (for example, on MacBook Air A1466 It is mounted close to sharp plastic edge which cuts thermal couple). This is Permanent "TERMINATE_DISCHARGE" flag failure, and you can fix it by replacing the thermal couple and resetting the battery (special equipment required, but maybe this particular flag has some sort of timeout since hot battery never causes battery bricking itself on Smartphones, however it happens from time to time). To check the thermal couple, measure voltage across: there should be 0.15V cycling every second. If you see higher voltage, most likely the sensor is OL. 
==Troubleshooting==
#To turn on the battery you need to pull down SYSDETECT_L to ground. on old models it is done by connector itself, modern macs need you to plug the power supply to switch this line to ground. If you need to turn on such battery without power supply, simply short it to ground with tweezers once. If it only shows empty battery sign on screen, you can also pull BATLOW_L to 3.3V with 10-Ohm jumper(say, you have charging circuit problem, but you want to first backup data using pre-charged battery) 
#No output would mean that the battery is in permanent/temporary failure state. Measure voltage on banks, check if you have bad balance and correct it with bench power supply. This is not a repair solution, but it might be necessary if you have one of the macs which won’t boot without the battery, and you need data first.
#If there is output, but battery is not detected, inspect I2C lines. Some macs like M1 MAX will, in fact, run from battery with no communication with the battery. For some reason it will show 0% battery even in system. all 16" models will throttle and run 100% fan with no battery connected. The battery won't charge without i2c communication, both lines are active every 0.5seconds, so it could even be seen as a slight voltage fluctuation on RMS multimeter. 
#If battery is detected but not being charged, you can also get more information from it usind terminal command(on mac devices it is much more verbose): ioreg -l -w0 | grep Capacity this command will show you quite a lot useful information including battery voltage. if your battery voltage calculates to below 2.8V per cell, battery will lock itself. for example if you have 2S-cell battery like Macbook air, everything below 5.6V would mean that battery is not possible to recover without special device and precharging cells to 3V. 
=== How to test if charging circuit works properly. ===
with battery disconnected:
# Check with Multimeter or Oscilloscope if SCL / SDA lines have 1/Sec activity. Good multimeter will indicate slight voltage jump.
# Check if there is output voltage to the battery. Working charger IC would send 6-7V pulses every second and permament 12V on M1 PRO/MAX macbooks (Need to confirm on few other devices) The idea behind that is that if battery is not detected, charger will try to "wake it" with power pulses and SDA/SCL "ping". 
# check if Gate on BatFet is below ppbus voltage (2-5V)
# also good indicator is PPBUS voltage on intel macs: 12.3 indicate problem with SMC-Charger IC communication (even if mac works). 
with battery connected:
# there should be communication on SCL SDA lines
# Batfet Gate should be stable 2-4V which indicate open BatFET 
# voltage to the battery should be around normal PPBUS voltage. If battery charges, its voltage should slowly raise. 
note on M1 devices:
non working SDA/SCL will cause device to show "1%" battery and "service recommended" instead of "no battery detected". However, mac will work from battery. 
The battery will be also charged a just a tiny bit to 12V (default PPBUS voltage). If used for long period of time, battery will lose its calibration and it will need to be fully discharged (approx 9.8V till it shuts itself down) and then fully charged. 
==Links==
Texas Instruments Balancing guide
Known good 3rd party Battery suppliers:
LMP They also produce batteries for very old models. Since late 2021 they changed Cell supplier which seems to have much lower quality. 
Diagnostic equipment:NLBA1(laptop battery analyzer and repair device)
You can also use EV2300 (Texas Instruments programming kit), but without some deep knowledge of registers / tech mode key this is useless.
There is also a small apple-only device called MBRT, available on aliexpress. (no reason to link since they expire quite fast)