Using a battery from the iPhone when developing a portable
Quite often I have the task of developing portable devices powered by a single cell Li-ion battery. And, if the customer does not usually bother with this, then I, like an experienced engineer, have a shiver running across my back. This is due to the fact that assessing the level of battery charge, as well as remaining time of work - this is a very difficult task, although at first glance it may seem different.
There are several options for action in this case, we'll talk about them below.
ripitapart.com and www.macplus.ru . Please pay special attention to the unknown controller labeled A1141. This chip manufactured by PowerFlash and this is all the information that we managed to find. Author blog , from which I took the table, was not sure that he got the original battery from the iPhone SE. Below we will be forced to consider this chip in more detail. But for now look at the batteries:
As can be seen AKB for every taste and color, with and without apple. They can also be connected in parallel to increase capacity, with a separate polling. Of the disadvantages, it should be noted that the proportions of length /width are about 3: ? which is not always convenient, and also a unique connector for connection. Due to the popularity of Apple phones, these batteries can be safely purchased in many places and in large quantities (as it turned out, this is not entirely true).
When developing wireless standalone RFID reader we went exactly this way.
We chose a battery from the iPhone ? which suited us both in capacity and in size. Several copies were purchased in different places for verification:
The right was bought in China, the rest in Moscow. The cost is $ 6-11. When they are checked, interesting results will be obtained. Pay special attention to the box with the inscription "Origig", later we will return to it. The check was carried out using the RFID reader itself, the EV2300 programmer from TI and the Battery Management Studio program.
The RFID reader is shown in the figure:
Linear memory on the basis of STC4054 (TP4054), charging current 500 mA, power switch with auto-catch on the basis of the reed switch SF? capacitor C1? diode VD4 and resistor R1? and pulse converter based on NCP1529.
First I connected a copy from China for $ 6:
The battery responds, BUT the current was not displayed either during charge or during discharge, the voltage did not correspond to the actually measured value and the degree of charge did not change. He did not answer the commands of the AKB. There was an assumption that this copy was a fake, so he took off his protective tape to look at the board:
This is a twist I did not even redraw the scheme - it's clear that there is a bq27545 emulator and a protection circuit for recharge /recharge. Immediately appeared the thought of saving yourself time and revealing all the batteries.
The neighbor to the left of the Chinese colleague for $ 8 is similar to the difference in marking on chips. In the rest behaves the same way. These 2 copies are immediately in the trash. Unfortunately, I did not have the iPhone 6 on hand to check these batteries in the target device, it was very interesting to see how the phone would behave when working on these batteries.
And this is a central battery, worth $ 8. It even has a current sensor and some 8-pin microcircuit with a modest 6G3 marking. In Battery Management Studio, this battery pretends to be bq27545 more skillfully. The charge level, the correct voltage, and the battery current are displayed. But if all this was real, then a fake would not be a fake. In reality, the temperature was set by a constant, the current was measured very poorly. The picture shows the current consumption RFID reader, which is measured by the battery with a constant reading card.
In reality, it is ~ 55 mA for this mode of operation and, since the reader field is always on, zero can not be. When charging (when the current is constant over a long period of time), the current sensor operates normally. Naturally, all other parameters are not calculated correctly (the level of charge, the time of operation until the full discharge, etc.). The FC flag (Full charge) is set at 4.4V.
The battery does not respond to commands, the flags QEN and RUP_DIS are not set. In general, this is an unsuccessful attempt by the Chinese to write the bug of bq27545 on the MK (in any case, I think that this is so). Also in the garbage.
Remember, I asked to pay special attention to the copy in the box with the inscription "Origig"? It was he who was as close as possible to what we were looking for (and how now not to believe advertising?):
The cost was $ 9. In the center, the chip with the marking SN27545 is clearly visible - this is exactly what we were looking for. With this copy I began to work more tightly. During the trial cycle of charge-discharge problems arose. I could not get the FC flag set (Full charge), which meant the end of the charging process. The charge current at the battery voltage close to 4.2V became extremely small (about 20 mA) and the charging process did not end never. One of the possible reasons was a USB cable with a large drop in voltage (up to 4.5V chip), we replaced it with a better one with a lower voltage drop. The performance improved, the battery was charged up to 4.2V, the current dropped to ? but the SOC (State of charge) reached only 8? so the FC flag was not installed.
For several days I chased the cycles with the expectation that the battery would be trained, but this did not help. The problem turned out to be banal, but her search took 2 days. At some point, I noticed that the battery at ???V and this was the answer to all questions. The memory is standard at 4.2V and I did not notice at all that the battery is at ???V and there is an incomplete charge. Since the boards have already been manufactured, the only option to properly exit the situation was to search for a replacement STC4054 with a voltage of ???V. It turned out that such chips exist, but in our great country they can not be bought peacefully (apparently unpopular from the word at all). Therefore, the order MCP73832T-3 was ordered with a wait of a couple of weeks.
Well, while the ordered is going, we will make a collective farm patch to test the concept. To do this, we will make a "backup" of ???V for the memory chip using a diode:
We must admit that the collective farm has earned, the FC flag has been installed, everything works, but the final voltage of the battery is 4.4V (the drop on the diode is more than the required ???V).
It is important to note that it is possible to charge up to 4.2V with a corresponding loss of ~ 15% of capacity, but at the same time substantially prolong the life of the battery. We finished the copy of Origig - it can be safely put into development.
Remained the last copy. The most expensive ($ 11), in the steepest packaging and demanded the most time for yourself. Look what's inside:
Here it is an unknown microcircuit A1141 for which there is no documentation except manufacturer pages . If you force to connect both to bq27545 in Battery Management Studio, we see the following picture:
Full garbage. When trying to charge a current of ~ 500 mA, it shows 125 mA, with a current of ~ 25 mA shows 214 mA. It is clear that if A1141 has other parameter addresses or is different from the bq27545 data storage format, then without documentation with this battery, nothing shines. Therefore, she was put aside, but at the end of writing the material, I decided to connect it again. I took the command table of the chip bq27545:
And I counted the voltage registers (0x08 and 0x09) through the Advanced Comm:
Get 0x108 | 0x38 = 4152 or ?152B, which corresponds to the voltage measured by the multimeter ?15V. So if the data is correct, why does the program display 57mV ??? We note that 57 mV is exactly 0x3? that is, the value 0x08 of the register. When the voltage on the battery is ???V, the charge level in 96% looks quite correct, it can be obtained by counting the registers 0x2c and 0x2d. Read 0x2c = 0x6? 0x2d = 0 (in the case of the SOC parameter, the upper register is always zero). There was an assumption that the program or EV2300 can not count (or the battery does not respond) either the high byte in the request, or the byte with the odd address. To test this theory, the battery was connected directly to the RFID reader and the battery was polled through the MK. The HDQ interface was implemented according to document from TI . The bq27545 chip for communication with the control controller uses a single-wire HDQ protocol, which on the STM32 is quite conveniently implemented on the basis of a single-wire UART thanks to the support of the Half Duplex mode.
Because our RFID reader is working on MicroPython, we wrapped the HDQ in the class and got work with the charge controller in the following form:
from hdq import HDQ
bat = HDQ (pyb.UART (1))
bat.charge () # charge
bat.read_u16 (0x14) # arbitrary register
In fact, it turned out that A1141 does not respond to a read request for bytes with odd addresses.
The oscillogram shows that there is a query, but there is no answer. When the logic of the data exchange (Break) was added before each request - through time, but the chip began to respond correctly.
Then, the exchange rate of the EV2300 and the RFID reader was compared and it turned out that the EV2300 uses a speed lower by 10-15% than the TI setting:
After reducing the speed of HDQ and performing Break with each request, the battery is working properly! The main battery parameters were read:
Complete victory! In fact, A1141 turned out to be a high-quality bq27545 clone with small flaws. It remains to tell about the nuances of working with the battery on the part of the software (using sleep modes, awakening current, etc.), but this will double the amount of recording and, perhaps, I'll write it another time.
As you can see, there are many options for the development of devices powered by a Li-ion battery. To tell the truth, it was originally planned to write material in the style of came, saw, won, but in the process a lot of nuances came out (especially good fight with A1141) and the material turned out to be very interesting and extensive. AND5 batteries, only 2 can be used normally. Therefore, the choice of supplier in this case is very relevant. If you have seen AKB from other devices that contain a BMS, then write the model in the comments. Thank you all for attention!
It may be interesting
This is my first time i visit here. I found such a substantial number of interesting stuff in your blog especially its examination. Really its inconceivable article. Keep it up.Gulf Coast Western Reviews
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business.GSM Solutions
Thankyou for sharing the data which is beneficial for me and others likewise to see.Gulf Coast Western Reviews
Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.GSM Solutions
Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work.thc vape juice