Close
0%
0%

Magic smoke enabled 18650 LiPo battery pack.

More mildly perilous fun with recovered 18650 LiPo cells and cheap Chinese goods.

Similar projects worth following
This is a follow up project to the "Sticks 'O Dynamite" 18650 battery pack I posted a while back. This time we take a slightly different route to add power/peril to our projects. We will use a "Power Bank", and wire directly to the LiPo cells. What could possibly go wrong?

TP4221 Based "Powerbank" mods.

Note: We are dealing with unprotected 18650 LiPo cells here. If you don't understand the risks of playing with unprotected 18650 cells, go away and read up about them before proceeding. You can also read my previous project on this topic.

TP4221A/B/C based "Power Bank" chargers litter the internet, and are generally of relatively poor construction, however on the flip side, they are cheap. Cheaper in fact than buying cell holders and a USB charger module. Therefore they make an almost ideal hackable 18650 LiPo (3.8V nominal) source. I say almost... they suffer from a few failings.

Note that not all "Powerbank" chargers are based on the TP4221, those that are, however all share the design below, with a few variations (single or double USB output, greater output capacity, 2, 3, 4 or more 18650 cells and so forth. They typically have only one button and a 3,4 or 5 LED "user interface". They may, or may not have the "Torch" facility.

A). The datasheet for the TP4221A/B/C is in Chinese ( http://www.datasheetbay.com/PDF/download.php?id=914396 ) Translated (badly) ( https://translate.google.com/translate?hl=en&sl=zh-CN&u=http://datasheet.d4usemicon.netdna-cdn.com/pdf/914396/TP4221B.pdf&prev=search ). I have yet to find an English language version. Google translate will help you out, if you need more details.

However since the schematic is written a language we can all understand, I've included it here.

Notice the LIT output. This is, according to the datasheet a 100mA NMOS Fet acting as a low side switch, intended to be used as a torch with a 100mA max LED (as shown in the diagram). It is switched on by two short presses of the status button (S1 in the diagram). This means that we can wire up the SWT input, and send it a couple of 500ms low pulses, separated by a 500ms high and the controller will switch on the LIT output.... so... whip off the LED, fire on a 2 pin header and you now have a switch-able 100mA 3.6v nominal feed from our Lipo.

This is perfect for low power microcontrollers, and has the advantage that if the battery gets low the TP4221 will shut it down for us.

The picture above shows the board modified with header pins replacing the LED and the button (K1) wired to a socket. Additional wires are brought out of the front from the Lipo. Note that there is no over current protection, except for that tiny little 000 Ohm link between the B- and Gnd pads.

This is not ideal, I would suggest removing the zero ohm link and substituting a 2A micro fuse. However... I'm willing to live on the edge here, my metric calibrated eye suggests that little link will pop before the LiPos do. This brings me on to the next failing of these little power banks.

B) There is no protected 3.8V nominal output directly available, this is not a worry if you intend to use the 5V output, but if you want maximum efficiency, and therefore want to run directly from the cells, you will need to ensure your micro-controller, or whatever you intend to power shuts itself down when the supply drops to a point where it may damage the cells.

I will be using a Canon Powershot camera and CHDK with a dummy battery in the camera. Since the Canon camera shuts itself down when the battery voltage gets low (<3.2V typically), I wont worry too much about this. I would advise checking the cell voltage before each charging session, just in case it has dropped to a dangerous level (<2.8V), or any of the cells have failed.

Now for the third gocha.

C) The 5V USB outputs will shut down (or fail to start) if the load on them is <50mA, at least that is what the datasheet appears to say... I haven't verified this.

... and finally in my criticism of this otherwise useful little device.

D) The build quality of some of these "Power Banks" is dreadful. I guess for $2.45, what do you expect, gold plating?

Here is the ebay listing for the devices I purchased.

