Author Topic: USB OTG + charger on a generic tablet?  (Read 9220 times)

0 Members and 1 Guest are viewing this topic.

Offline ArtlavTopic starter

  • Frequent Contributor
  • **
  • Posts: 750
  • Country: mon
    • Orbital Designs
USB OTG + charger on a generic tablet?
« on: September 26, 2014, 10:07:53 pm »
I want to use a cheap Android tablet as a touchscreen control terminal.
The thing that allows it to control is attached to it's USB port.

Problem is, it's the same port that is used for charging the tablet, and i want it to essentially hang on a wall always on.
So, in short - is it possible, in general, to power/charge a tablet that have a slave USB device attached over the same USB port?

There seem to be several OTG Y-cables, but these are specific to certain models, like Samsung phones.
But i can't find any generic solution, neither was i able to trace another USB or serial port on the tablet's PCB.

I can as a last resort just amputate the battery completely and replace it with an externally powered regulator giving the right voltage, but i would have preferred not to alter the tablet too much unless i have to.
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9318
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: USB OTG + charger on a generic tablet?
« Reply #1 on: September 27, 2014, 01:40:55 am »
Could you have the interfacing device act as a host, the way the ADK and Kelly Wu do? Otherwise, you could try hacking the kernel to switch the USB controller into host mode but leave the power controller in charge mode.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline sacherjj

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: USB OTG + charger on a generic tablet?
« Reply #2 on: September 27, 2014, 02:24:09 am »
USB OTG is triggered just with the pin 4 taken to ground.  This pin is not on full size USB connectors, only mini and micro.  Have you tried giving power to the jack when it is in host mode?  That is all the host mode y-cables do, unless the device they are for has a deeper multi function MHL port like the Samsung devices.

Personally, I would pop the tablet apart.  (Most cheap Chinese tablets have an easy method with a thin steel spudger.)  Then hook a regulated supply up to the place where the battery is soldered.  Give it nominal 3.7V and if it has a thermistor, try 10k to ground. 
 

Offline ArtlavTopic starter

  • Frequent Contributor
  • **
  • Posts: 750
  • Country: mon
    • Orbital Designs
Re: USB OTG + charger on a generic tablet?
« Reply #3 on: September 27, 2014, 05:42:13 am »
Could you have the interfacing device act as a host, the way the ADK and Kelly Wu do?
Any links?
Google keeps giving me some actress.

Have you tried giving power to the jack when it is in host mode?  That is all the host mode y-cables do, unless the device they are for has a deeper multi function MHL port like the Samsung devices.
Nothing happens.
It draws about as much power as the attached device should consume, and the tablet does not charge.

Personally, I would pop the tablet apart. Then hook a regulated supply up to the place where the battery is soldered.  Give it nominal 3.7V and if it has a thermistor, try 10k to ground.
Always an option, but i would have preferred something neater.
 

Offline mazurov

  • Frequent Contributor
  • **
  • Posts: 524
  • Country: us
Re: USB OTG + charger on a generic tablet?
« Reply #4 on: September 27, 2014, 05:50:14 am »
You can't do it on the USB connector. By spec, USB Host provides power and generally refuses attempts to power it from VBUS, especially if a port is OTG where it's a matter of survival.
With sufficient thrust, pigs fly just fine - RFC1925
 

Offline sacherjj

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: USB OTG + charger on a generic tablet?
« Reply #5 on: September 27, 2014, 04:39:47 pm »
You can't do it on the USB connector. By spec, USB Host provides power and generally refuses attempts to power it from VBUS, especially if a port is OTG where it's a matter of survival.

It will take some modifications.  Generally there is a mosfet that disconnects the USB power from the battery charging circuit.  This is so the 5V boost converter doesn't charge the battery from its own current. 

I have seen a few that allow charging of the battery if they detect external power.  They must not enable to 5V boost converter in that situation.  But with the pin 4 still shorted, it works on unpowered host mode with external charge.  This is pretty rare.

Again, I think the easiest is going to be to remove the battery and replace with 3.7V supply.
 

Offline ArtlavTopic starter

  • Frequent Contributor
  • **
  • Posts: 750
  • Country: mon
    • Orbital Designs
Re: USB OTG + charger on a generic tablet?
« Reply #6 on: October 01, 2014, 09:43:26 pm »
Hm.
All in all, no generic solution.

In the end what i done is solder some wires inside.
The battery is connected to the PCB with simply a + and - wires, nothing fancy.
So, i unsoldered the + wire, soldered to the PCB the new + and - ones that go outside, and a third one that gets the battery's + outside.

That way i can bypass the battery, but still have an option to switch back to it without much trouble.

Curiously, the thing complains about empty battery at 3.7V supply.
Upping it to 3.8V shows 30% charge, and to 3.9V - 60%.
That's not how you measure li-ion state of charge, is it not?
 

Offline ArtlavTopic starter

  • Frequent Contributor
  • **
  • Posts: 750
  • Country: mon
    • Orbital Designs
Re: USB OTG + charger on a generic tablet?
« Reply #7 on: October 04, 2014, 08:34:34 pm »
If only things were always simple...

Several days later, the tablet is showing 19% charge remaining.
Yet it is still powered from external 3.9V.
AFAIK, there is either a fuel gauge/coulomb counter chip in there somewhere, or the thing just counts the time it was on without a charge.

