Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawing power from USB device to android tablet through OTG cable

I am working on a project which involves communication between a android device and arduino. The final assembly of the project would be a box-like structure with only the android device's screen being visible (the remaining sides would be enclosed) . Space is Important; i'd like the apparatus to be as small as possible & using minimum cables. Communication with the arduino has been established using usb host apis. Now; the android tablet and arduino are connected through:

  • USB OTG cable on the Android tablet (micro-usb male & usb female)
  • Mini-usb to usb on arduino (USB male & mini-usb male)

The problem: I want the android tablet to charge itself through the connection.

Currently the arduino powers itself from the android tablet. However; finally the tablet and arduino will be connected for hours together; and that'll drain out the battery. The arduino board will be getting power from an external source. I'd like the tablet to draw power from arduino. This is working when the Tablet is switched off; however the tablet stops charging itself and begins discharging as soon as it is turned on.

This is probably because the tablet goes in the Host mode (as USB HOST) and the arduino as the device/accessory. Usually in such connections, the host sends the power and the accessory charges itself. Can this be the other way around??

My understanding is that in these kinds of connections Host Negotiation Protocol (HNP) is implemented first to determine the host. Is it possible to forcibly make arduino host and the tablet an accessory? and in such a case will proper communication be possible?

Alternatively, is it possible to enable and disable host mode from within an android app?

The main purpose is to be able to draw power from usb otg cable (I'm trying to avoid using additional cables)

Please if anyone can provide assistance , it would be appreciated.

Thanx a lot in advance :)

like image 681
MMss Avatar asked Jun 26 '13 20:06

MMss


1 Answers

Your device will not be able to draw power while connected as the Host.

You should look into the Android Open Accessory(AOA) Protocol, though you need the proper hardware to connect to.

AOA allows the tablet to be connected as a USB accessory which will allow it to draw power and charge, but it also lets the Android device behave as if it were a host sending the commands to the connected hardware.

like image 74
TronicZomB Avatar answered Sep 28 '22 10:09

TronicZomB