USB OTG + charger on a generic tablet? - Page 1
Forum section: electronics / projects

author: Artlav
author_rank: Frequent Contributor
timestamp: September 26, 2014, 10:07:53 pm
content: 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.

author: NiHaoMike
author_rank: Super Contributor
timestamp: September 27, 2014, 01:40:55 am
content: 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.

author: sacherjj
author_rank: Frequent Contributor
timestamp: September 27, 2014, 02:24:09 am
content: 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.

author: Artlav
author_rank: Frequent Contributor
timestamp: September 27, 2014, 05:42:13 am
content: Quote from: NiHaoMike on September 27, 2014, 01:40:55 amAny links?Google keeps giving me some actress.Quote from: sacherjj on September 27, 2014, 02:24:09 amNothing happens.It draws about as much power as the attached device should consume, and the tablet does not charge.Quote from: sacherjj on September 27, 2014, 02:24:09 amAlways an option, but i would have preferred something neater.

author: mazurov
author_rank: Frequent Contributor
timestamp: September 27, 2014, 05:50:14 am
content: 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.

author: sacherjj
author_rank: Frequent Contributor
timestamp: September 27, 2014, 04:39:47 pm
content: Quote from: mazurov on September 27, 2014, 05:50:14 amIt 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.

author: Artlav
author_rank: Frequent Contributor
timestamp: October 01, 2014, 09:43:26 pm
content: 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?

author: Artlav
author_rank: Frequent Contributor
timestamp: October 04, 2014, 08:34:34 pm
content: 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.

author: Artlav
author_rank: Frequent Contributor
timestamp: October 05, 2014, 11:56:39 am
content: 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...

author: sacherjj
author_rank: Frequent Contributor
timestamp: October 06, 2014, 04:10:29 pm
content: Quote from: Artlav on October 05, 2014, 11:56:39 amThis 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.

author: Artlav
author_rank: Frequent Contributor
timestamp: October 06, 2014, 06:34:59 pm
content: 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.

author: sacherjj
author_rank: Frequent Contributor
timestamp: October 06, 2014, 08:28:42 pm
content: 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.

author: trustfm
author_rank: Newbie
timestamp: October 07, 2015, 08:18:00 pm
content: 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 chargingIf 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 ...

author: DanielS
author_rank: Frequent Contributor
timestamp: October 08, 2015, 07:34:46 am
content: Quote from: trustfm on October 07, 2015, 08:18:00 pmThis "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.

author: trustfm
author_rank: Newbie
timestamp: October 08, 2015, 08:27:06 am
content: DanielS thank you for your response.The OTG specifications say also that :Three additional ID pin states are defined 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.Source :https://en.wikipedia.org/wiki/USB_On-The-GoHave a nice day