This makes me wonder - if it were to keep "declining" and trigger a low battery shutdown, what could be the options?
What sort of gauge chips are found in such devices?
Is there actually a chip, or can it be just counting time?
Is it feasible to bypass, and how?
Just in case anyone done a mod like that on a tablet.

Hopefully it will stop just above the 3% or so, and hover there until the battery is actually below 3.6V before triggering it.

 

Offline ArtlavTopic starter

  • Frequent Contributor
  • **
  • Posts: 750
  • Country: mon
    • Orbital Designs
Re: USB OTG + charger on a generic tablet?
« Reply #8 on: October 05, 2014, 11:56:39 am »
As expected, it did in fact shut down claiming empty battery, and won't let me turn it on again.
Good news are, once the power was unplugged and plugged back again, it happily turned on and reported 60% charge.
Apparently, it estimates the power available by reading the battery voltage at the start, and then counts either time or charge used, thus giving a current SOC estimate.

Interesting...
 

Offline sacherjj

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: USB OTG + charger on a generic tablet?
« Reply #9 on: October 06, 2014, 04:10:29 pm »
As expected, it did in fact shut down claiming empty battery, and won't let me turn it on again.
Good news are, once the power was unplugged and plugged back again, it happily turned on and reported 60% charge.
Apparently, it estimates the power available by reading the battery voltage at the start, and then counts either time or charge used, thus giving a current SOC estimate.

Interesting...

This is really the only valid way of doing it.  It is near impossible to estimate power left based on voltage level of the battery, unless you include corresponding current load at that point.  But this data shifts as the internal resistance of the cell changes due to time or cycle aging.  It gets even harder with chemistries that are flatter than LiCO, such as LiFePO4.
 

Offline ArtlavTopic starter

  • Frequent Contributor
  • **
  • Posts: 750
  • Country: mon
    • Orbital Designs
Re: USB OTG + charger on a generic tablet?
« Reply #10 on: October 06, 2014, 06:34:59 pm »
Yeah, but i was expecting it to be a little bit smarter and look at the actual voltage before declaring the battery dead.
I.e. my cellphone does get stuck at 3% for some time before continuing to move down - supposedly waiting for the voltage to go below a threshold.
So i thought that this dead reckoning comes together with reality checks when possible, not completely on it's own.

Meanwhile, upped the voltage to 4.1V to see if it will make a difference.
Also, took another look inside it.
The battery wires go straight to a cluster of inductors and capacitors with AXP202 chip in the middle of it.
AXP202 appears to be a power management IC, which includes the charger, USB OTG controls, output voltage regulator, fuel gauge, you name it.

However, it apparently can only output percentage of charge remaining, not react on it. So, the actual shutdown logic appears to be somewhere in the main CPU, or perhaps even the kernel.
On the good hand, the thing is all-digital controlled, so it should be easy to tweak. On the bad hand, i have no clue where to get the kernel for this thing.
The saga continues... And all i wanted was a touchscreen. :(
 

Offline sacherjj

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: USB OTG + charger on a generic tablet?
« Reply #11 on: October 06, 2014, 08:28:42 pm »
AXP202 is similar to the AXP209 that I've dealt with on the Allwinner A10/A20 platform.  It might be worth cutting the trace on the DC in for that chip and providing power there.  See if it stays in OTG mode, as the APX series had a USB in and DC in, if I remember correctly.
 

Offline trustfm

  • Newbie
  • Posts: 7
Re: USB OTG + charger on a generic tablet?
« Reply #12 on: October 07, 2015, 08:18:00 pm »
Hello , i am having the same problem with a generic tablet.
I have tried multiple resistors at pin 4 - 5 with no clue.
If i use 9K and less the tablet is on OTG mode and it is not charging
If i use a higher value (up to 600k i have tested ) than the tablet is charging but no data detection  is enabled.
I have also used a trim pot 200k nothing ...
Do we have any solution to this problem ?
Right now the only way i know is to use a tablet with a separate 5V charging jack but these tablets are more and more difficult to find these days ... 
« Last Edit: October 07, 2015, 08:23:39 pm by trustfm »
 

Offline DanielS

  • Frequent Contributor
  • **
  • Posts: 798
Re: USB OTG + charger on a generic tablet?
« Reply #13 on: October 08, 2015, 07:34:46 am »
Do we have any solution to this problem ?
This "problem" is simply USB OTG working exactly the way the specifications say it should work: the host always provides power.

The only way to 'fix' it is by using a tablet that supports the USB Power Delivery specification with a powered hub that also supports USB-PD on the host/upstream port.
 

Offline trustfm

  • Newbie
  • Posts: 7
Re: USB OTG + charger on a generic tablet?
« Reply #14 on: October 08, 2015, 08:27:06 am »
DanielS thank you for your response.

The OTG specifications say also that :

Three additional ID pin states are defined[4] at the nominal resistance values of 124 k?, 68 k?, and 36.5 k?, with respect to the ground pin. These permit the device to work with USB Accessory Charger Adapters that allows the OTG device to be attached to both a charger and another device simultaneously.[6] Source : https://en.wikipedia.org/wiki/USB_On-The-Go

Have a nice day


 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf