Friday, June 21, 2013

What's inside a Nokia BL-5Cx battery?

On my route to a still embryonic robotic project, I started looking for sources of energy. Among several dozens of assorted batteries, I found a stack of Nokia batteries I've kept from defunct mobile phones. These are all the same size and of slightly different thickness, all having a similar reference printed on, BL-5Cx. They are single cell Li-Ion batteries, with a nominal voltage of 3.7V, and different capacities, as stated below.

Model
Capacity
R (BSI)
BL-5C970mA/h(?)81.5KOhm
BL-5CB800mA/h29.8KOhm
BL-5CA700mA/h46.8KOhm
BSI-Battery Size Indicator

Intrigued by the extra connection in between the positive and negative, and suspecting of some kind of temperature dependent indicator (before I seriously googled about it...), I decided to dismember one of the batteries and check if this was attached to some temperature dependent resistor.

To my dismay, after carefully removing the top of the battery, I found a small PCB inside:


(Sorry for the barrel effect, but the photo was taken through a jeweler lens. This is a tiny PCB, measuring 20x5 mm)

This is by no means a NTC or PTC resistor... This is a well crafted protection circuit, as well as a pair of resistors that inform the outside world of the type of battery this is.

The thermal protection I expected to find, is not part of this circuit, rather takes the form of a thermal fuse, that goes off at some predefined temperature that I could not determine, as I tested its efficiency by using brute force methods, meaning "put soldering iron tip close to the fuse till it conducts no more".

So, driven by an increasing curiosity, I decided to find out what were these ICs and what role they played in the protection of the battery.

Armed with Google and a lot of patience, I found that the leftmost IC, marked 2450B, contains a pair of MOSFET transistors, while the center IC, marked M5A581, is designed with a few goals in mind, namely: avoiding overcharge, short circuit and overdischarge situations, that might endanger the cell.

I managed to find the datasheets for both ICs, from NEC and Seiko. The ICs on my battery were certainly manufactured by some obscure factory somewhere in China.

NEC 2450B Datasheet
Seiko s8201 Datasheet

The circuit depicted on page 25 of the Seiko datasheet is the one implemented in the battery. I don't have the means to measure the capacitors, but I guess, by their colors, that they match the schematics on the datasheet.

As for the mechanism used for the BSI (Battery Size Indicator) pin, I can only guess it is a resistor placed between this pin and the negative pole of the battery. My eyesight and my rude lenses don't allow me to fully check the circuit.

I'm on my way to design a simple and effective circuit to charge these babies, knowing beforehand that they are a bit more forgiving than the noname nobrand cells we usually find inside our gadgets.


Monday, November 12, 2012

Arduino Nano v3.0 bootloader

Last week I finally received a package from DX.com containing the Arduino Nano compatible board I've ordered nearly 2 month ago. For the price I've paid, just over $13, I wasn't expecting much and had already considered the money lost somewhere between China and Portugal.
Inside the package was the board, a long and thick USB cable and a small breadboard I've ordered with the Arduino. A long thread runs on the DX forum on the legitimacy of the name Arduino on these boards. That's another story.

I jumped to my netbook and downloaded the latest software package from arduino.cc. While downloading, I tried to mount the tiny board on the breadboard, just to find that either the board pins are too thick or the breadboard holes are too tight. Afraid of bending the pins or worse, breaking the board, I left it half way inserted.


In a hurry I connected the board to the netbook, which is running Windows7, by the way, and the USB to Serial drivers were installed straight away from Windows Update. So far, so good.
On connection, a bright tiny green LED came on. As the board comes with zero documentation, I didn't know exactly what this meant. Green is good, so move on.

Nano schematics: http://arduino.cc/en/uploads/Main/ArduinoNano30Schematic.pdf

After unzipping the package, a massive 90 MB file, I launched the Arduino IDE. This is very basic, and there's not much to configure, other than the COM port, the board type and the programmer which at that moment I hadn't realized if it would be necessary.
From then on, my patience was put to a test. Communicating with the board was a no go. No matter what setting I fiddled with, AVRDude, the program that talks to the micro, refused to establish a connection.

After hours of hell on earth checking every reference to this fact on Google, I decided that a new boot loader was the way to go. The boot loader basically is a piece of code that sits in the micro memory, taking about 2KB of space, and negotiates the upload of programs to memory, with the help of AVRDude or similar. The boot loader executes after the micro resets. It then waits for a few seconds for the serial lines to be active and to receive a predefined sequence of bytes indicating that a program is about to be upload.

The bad news were that my Nano board had come with a defective boot loader. There are two LEDs on the board, marked TX and RX, that blinked three or four times when the Upload button was clicked on the IDE. A few seconds later a message was displayed reporting there was a synchronization problem.
After installing AGG Software excellent tool Advanced Serial Port Monitor, I quickly found out that all attempts made by AVRDude to contact the Nano were being ignored.
No problem. The solution was on arduino.cc forums. A parallel port programmer is all you need to burn a new boot loader.

Parallel programmer on arduino.cc: http://arduino.cc/en/Hacking/ParallelProgrammer

A few resistors and some pieces of wire later, a programmer was ready to run.


Now, things can't be that easy. Although the programmer was built to the specs, failure hunted me back when trying to burn the boot loader, no matter what I did.
In total despair, I turned to the parallel port itself. In a rare moment of lucidity, I decided to look at the BIOS of the laptop. The port was set as bidirectional, and that sounded right. To fight the odds, I have decided to change the port setting to EPP (Enhanced Parallel Port). Reboot applied and voilá!
The Arduino IDE uploaded the boot loader in a few seconds, with the RX/TX LEDs happily blinking.
A minute later I was uploading my "blink" sketch to the Nano board.
Ufff!