12V from a USB Powerbank

I own an audio recorder which eats AA batteries just like I need air to breathe. Also it's weird and annoying to swap a pack of 8 every 3 hours or so.

Of course there are other options of powering the recorder like buying expensive battery packs for cameras and whatnot.
But I have no use for them otherwise and they mostly require special chargers wich I'd also have to buy.

So I used slightly puffy LiPo-packs for a while, but they stille need special chargers I'd need to carry around.

One day I saw an USB power bank which had a separate connector from which you could jumpstart your car. Weee excitement! But it still was quite expensive and all of them looked weird or where unnecessarily bulky.

But then some online shop kept suggesting me power banks all the time (thanks Jeff) and more and more QuickCharge power banks appeared. It came how it had to. I gave in and clicked.
Some of them could supply 9V and 12V? How? Why?

Turns out there is a proprietary protocol devices with Qualcomm chipsets can use to increase the voltage provided by the USB-charger.
I never heard of it before because I get my thrills from using puffed lipo packs, not Android phones. :D

So how does it work?

QuickCharge Handshake

So what's the magic handshake? How hard can it be?
Qualcom kindly documented it in their Patent.

Basically you apply 0,4V-2V to D+, wait for D- to be pulled down to <0,4V and apply voltages according to the following table to the data lines.

Voltages

Turns out you can actually do it by hand and someone did it. Youtube Video Just be careful not to glitch too much or apply hum to the data lines. My power bank then leaves QC-mode. It still worked, sometimes. \o/
All you need is a 3.3V regulator and some resistors 2:1, in the thousands of ohms.

Automating it

So for field recording gear a breadboard isn't that good. So how automate it?

I had some Digisparks at the bottom of my junk drawer. They had all it need:

  • USB connector
  • Microcontroller
  • small form factor

But to make it work I had to do quite some changes. Especially I needed to take care of the Vcc net on the Digispark. It's attiny85 is supplied directly from the USB's VCC which will get changed to 12V, magic smoke guaranteed.

Luckily it's an Open Source Hardware Design, so documentation is available [online].(http://digistump.com/wiki/)

(The 5V net now becomes 3,3V)

Remove Regulator

First remove the 5V voltage regulator and expose the trace at the bottom right.

Cut a trace on the bottom to separate Vusb from our now 3,3V net.

Add a 3,3V regulator, which had to be convinced to fit on the given footprint, also swapping input and output from the original design.

Bridge the trace exposed previously with the output pad of the regulator (bottom right) to supply everything with 3,3V.

Add a 10k resisor on top of D2 to pull down D- and give ~1V when pulled up with the internal pullup of the attiny (~20k) and 3,3V when tied to Vcc trough the pin.

Remove R3, so the power bank can pull D- below 400mV.

Now we need to flash the right voltage pattern to the microcontroller. I did that via HVSP because of the Bootloader in the Digispark which disables the reset line. It can probably also be done with the USB-bootloader, but I didn't try that.

Code

//
//A simple Programm for attiny85 to trigger QuickCharge
//Written for modified Digispark by @diodenschein
//
//

#include <avr/io.h>
#include <util/delay.h>

int main (void)  
{
    DDRB = (1<<DDB1); //LED on Digispark
    _delay_ms(2000); //wait for everything to get settled
    PORTB = (1<<PB4)|(1<<PB1);
     //Apply 0,7V to D+ via internal Pullup ~20KOhm, Turn on LED
    _delay_ms(4000); //Wait for detect && D- getting discarged.
    int v = 1;
    if(v){// trigger 12V
        PORTB = (1<<PB4)|(1<<PB3); //Additionally pull D- to >400mV
    }
    else { //trigger 9V by raising D+ to 3,3V, D- to >400mV
        DDRB = (1<<DDB4)|(1<<DDB1); 
         //Set D+ pin to "strong" output pulling it to 3,3V
        PORTB = (1<<PB4)|(1<<PB3);  //Set D- to > 400mV
    }
    while (1) { //Loop forever and ever and..
  }
  return 1;
}

That worked for me, but it's probably a good idea to actually test if D- is being pulled low. That gives you a chance to know if you are really using a QC port. One could also check Vusb with a voltage divider and an internal ADC.
Keep in mind, that the delays are not actually milliseconds, just somewhere in that range, due to the imprecise internal oscillator of the attiny.

Wrapup

Now you can grab 12V (or 9V) from the Vin and GND pad, add what ever connector you like and your good to go. Most power banks also have current limiting and turn the output off when something is drawing too much current.

There are a couple of QuickCharge power banks on the market now.
The one I bought has the advantage it also charges fast with QC.
Link (Amazon Affiliate Link)

It works like a charm and has enough juice for around 12 hours, plenty enough for my recorder and my phone throughout the day.

Ideas

There is also a so called QC continuous mode. That allows you to select any output voltage from 5V to 12V in 200mV increments.
Sounds like I nice field/lab supply project to me.

Of course you can use this as a power source for whatever gadget you like:
12V Battery charger, Mifi, Fritzbox or low power Ham radio gear.

This hack also works with QC mains chargers, so when you need 12 or 9V you can get it there.

Other alternatives are USB-PD which even gives you more power. But I don't know of any power banks with higher voltages. But someone built a 60W USB powered soldiering iron with it.

Sources

Twitter