Close

RTFD*

A project log for Yapolamp

An experimental torch/flashlight intended to be safer for eyes, completely inspired by and built upon the TritiLED project

simon-merrettSimon Merrett 06/15/2017 at 00:140 Comments

*Read the Flipping Datasheet

Or, "The secret life of the TP4056"

So, I built the MOSFET-based system I described in previous logs where one MOSFET was used to prevent the TP4056 from providing voltage to the charger's exposed contacts unless the Yapolamp was present. The other MOSFET was mounted "in reverse" on the battery side to prevent the battery from providing voltage to the Yapolamp's exposed contacts. Here's a picture:The green line denotes which parts would be on the Yapolamp (left side) and which would be in the charging unit (right). In the blue area you can see the inductor and MOSFET for driving the LEDs (LEDs not attached). The orange area is the TP4056 module. The red area is the Dickson Doubler and the user protection MOSFET + pull-down resistor on the charger. The yellow area is the user protection MOSFET and pull-down resistor on the Yapolamp. Note the red cable on the right of the picture which is used to feed the DC voltage into the Dickson Doubler. The white cable from the Arduino Nano to the Dickson Doubler is the 500Hz square wave that drives the voltage doubling circuit.

Does it work?

Yes, after a bit of work. Initially I couldn't get a sensible charge time for my poor quality 18650 lithium ion cells. The charge would take all night until the next morning. I wondered if I wasn't driving the MOSFETs to be fully on and low Rds but they seemed to have negligible voltage drop across them, so I cracked open a fresh INA219 high side current sensing module and connected it to a second Arduino Nano to see what current I was achieving. The nice thing about the INA219 and the Adafruit example sketch and library is that you get the voltage of the load too. I amended the example sketch so it would send raw streams to the serial plotter and ended up with the following graph for charging.The Y axis doubles as showing current in mA (the light orange graph plot line) and cell voltage x 100 (in blue). Everything to the left was with one of my cheap 18650s. It shows that the second you connect the TP4056 the internal resistance appears to drive the terminal voltage up from 3.6V to the level of 4.2V that the TP4056 is trying to give it, albeit with a current limit on that. The TP4056 appears to treat this as having reached the end of the Constant Current phase and switched to Constant Voltage, allowing the charging current to drop away quickly. This is what appears to be leading to the very drawn out charge times.

Everything to the right of the dotted dark orange line is the same circuit using a genuine Panasonic NCR18650B. It has no such problems and charged faster from a lower start point.

Reverse polarity engineering

Incidentally, I realised that I'd need a way to discharge the 18650s I'm experimenting with, so I bought some 25W 8 Ohm resistors and have connected 3 up in parallel to the 18650s:Green 25W resistors to the top left and INA219 module top right. This picture was taken AFTER I had accidentally wired it up in reverse (using a cheap 18650) and was merrily frying the TP4056 IC. I could see flux bubbling around the legs of the chip before I noticed. Was it irrevocably damaged (datasheet says no reverse polarity protection)? It was ! Pretty robust, although it may have been saved by the internal resistance of the poor quality 18650 and the power resistors drawing current in parallel.

But wait, there's a problem...

If the battery completely dies, there's nothing powering the microcontroller, so no square wave, so no voltage doubling, so no MOSFET gate driving and no charging connection between TP4056 and the 18650. Ohhh.

And I didn't RTFD...

The TP4056 datasheet isn't exactly the most thorough datasheet going but it does say:

No MOSFET, Sense Resistor or Blocking Diode Required

Does that mean it won't let current flow back from the battery side to the USB side if you remove the USB power? My digital multimeter and tongue both agrees - this module is cleverer that I gave it credit for.

Way forward

The combination of the backfeed protection built into the TP4056 and the flaw in the "dead battery" use case for my original design means it's time to look at another approach. I'd like to investigate a Hall Effect latching IC. That would only require a magnet in proximity to apply voltage to the charger's connectors but a small magnet would be constant, even when the battery has lost all charge. The circuit may be more complicated because I don't know if you can get an affordable Hall Effect IC which switches on=high.

On the bright side, if I take a slight hit on the physical volume of the Yapolamp, I can mount the TP4056 on the Yapolamp side and reduce the Bill of Materials by a whole MOSFET (and at least a resistor). Even better, the TP4056 modules I currently have are standalone but these days many come with Lithium ion battery safety chips to prevent overcharge and cut out at a low voltage. I have ordered some with the DW01 protection IC, as it seems the Venn diagram of protected 18650s and tabs is miniscule.

This would mean I just need to control the provision of 5V to the charger's terminals using the Hall Effect sensor. I think this could reduce the contacts required between charger and Yapolamp still further, which will make designing a charging dock easier.

Discussions