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

Ad 468 X 60

built of paper.
Showing posts with label Electronics. Show all posts

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 »

Friday, April 29, 2016

Magnetic Levitation with Arduino

Hello guys! I posted my Magnetic Levitation project on Hackster.io! It is really a great site to share your own project!
Here is the link to my project: https://www.hackster.io/chanhj/magnetic-levitation-8c3ad0?ref=custom&ref_id=45065&offset=4

Magnetic Levitation

Even though I’ve posted some brief intro and instructions there, they are not very detailed. But then I am a lazy guy, so if you need more details, just leave a comment, maybe I can improve the post?
It's made with a U3503 Linear Hall Effect Sensor, a MOSFET and a LED. :D It is that simple.

Magnetic Levitation Circuitry

Magnetic Levitation Circuitry Interfaced with Arduino UNO

My code is copied directly from another guy listed in my hackster project. All credits go to him, I only edited the PID parameters. However, his code does not compensate for the field generated by the coil itself, maybe I can research more on that, keep planning... Less doing, all the time...

I have since then found another levitation project to make, it’s a rotating globe, with blinking LEDs! Who doesn’t love LEDs right? Until next time, keep making things! :D

Read More »

Sunday, January 17, 2016

A Buck Converter Power Supply

Power Supply

This project has been in my mind for a long time. I have always wanted an easy to use power supply, without resorting to Arduino for a 5V supply. With the addition of a cheap DIY oscilloscope which requires a 9V supply, this project became more and more important.
With the start of my sem break, this long overdue project finally got the chance to be completed.

Power Supply2
Another shot at the completed project exterior.

Power Supply Interior
The interior.

Power Supply Interior2
Okay, time for some explaination. This “power supply” is basically just a buck converter, I am using a cheap one from China, using MP1584EN as the switching IC.
My plan was to change the SMD potentiometer, to a bigger one which can be turned by hand. (I was frustrated by the need of a screwdriver just to change the voltage level.

The input is taken from a laptop adapter, which I have one laying around.  So, it is a 19-21V to maybe 0.8V-18V supply with a maximum of 3A load ( that’s what the datasheet and seller claims, I would not use it for more than 2A personally. )

Power Supply Interior3
The potentiometer solder pads were quite small and were ruined when I desoldered the pot. Heck I even spoil the pot! Then I put a 10K potentiometer initailly, found out that my input would not rise over 2V. I figured my resistance was too low for the feedback path. I then change the pot to a 100K pot. Better, but the voltage stopped at 10V. Can be used, but I wasn’t satisfied. I found that the resistor value is different for 2 batches of boards. Refer to the following photos.

MP1584EN board
This is from the old batch, green colour board. Now If we zoom in to the resistor,

MP1584EN board closeup
It’s 322, as in 3.2K ohm.

MP1584EN board new
The new one, (as in the one I used), blue board, has a 822 SMD resistor, 8.2K ohm. The potentiometer forms a potential divider with the resistor to produce a feedback to the IC. The IC requires 0.8V at the feedback. 100K is simply too small for me to generate up to 18V.

Thus, I hacked the board, again. I have some 10K SMD resistors around. I simply soldered them on top of each other, to reduce the resistance. SO in the end, it’s 8.2K//10K//10K = <5K ohm!
And that worked! Circuit theory rocks! Open-mouthed smile Sorry I just have to bask in my glory for a little while.
Now, I can move on the next project, which is still undecided.

 See you next time!
Read More »