Hao Jie Chan's Kingdom
SD Wing Zero Custom is done! Click here to check it out!

Ad 468 X 60

built of paper.

Monday, March 12, 2018

USB Ni-MH Battery Charger Part 3-The Schematic and Layout

I started this project thinking that I would try to fabricate it as I have never tried to fab a board before. But after I soldered on a perf board, laziness kicked in and I think I would just leave the project as it is.

Ni-MH Battery Charger Prototype

Ni-MH Battery Charger Prototype Topview

I goofed up big time during my component purchase. I wanted to order BQ2002PN, but because RS Online only sells them in a pack of 5, and I only wanted 3, I opted for another part, with “similar name. I thought it was the same! I bought 3 BQ2002TPN! I didn’t notice that until my controller just wouldn’t switch my current source on. I thought my soldering really sucks so much to the point that such a simple controller circuit wouldn’t work.

I noticed that the current source worked when the controller is not there, so I started poking around the pins and matched the readings with the datasheet. I found some discrepancies. My LED lighted up even though the current source was switched off. I’ve forgotten how did I find out I bought the wrong part, but that’s definitely a facepalm moment.

Anyway, I realised afterwards that BQ2002TPN only comes with temperature increate rate termination, dT/dt. Another facepalm moment, as my resistors were all designed for a dV/dt termination….. Another round of rework and adding in the thermistor, the design finally worked!!! And it worked so well that I could not believe it. It really terminated the charging after it detected a dT/dt of the battery. I have a plan to record and show the voltage waveform, but that can only be done during the weekend…

And for the schematic:

USB Ni-MH Battery Charger schematic

Still need some clean up. I’ve even picked-up FreeCAD to create 3D Model and produced a layout for this board. Well, maybe this project is not going to be fabricated, but the experience will definitely come in handy next time. Smile


The next post would be the end of this project series, it’ll be just a short post to describe how did I choose the resistor value to parallel with the thermistor. Hope you guys have fun reading this. Until next time!

Read More »

Sunday, March 11, 2018

USB Ni-MH Battery Charger Part 2-The Current Source

So I’ve looked around on the Web for a suitable design for my controllable high-side current source. I would like it to be as simple and cheap as possible. The first one is the usual Op Amp and FET combination current source circuit. But to power up an op amp using USB 5V I would need a rail-to-rail type, which is not that cheap. I stumbled upon this design. The answer also improved the initial design by adding a diode.

Constant Current Source

The idea is that, the voltage drop across R10 will be one diode drop, ~0.7V, so the current will be determined by the resistance of R10. Q1 is the ‘switch’ to control the current source from BQ2002. Q2 will adjust Vce accordingly to pass the current determined by R10. This also means that Q2 will have a big voltage across CE junction. 5V minus ~1.6V from battery, and 0.7V across R10, there’s still 2.7V across Q2, and we are passing around 0.7A. So that’s ~2W of power loss on Q2. This is not an efficient design, but it’s the simplest and easiest to be prototyped with my current stocks.

I needed to try this before buying any Power PNP. I used a configuration known as Quasi Complementary Pair to try my circuit. With a jellybean PNP and a Power NPN, they act as a Power PNP transistor. The circuit was commonly used during the old times when Power PNP had lower quality due to process technology. Anyway, my circuit worked, and I proceeded to buying a couple of TIP32 (as they are the most common parts and the cheapest….) and some BQ2002.

Read More »

Monday, March 05, 2018

USB Ni-MH Battery Charger Part 1-The End and The Beginning

These series of updates will focus on building a Ni-MH battery charger powered from USB. The main motivation is this: my battery charger from Panasonic got destroyed.Panasonic BQ-CC16

It is a Panasonic BQ-CC16. I bought it in 2014-15 time with 4 of the Eneloop cells. My wireless mouse is using one of the cell and they last so long with one charge, so I only recharge them when about 2 of them are discharged. Anyway, my mouse was out of battery that day, so I replaced it with another cell, but all of them apparently were already discharged. So I brought out the charger, pop it the cells and switched on the power. I saw sparks and fire coming out form the charger and soon, my other devices connected to the same extension were out of power. I had just burnt my fuse in the extension. Luckily, the extension still works after I replaced the fuse, and it is cheap. But the charger is not….

Arcing mark inside the cahrger

See the scary burnt marks from the arcing inside the charger? I’ll think twice now for placing my handphone charger so near to me when I am sleeping…


It seems like the arcing happens at the trace near R02 and TP10. Very strange as they are not that close, and nobody has any complaints about this charger being that dangerous. So, maybe I misused the charger? I only charge like 3-4 times a year, so maybe some dusts have accumulated inside and caused the arcing? I would appreciate your comments if you guys have any idea how this happened…


The top side of the PCB. Seems well build to me. No flimsy dangling wires around. So why did it arc??? And the arc even blew my fuse…

Since I don’t know how the charger work, I can’t fix it. Maybe I’ll just connect some sort of DC supply to the secondary side.

Anyway, I initially wanted to buy a new charger, maybe multipurpose one, for Ni-MH and also Li-ion. But I thought that this would be a good project to build my own charger from scratch. I’ve been trying to build one, but the lack of motivation pushed me further and further, until this day…

I’ve looked up on several off the shelf ICs, the MAX712 and LTC4060. They seem easy to use and are quite promising. But their prices are to high for a possibly one off project like this. (Or would anyone wants to buy ? Hahaha) So I searched deeper and found BQ2002. It’s just a controller to switch a current source on and off based on the battery condition. So, I locked it down to this controller IC and started to research how to implement the current source. Stay tuned to Part 2, for my journey into the battery charger realm!

Read More »

Sunday, October 30, 2016

Arduino Uninterruptible Power Supply (UPS) Improved

A reader left a comment on my UPS post, he asked me to share the ‘improved’ design.

I would not really categorise it as an ‘improved’ design because I simply removed the P-MOSFET.

I also added a switch when they would not want the Arduino to be powered on.


Arduino UPS

The UPS was meant to power up an Arduino Nano, from USB or a Li-Ion Battery.

I hope this blogpost will be helpful for anyone doing a small UPS for Arduino. Cheers

Read More »