(http://www.ebay.co.uk/itm/331685404010?_trksid=p2057872.m2749.l2649&var=540810026095&ssPageName=STRK:MEBIDX:IT...

Read more »

  • Lashing it all together.

    andyhull12/16/2015 at 21:38 0 comments

    I did a little more work with this over my lunch hour today, I added an ESP8266 to the mix to let me test the idea of switching on and off the "torch output".

    See ... http://stm32duino.com/viewtopic.php?f=45&t=745&start=50 for a full run discussion of what was involved.

    I took an existing arduino ESP8266 sketch that allows me to toggle the LED on GPIO Pin 2 using a web page on the ESP8266 and modified the sketch to send a couple of pulses to the battery pack to switch on the "Torch LED" MOSFET. I then lashed up a 3V relay with a snubber diode and some flying leads and attached the coil in line with the +Vbat and the Torch Out MOSFET. Switching on GPIO4 turns on the MOSFET which acts as a low side switch and switches on the relay.

    I attached the relevant pins to the wires I had previously run out of the battery pack. The big mess 'O wires in below is the result. (The wires exiting from the bottom of the picture go to my USB to serial converter used for programming).


    When I visit the web page, now as well as toggling the LED on pin2 the ESP8266 code sends a couple of pulses via GPIO4 on the ESP8266 to the button pin on the battery controller via a 2K resistor. Result.... I get a very satisfying click from the relay, as it latches on or off, depending on its previous state.


    The ESP8266 GPIO cannot drive a 50mA relay (they are limited to 12mA source, 20mA sink), but the "Torch LED output" pin on the battery pack can.


    A sequence of 300ms LOW, 300ms HIGH, 300ms LOW and back to HIGH seems to be the sweet spot to make it work 100% of the time.

    #include <ESP8266WiFi.h>
    ADC_MODE(ADC_VCC);
    const char* ssid = "yourssid";
    const char* password = "yourpassword";
    
    int relayPin = 4; //GPIO4
    int ledPin = 2; // GPIO2
    WiFiServer server(80);
    
    void setup() {
      Serial.begin(115200);
      delay(10);
      ESP.getVcc();
      // Start up, switch on the LED and set the relay toggle pin HIGH
      pinMode(ledPin, OUTPUT);
      digitalWrite(ledPin, LOW);
      pinMode(relayPin, OUTPUT);
      digitalWrite(relayPin, HIGH);
    
      // Connect to WiFi network
      Serial.println();
      Serial.println();
      Serial.print("Connecting to ");
      Serial.println(ssid);
    
      WiFi.begin(ssid, password);
    
      while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
      }
      Serial.println("");
      Serial.println("WiFi connected");
    
      // Start the server
      server.begin();
      Serial.println("Server started");
    
      // Print the IP address
      Serial.print("Use this URL to connect: ");
      Serial.print("http://");
      Serial.print(WiFi.localIP());
      Serial.println("/");
    
    }
    
    void loop() {
      // Check if a client has connected
      WiFiClient client = server.available();
      if (!client) {
        return;
      }
    
      // Wait until the client sends some data
      Serial.println("new client");
      while (!client.available()) {
        delay(1);
      }
    
      // Read the first line of the request
      String request = client.readStringUntil('\r');
      Serial.println(request);
      client.flush();
    
      // Match the request
    
      int value = digitalRead(ledPin);
      if (request.indexOf("/LED=ON") != -1)  {
        digitalWrite(ledPin, LOW);
        value = LOW;
        toggleRelay();
      }
      if (request.indexOf("/LED=OFF") != -1)  {
        digitalWrite(ledPin, HIGH);
        value = HIGH;
        toggleRelay();
      }
    
      // Set ledPin according to the request
      //digitalWrite(ledPin, value);
    
      // Return the response
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println(""); //  do not forget this one
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");
    
      client.print("Led pin is now: ");
    
    
      if (value == LOW) {
        client.print("On");
      } else {
        client.print("Off");
      }
      client.println("<br></br>");
      client.print("Battery Voltage: ");
      int batteryVoltage = ESP.getVcc();
      client.print(batteryVoltage / 1000);
      client.print(".");
      client.println(batteryVoltage % 1000);
      client.println("<br></br>");
      client.println("Click <a href=\"/LED=ON\">here</a> turn the LED on pin 2 ON<br>");
      client.println("Click <a href=\"/LED=OFF\">here</a> turn the LED on pin 2 OFF<br>");
      client.println("</html>");
    
      delay(1);
     Serial.println(...
    Read more »

View project log

Enjoy this project?

Share

Discussions

andyhull wrote 11/19/2015 at 14:24 point

"I wonder if their app circuit would even work with that C4 connected in parallel to their internal MOSFET in a boost converter."

Interesting point, I didn't analyse the schematic, but I assume that it does.. I should really get the scope out and see just how lumpy all of the outputs are.

 "There are USB power switch chips that have logic level control and built-in over current protection (UL recognized no less). e.g. Diodes Inc make tons of them. " 

"Yea, but if it don't look a joke then it 'aint going to smoke.."  and where's the peril in that...

This particular project sits firmly in the "cheap" corner of the iron triangle.. ( https://en.wikipedia.org/wiki/Project_management_triangle ) Quality at this price point is obviously optional. 

I freely admit that these things wouldn't make it in to a production device if I were designing it for long term use, and even the minimum of safety, but that is not really the objective here.

  Are you sure? yes | no

K.C. Lee wrote 11/19/2015 at 12:29 point

I wonder if their app circuit would even work with that C4 connected in parallel to their internal MOSFET in a boost converter.

There are USB power switch chips that have logic level control and built-in over current protection (UL recognized no less). e.g. Diodes Inc make tons of them.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates