Power supply from USB device to Android tablet via OTG cable

I am working on a project that includes communication between an android device and an arduino. The final assembly of the project will be a box-like structure, in which only the screen of the Android device is visible (the other sides will be closed). Space is important; I would like the device to be as small as possible and use minimal cables. Communication with arduin was established using usb host apis. Now; Android tablet and Arduino connect via:

  • USB OTG cable on Android tablet (micro usb for men and usb)
  • Mini USB to usb on arduino (USB male and mini USB male)

Problem: I want the Android tablet to be able to charge itself through the connection.

Arduino is currently powered by an Android tablet. But; finally, the tablet and arduino will be connected together for hours; and it will push out the battery. The arduino board will receive power from an external source. I would like the tablet to draw energy from arduino. This works when the tablet is turned off; however, the tablet stops charging and starts to discharge as soon as it turns on.

This is probably because the tablet goes into host mode (like USB HOST) and arduino as a device / accessory. Typically, in such connections, the host sends power and the accessory on its own. Could this be the other way around?

My understanding is that in these kinds of connections, the host protocol (HNP) is implemented first to determine the host. Is it possible to force the Arduino host and tablet as an accessory? and in this case, is a correct connection possible?

Alternatively, is it possible to enable and disable host mode from an Android application?

The main goal is to be able to extract energy from the otg usb cable (I try to avoid using extra cables)

Please, if someone can help, it will be appreciated.

Thanx a lot ahead :)

+6
source share
1 answer

Your device will not be able to draw power when connected as a host.

You should take a peek at the Android Open Accessory (AOA) Protocol , although you need the appropriate hardware to connect.

AOA allows the tablet to connect as a USB accessory that will allow it to consume energy and charge, but also allows the Android device to behave as if it were a host sending commands to connected equipment.

+5
source

Source: https://habr.com/ru/post/948170/


All Articles