HDQ Utility version 0.96 now available!

Whew, I’ve been working on this version for quite a while. With the helpful feedback of many people that have tried my software, I’ve made a large number of improvements to the software; of course, there are plenty of features that aren’t implemented yet, but are being worked on.

More information about how this utility works can be found here.

Download HDQ Utility v0.96 here: https://www.dropbox.com/s/pf0vszgfei7s8ly/HDQ%20Utility%200.96.zip?dl=0


  • (Major improvement!) Improved HDQ logging functionality (logs are now saved to a separate file instead of being overwritten).
    • Example: “HDQ Log (2015-10-26 at 19.02.50) – HDQ Utility v0.96.txt”
  • Improved HDQ communication (HDQ breaks no longer require the serial port to be opened more than once, and HDQ no-response timeouts are decreased from 0.5 to 0.3 seconds.
  • Reworded certain error messages for clarity.
    • Example: “Communication error: Cannot read byte from address 0x02 (No response from device).” 
  • Renamed file ‘config.txt’ to ‘Config – COM Port.txt’ for clarity.
  • Improved state-of-health warnings by making them non-modal (they do not require the user to dismiss the message).
  • Added more notifications for unidentified and uninitialized batteries. (Uninitialized batteries are determined by a FULL ACCESS security state, with Impedance Track disabled.)
  • Fixed invalid device name and maximum load current readings for v5.02/sn27545-A4 based batteries (e.g. iPhone 6, 6+…).
  • Added time-to-full readings (for firmware older than v2.24).
  • Improved error-checking for device identification (it will display a notice that the tool may need to be restarted).
  • Updated DingoLib UI library to auto-resize window to 0.9x display resolution for improved readability on larger monitors.


  • Create a dedicated section on my blog for the HDQ Utility.
  • Create a user’s manual describing the parameters displayed by the program (in particular, the Advanced Battery Information section).
  • Improve data logging functionality by saving logs to a subdirectory instead of the program’s root to decrease file clutter.
  • Improve error-checking for commands (retry reads if one or more bytes are not received from the device).
  • Add error statistics indicating how many communication errors occurred during data collection.
  • Improve support for older (older than v1.25) firmware.
  • Improve support for v5.02/sn27545-A4 devices (make use of advanced commands available in this firmware version).
  • Add support for restarting of data collection without having to re-execute the program.
  • Add Data Flash memory functions to allow for readout of advanced configuration, serial number, lifetime/black-box data, etc.
  • Rewrite this program in something that’s not LabWindows/CVI… also, use of a GUI rather than a non-console text UI.

Performance analysis/review of Kentli PH5 Li-ion 1.5V AA battery

In my previous blog post, I tore down the Kentli PH5 battery – a Li-ion battery that has an internal 1.5-volt regulator that allows for terrific voltage stability… up to a point. In terms of data collection, so far I have collected 55+ runs of data logs (248 MB of text files!) and still do not quite have all the data I want. As for the data that I do have, I will be disseminating them with as much thoroughness as possible.

Voltage vs. load current

As expected, the voltage output of the PH5 remains quite stable, up until roughly 2.1 amps where the voltage sags noticeably until the regulator goes into overcurrent protection mode.

A maximum load capacity of 2.1 amps seems to be a bit… limiting. That said, I have not done tests on the PH5’s transient load capacity, as it would require more automated control than what I currently have available.

Another issue with having such a flat discharge curve is that any device that performs fuel gauging using voltage alone will report 100% capacity, until it suddenly shuts down. This could be a big problem for digital camera users, as they will have no indication that their batteries are running low, until the device abruptly stops working. If the camera was writing an image to its memory card when the battery died, it could cause the image to be corrupted, or worse, damage the file system on the card!

Voltage vs. state-of-charge

Unless you are running the battery at a high discharge rate, the output voltage will be flat at 1.5 volts before abruptly brickwalling and dropping to zero immediately at the end of discharge. At a high load (in the case of the graph below, at 2 amps), the voltage remains flat until the very end of the discharge cycle (99% depth of discharge for my test run), where it quickly tapers off and drops to zero.

Capacity vs. load

This is the big one, and it took a lot of work to get this data, especially at low loads (48+ hours of continuous logging is just asking for Murphy’s Law to come into play). I used almost 50 discharge runs to create the graph below.

This is where things get… interesting. I was expecting the capacity to peak at low currents then taper off as the load current increases. Instead, I noticed a definite ‘hump’ in capacity around the 250 mA mark (reaching a maximum of 1700 mAh / 2550 mWh), and only after that point did I see the expected downward slope in capacity, reaching 1200 mAh (1800 mWh) at the 2 amp mark.

This data brings forth some very interesting conclusions. The PH5’s capacity is inferior to its Ni-MH counterparts (even the relatively crappy ones), and at higher discharge rates it has similar capacity to that of an alkaline at the same load, albeit with much better voltage stability than the Ni-MH or alkaline chemistries.

Other findings

Although I won’t go into too much detail for the next few points (I haven’t gotten quite enough data to be presentable), there are some other issues with the battery that I think should still be mentioned.

One issue is the amount of heat the battery gives off at high loads. At 2.1 amps, I had to use a fan to blow cool air onto the DC-DC converter just to prevent it from entering its over-temperature shutdown mode. Although the converter itself can tolerate elevated temperatures, the Li-ion cell inside will not; the uneven heating that the cell will encounter could potentially degrade its lifespan in the long run.

Another problem is efficiency. At 1 amp, the DC-DC converter is about 75% efficient, and is only 65% efficient at 2 amps. I have not tested the converter’s efficiency at lower loads yet, but I doubt it will achieve more than 85-90% efficiency.

A potential issue with this battery is self-discharge. The buck converter remains active all the time, unless the converter or the Li-ion protection circuit enters a protective shutdown state. I have not had a chance to fully charge an unmodified battery in order to perform a long-term self-discharge test, but I will create another blog post for that, if/when the time comes.


Overall, I’m on the fence when it comes to this battery. Its innovative design does provide unparalleled voltage stability, but its low capacity even at moderate discharge rates dampens the fun significantly. Additionally, the 2.1 amp discharge limit could prove to be a bottleneck for some high-drain applications; this, coupled with the cell’s tendency to shut down abruptly when the internal cell runs empty could potentially cause file system corruption for digital cameras that have not been designed to handle such sudden power interruptions.

Also, the batteries are very costly. At about $10 per cell, you may want to think twice about replacing all your current disposable and rechargeable batteries with these newfangled Li-ion ones. Don’t forget the charger either, as a special charger is required to make contact with a recessed terminal on the top of the battery.

Overall, this cell is… interesting. Just don’t expect a miracle in a steel can.


  • Excellent voltage stability, even at high loads
  • Li-ion chemistry allows for a very lightweight cell, even with the addition of a DC-DC converter
  • High output voltage could allow some devices to run more efficiently


  • Low capacity – provides a mere 1200 mAh (1800 mWh) @ 2 amps, and up to 1700 mAh (2550 mWh) @ 250 mA (even alkaline batteries can do better than this)
  • Abrupt shutdown when the battery is overloaded, overheated, or over-discharged
  • Runs hot at high loads (and therefore is fairly inefficient)
  • 1.5 MHz converter and unshielded inductor can cause excessive EMI (electromagnetic interference) in sensitive devices
  • Expensive! Costs approximately $10/cell
  • Requires proprietary charger

Bottom Line: This is a niche product and should not be considered a universal replacement for alkaline or Ni-MH AA batteries.

So, about that Kentli battery…

It’s been a while since I’ve posted about the Kentli PH5 battery, which is a Li-ion cell with an integrated 1.5-volt regulator, wrapped up in an AA-sized package. Although I haven’t written much about its performance yet, that doesn’t mean I haven’t been doing work on it. In fact, I’m sure I have never put so much work into a single blog post before!

The full analysis of the battery’s performance is not fully complete, but I’ll reveal some details of my test setup and what I’m currently working on:


I’m doing a much more thorough analysis of this battery than I have done with any other one on this blog. I have created a second bq27541 fuel gauge board, but with the explicit goal of measuring the voltage, current, passed charge (mAh) and temperature of a given DC-DC converter. This way, I can measure the input and output of the DC-DC converter simultaneously, greatly enhancing the data I can collect.

These are the data points/attributes I am currently collecting:

  • Battery voltage sag at high load currents
  • Battery capacity over different load currents (it’s not constant!)
  • DC-DC efficiency, both at different load currents but also over a single discharge cycle
  • Temperature rise of the DC-DC converter at different loads, and also over a single discharge cycle
  • Changes in battery capacity and internal resistance over many charge cycles

I want to be as thorough as possible with my measurements, mostly because nobody else has done a detailed performance review of this rather unusual battery, but also partially because I want to challenge myself and see how much of a “real engineer” I can be (#JustHobbyistThings). 😛

Teardown of Kentli PH5 1.5 V Li-Ion AA battery

June 17, 2015 – Performance analysis/review HERE!

After having an entire month of dormancy on this blog, I’m finally beginning to cross off the blog posts on my “Pending” list.

Last year, I made a blog post talking about Kentli’s lithium-ion based AA battery that has an internal 1.5 volt regulator. The first order never arrived, and the second one had arrived a few months ago but I never got to actually taking one of the cells apart. That changes today.

Cell overview

The battery itself looks like a regular AA battery, except for the top positive terminal. There’s the familiar ‘nub’ that constitutes the 1.5 volt output, but also has a recessed ring around it that provides a direct connection to the Li-ion cell’s positive connection for charging.


After peeling the label, we are met with a plain steel case, save for the end cap that appears to be laser spot-welded. Wanting to take apart the cell with minimal risk of shorting something out inside, I used a small pipe cutter to gently break apart the welded seam. Two revolutions and a satisfying pop sound later, the battery’s guts are revealed.

Battery internals

The PCB that holds the 1.5 volt regulator is inside the end cap, with the rest made up of the Li-ion cell itself. Curiously enough, the cell inside is labeled “PE13430 14F16 2.66wh” which is interesting in more than one way. First of all, the rated energy content of the cell is less than what’s on the outside label (2.66 watt-hours versus 2.8), and the cell inside is actually a Li-ion polymer (sometimes called a “Li-Po” cell) type; I was expecting a standard cylindrical cell inside. Unfortunately, my Google-fu was unable to pull up any data on the cell. I might attempt to do a chemistry identification cycle on the cell and see if TI’s battery database can bring something up.

Battery circuitry

The end cap’s PCB uses a Xysemi XM5232 2.5 A, 1.5 MHz synchronous buck converter to provide the 1.5 volt output. According to the datasheet, it is a fully integrated converter with all the power semiconductor components residing on the chip itself. The converter is rated for 2.5-5.5 volt operation, well within the range of a Li-ion cell. Additionally, it has a rated Iq (quiescent/no-load current) of only 20 microamps. The buck converter’s 2.2 microhenry inductor is magnetically unshielded which may cause some increased EMI (electromagnetic interference) emissions, but I don’t have the equipment to test this.

I was looking around for the battery’s protection circuit, and found it on the flex PCB that surrounds the Li-ion cell. It uses a Xysemi XB6366A protection circuit which, like the buck converter, is a fully-integrated device; there are no external protection MOSFETs for disconnecting the cell from the rest of the circuit.

Performance analysis

December 14, 2015 – After extensive and detailed analysis (148 MB of text files!), I’ve analyzed the battery’s voltage and output capacity, which can be viewed HERE (lots of pretty graphs; check it out!).

The data doesn’t stop there. Over a long, long period of time I’m tracking the battery’s self-discharge as well. Those posts are available here (Part 1), here (Part 2), here (Part 3), and here (Part 4).

Looking inside a (fake) iPhone 5S battery

Considering how popular the iPhone is, there’s always going to be some counterfeits out there. I’ve been out buying various iPhone batteries to build a database of each generation’s characteristics, but one model has eluded me so far: the iPhone 5S. The iPhone 5C’s battery that I bought appears to be genuine (but with its own issues), but none of the iPhone 5S batteries I’ve bought so far (4 of them at the time of writing this blog post) were genuine. All of these fakes look like a genuine battery at first glance, but all of them share a few common traits.

Battery teardown

The fake battery sports the usual iPhone battery information, complete with some dot-matrix printed data and a data-matrix barcode. It’s labeled with a capacity of 1560 mAh and 3.8 volts nominal voltage.

Comparison between real and fake iPhone 5S battery

Comparison between real and fake iPhone 5S battery

The connector itself has two points for soldering the connector to provide durability. However, with the fake batteries, they are not soldered down. The two spots on the ends of the connectors are dark with a small point visible inside it (that point is the reinforcement pin on the connector). If this connector is installed in an iPhone, it will probably not come out without either damaging the battery’s connector, or worse, leave the plastic connector piece inside the phone, requiring tweezers to remove.

Connector lifted off with a hobby knife

Connector lifted off with a hobby knife

iPhone 5S and 5C battery pinout

iPhone 5S and 5C battery pinout

Removing the black protective tape reveals an iPhone 4 battery fuel gauge board. The connector is soldered to this board, with four solder points visible.

iPhone 4 battery PCB with soldered-on flat flex connector

iPhone 4 battery PCB with soldered-on flat flex connector

Pulling out the PCB  reveals another characteristic of these fake batteries: the positive terminal is cut short, with another metal section being clumsily spot-welded to the stub on the cell.

Note how the battery tab is poorly welded to the PCB.

Note how the battery tab is poorly welded to the PCB.

Battery fuel gauge data

The battery fuel gauge requires proper programming to accurately indicate the battery’s charge status. Because of this, each iPhone battery generation has its own specific configuration.

The fake iPhone battery retains the programming for the iPhone 4’s battery, which is a designed capacity of 1420 mAh, using a bq27541 fuel gauge running version 1.25 firmware. The data inside it is often that of a used/recycled battery as well.

This data can be (partially) read out directly from the iPhone with a tool such as iBackupBot, but more data can be read if the battery is read with another tool. I have the EV2400 from Texas Instruments to read this out on a PC, but this data can be read out with a USB-to-TTL serial port, a logic gate (a logic inverter) and a small MOSFET transistor.

I created a small tool that uses this circuit to interface with the fuel gauge and read out its data. Check it out here.

Using my tool, this is the report for one of these fake batteries. Note how it is identified as an iPhone 4 battery. Don’t be fooled by the calculated state of health. It’s not accurate for this battery as the fuel gauge still thinks it’s still inside an iPhone 4 battery pack.

HDQ Gas Gauge Readout Tool version 0.9 by Jason Gin
Date: 9/30/2014
Time: 0:52:24
Serial port: COM26

Battery Identification
DEVICE_TYPE = 0x0541, FW_VERSION = 0x0125, DESIGN_CAPACITY = 1420 mAh
Battery's configuration matches that of a standard iPhone 4 battery.

Basic Battery Information
Device = bq27541 v.1.25, hardware rev. 0x00B5, data-flash rev. 0x0000
Voltage = 3804 mV
Current = 0 mA
Power = 0 mW
State of charge = 45%
Reported state of health = 0%
Calculated state of health = 99.3%
Cycle count = 14 times
Time to empty = N/A (not discharging)
Temperature = 27.9 °C (80.3 °F) (3009 raw)
Designed capacity = 1420 mAh
Heavy load capacity = 628/1410 mAh
Light load capacity = 673/1455 mAh

Advanced Battery Information
Capacity discharged = 0 mAh
Depth of discharge at last OCV update = ~778 mAh (8768 raw)
Maximum load current = -200 mA
Impedance Track chemistry ID = 0x0163
Reset count = 11 times

Flags = 0x0180
Flag interpretation:
* Fast charging allowed
* Good OCV measurement taken
* Not discharging

Control Status = 0x6219
Control Status interpretation:
* SEALED security state
* SLEEP power mode
* Constant-power gauging
* Qmax update voltage NOT OK (Or in relax mode)
* Impedance Track enabled

Pack Configuration = 0x8931
Pack Configuration interpretation:
* No-load reserve capacity compensation enabled
* IWAKE, RSNS1, RSNS0 = 0x1
* SLEEP mode enabled
* Remaining Capacity is forced to Full Charge Capacity at end of charge
* Temperature sensor: External thermistor

Device name length = 7 bytes
Device name: bq27541


Reading out HDQ-equipped battery fuel gauges with a serial port

Battery fuel gauges are the unsung hero of the battery world. There’s more to it than just measuring the voltage on the battery terminals,. These little chips are microcontrollers (tiny computers, essentially) that sit inside the battery pack and keep tabs on the battery’s performance for the life of that battery pack.

Texas Instruments makes battery fuel gauges that are small enough to fit in the circuitry of a cell phone, and one of the most common ones that uses this technology are iPhone batteries. These batteries use a single-wire interface called HDQ (which stands for High-Speed Data Queue). It may sound similar to Dallas Semiconductors’ 1-Wire protocol, but the two are completely different and incompatible with each other.

Protocol details

The HDQ protocol can be emulated with a serial port and a little bit of external circuitry. The protocol can be emulated with a serial port at 57600 baud with 8 data bits, no parity bit and 2 stop bits. Because this is a bi-directional bus, an open-drain configuration is needed. Most TTL serial ports are not open-drain, so some circuitry is required to do this. TI’s application note suggests using a CMOS inverter and an N-channel MOSFET along with a 1 kOhm pull-up resistor, but this can be cut down with a 74HC07 open-drain buffer and pull-up resistor.

[EDIT: June 13, 2015 – Corrected schematic]

The HDQ protocol uses a short pulse to indicate a logic 1, with a longer pulse to indicate a logic 0. The data is sent LSB (least significant byte) first, with a 7-bit address and an eighth bit to indicate if the operation is a read or write (0 is read, 1 is write). If it is a read operation, the fuel gauge will respond with one byte of data. As you might think, this is a very slow means of communication; the typical bus speed is 5-7 kilobits per second, but the actual usable throughput will be less than this.

The hack in this is that the bit timing can be made by sending a specially crafted UART byte that meets the timing specifications. Each bit takes up one byte of UART buffer memory, with 24 bytes being enough to perform an HDQ read (the first 8 bytes are echoed back to the PC and need to be ignored by the software). TI’s application note goes into this with a bit more detail.

Windows HDQ utility

HDQ utility icon, in all its pixelated glory.

HDQ utility icon, in all its pixelated glory.

I have written a small Windows program that will read out the battery’s main data, identify as a certain iPhone battery model (most iPhone batteries are supported), and save a copy of this data to a text file for safekeeping. This program requires the National Instruments LabWindows/CVI Runtime library to run, since I whipped this program up with the first available IDE on my college PC.


Screenshot of HDQ Utility version 0.96

The source code is not yet available (translation: I’m too ashamed of my programming skills to share it with others); however, a Windows executable is available for download below.

You will need to download the National Instruments LabWindows/CVI Runtime to run this program.

Current version (0.96): https://www.dropbox.com/s/pf0vszgfei7s8ly/HDQ%20Utility%200.96.zip?dl=0

Version 0.95: https://www.dropbox.com/s/7xdurbh9qibdftl/HDQ%20Utility%200.95.zip?dl=0
Version 0.9: https://www.dropbox.com/s/cd3esa5us6elfgr/HDQ%20Utility.zip?dl=0

Contributions are always accepted! Email me if you would like to send in a battery for me to analyze, or you can buy me a coffee through PayPal:

[EDIT – July 28, 2016] Welp, looks like the PayPal button’s broken (or was it never working to begin with…?). If you’d like to send anything to me, just give me a shout at ginbot86@gmail.com!

[EDIT – August 2, 2016] Whoops, looks like I never had the button working in the first place. Hopefully it works this time.


Skin-Deep Authenticity: Tearing down a “genuine fake” Samsung Galaxy S II battery

When you have the same smartphone for almost 3 years, it’s likely that your original battery’s not going to last as long as the service contract. And as long as you’re not an iPhone user you will probably look into a replacement or spare battery.

coverMy first replacement cell was a 2-pack of “1800 mAh” batteries for $5. These had 66% of the stated capacity and TI’s Impedance Track gauge said that the DC internal resistance was about 250 milliOhms. That’s… pretty terrible. Those two cells quickly led their end in a battery recycling bin. My next two were “genuine” cells from eBay. They cost about $12 each and had rather authentic-looking labels on them too. Their performance was pretty good, but one of them became all bloated so I decided I’d take a look at the cell that’s inside. I peeled off the label, and the truth comes out…

2014-01-01 04.53.39This battery was an outright lie in terms of capacity! 1350 mAh is about 80% of the 1650 mAh capacity that was written on the outer label. The cell’s manufacturer is unknown, but the battery markings read “BMW-524655AR 1350mAh 2012.09.03.1110”. Wait, look at that manufacturer date. Something’s fishy…

2014-01-01 04.53.54The outer label states a manufacture date of July 20, 2012. The internal cell states one of September 3, 2012. Unless this battery was manufactured in a time-bending factory, then these batteries certainly aren’t genuine.

Next up was the protection circuit. The “genuine fake” battery uses a DW01 protection IC and uses a generic 8205A dual NFET for swiching. And there wasn’t even a thermistor; the PCB uses a 1.5k ohm resistor to simulate one. A genuine board uses a single SMD package that integrates the FETs and the protection IC.

Below is a comparison of the protection board of a fake battery and a “genuine fake” one. At least the “genuine fake” uses the same black appearance of the original.

The “genuine fake” battery, after only 2 months of usage (not even 20 charge cycles’ worth), became so swollen that I can’t keep the back cover on. Running this battery through a bq27425-G2A battery gas gauge determined that the real capacity of the battery is a paltry 944 mAh, with an average internal resistance of 187 milliOhms. Absolutely pathetic.

samsung galaxy s ii replacement battery old ra graphGoes to show you get what you pay for. But some things may be more deceiving than others…