I’m trying to set up an Android Open Accessory environment with no success. I’m using the PIC32MX250F128D controller on my board, I’ve implemented a Firmware that works in USB Host mode and handles all the Android Open Accessory Protocol. I have also an Android App to detect any external hardware plugged in the USB conector. The problem is that I’m not getting any USB “physical answer” from the tablet. From the USB 2.0 Standard (and from this document as well https://source.android.com/accessories/aoa.html ) The Accessory (the external hardware), acting as a USB Host, should wait for a 100miliseconds signal from the USB Device (Android Device, tablet, smartphones, etc..). That’s the very first step on the USB Phy Standard. What might be happening is that the USB on the Tablet side is acting as a Host and also waiting for this signal from an external Hardware. Is there any android configuration that enables USB open accessory, or something like that? Also, How can I know in which mode the USB in android is operating, or what is the "normal" mode USBHost or USBDevice?
Finally I've got it solved :). I wasn't able to detect any hardware signal, the hardware signal is either D+ or D- pin set to high and the other to low. If D+ is set to high the USB Device operates in full-speed mode, otherwise in low speed mode. I've found out that Android works in host or device mode looking at the cable plugged in. My cable was telling android to operate as host, so I didn't receive any Device Attach signal from Android.
I was developing a tablet application for controlling a circuit but now i stuck here somewhere.. there are a few options that i think about what to do after this stage. I need 2 usb ports , one for a usb serial converter (namely pl-2303) and other one is a standart flash drive. I tried to use a hub connected to an OTG cable with no luck. When i plug only one of my devices to OTG port they all work but when i plug 2 of them to hub system freeze or doesn't mount my flash drive. I tried 3 different hubs they are not working. Sometimes i made this setup running with an sd card reader instead of flash and a digitus converter instead of pl-2303. Then i though this can be an issue with the USB 1.1 - 2.0 specifications because pl-2303 is a USB 1.1 device and the rest is 2.0.
After i realize the realtek wifi module in the tablet is also mounted to a USB port i removed the module to check if i can connect one of my devices to that port. But as usual the wifi driver of the system is controlling this port , so when i try to power up the port, system checks if it can find the realtek module and when it cant detect realtek wireless module just shuts down the port back. While this happens i can see my device is connected to system for a few seconds before the driver shut it down.
So this is the all story. I just need this 2 device to work together. I am waiting for your opinions
The tablet is a ATM 7021 processor based cheap tablet.
Thanks in advance.
In the various tutorials for building an Android accessory that uses a USB connection, the first step is to "Select a hardware platform that can support USB host mode." Most of these tutorials claim that that means obtaining a device that is running > Android 3.1 (or one that is rooted, or a tablet, etc.).
In my testing, it seems that, for a phone to support USB host mode, it not only has to be running > Android 3.1, but must also supply power over the USB cable. Can anyone confirm or deny this?
Most tablets seem to supply power over USB, but many phones do NOT. I can't find any place that will directly state that the phone must supply power over USB in order to be able to run an accessory as they all seem to loosely state that anything running >3.1 will work (as long as, at least, the device you're connecting to the phone supplies power). However, in all USB libraries that I've tested, I can make a connection to my USB device just fine from my tablet (which DOES supply power over USB), but I can't get any of them to work with my phone (which does NOT supply power over USB). Both are running > Android 3.1.
Note that I'm not trying to power my accessory over USB. My accessory has its own 5v power source and can even supply power over USB. I just want to build an app that will allow my phone to be able to connect to it, change it's settings, receive data, etc., but I can't get my phone to recognize if/when the device is connected. I don't know if that's because of my phone's unpowered USB, or if it's because of another problem with my phone and/or software. Unfortunately, I don't have another >3.1 phone to test with.
As a side note, the device I'm connecting to is an FTDI/Arduino board that I'm working on which, again, connects to the (powered) tablet just fine, but the (unpowered) phone claims that no USB devices are connected (even though the FTDI board supplies its own power).
Your Android Device needs to have OTG Hardware built in, you can not add it to your phone, most high end smartphones have OTG built in, Samsung Galaxy series does, this allows connection with external USB slave devices, you do need a USB Cable that is OTG which connects pin 5 to GND, this enables the OTG and then supplies power to the device, Like USB Flash memory, if you want to connect an Arduino, you will need an external power source.
As a side note, the device I'm connecting to is an FTDI/Arduino board that I'm working on >which, again, connects to the (powered) tablet just fine, but the (unpowered) phone claims >that no USB devices are connected (even though the FTDI board supplies its own power).
This leads me to believe that your tablet is OTG, and you phone is not.
Well, considering your target area, you might not want risk frying your device before starting to understand the internal pin structure of USB connectors.
I suggest that you use a low-cost non-brand unit. I just discovered this while researching how to direct-solder a +5V DC power source on my broken tablet's PCB, so old that its damaged micro USB port can't be replaced. Normally, an in-market, low-cost, phone-sized Android device (various non-brand products, most of China manufacture) has a very low-power battery attached; no OTG option to play with. It's just getting connected with a PC/USB host to get power for charge and communication over USB/ADB. Almost all of the units I've bought above 7" display size, support even USB 2.x drive as external storage, meaning that OTG is enabled by default.
Try with some other devices from your friends/family/collegues -- just to connect an OTG cable and maybe an USB drive with a built-in LED for easier identification without the PC/Controller device -- if you have enough "test subjects) and they trust you to connect a storage device.
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 :)
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.
I am looking for a way to communicate with a control-board (u can consider it a sensor device) using USB cable. My sensor device supports usb but I think android does not have a way for that.
Can that be possible through Bluetooth dongle?
Is there any Android device available which supports USB host.
USB host has been "hacked" into a lot of android phones, but it's not very user friendly and weird cabling is needed along with a power supply as the phone won't power a usb device.
Some of the "first generation" android tables apparently had USB host on some models.
I've seen pictures of a Xoom connected directly (via a short OTG cable) to a thumb drive that it appears to be powering and reading from, apparently it was unofficial software.
As for your other questions, yes, you can use bluetooth if you get a bluetooth modem for your embedded device. Or you can use wifi. Some of the phones have low voltage debug serial ports. Or you can build a modem / DTMF control interface to connect to the headphone jack...