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 :)