I used Anothem's guide to USB-connect an android tablet to Windows with ADB. Now I need to move forward to the next step and connect a microchip card to the tablet.
I got these 2 cards for USB testing purposes:
1. Microcip FS USB
2. Microcip PIC24F Accessory Development Starter Kit for Android
I can connect them to the computer and test leds, switches etc., however when it comes to android tablet things don't go smooth. When I connect card number 2, tablet notices that some USB is plugged in but the software provided by Microchip don't recognize the drive so it fails. When I connect number 1 (FS USB), nothing happens. It should be related to power, even though I'm using an external power source for FS USB.
Anyway, my question is: what is the "best (safest)" way to connect an electronic card to an Android Tablet. As far as I know, there are 3 options:
1. USB: There are library and compatibility issues
2. Bluetooth: Need external Bluetooth adapters for both card and tablet
3. WiFi (Direct): Probably need to buy an expensive tablet with WiFi direct also a WiFi adapter on card
Can you tell me the safest way to connect a card to a tablet?
USB:
+ Can test via emulator
+ Cable is always safer than wireless
+ Faster
- Need to stay within USB-cable range
- Library and compatibility issues
Bluetooth:
+ No wires
- Battery consumption
- Slow
- Had so many problems with android activity - service - client connections
So I'm gonna go with USB (for now)
Related
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 found the USB docs for Android and from there it seems as if one could write a communication program on an Android phone that works exactly like on a PC.
I have a normal USB-cable that normally connects between a PC and an external device. On one end it is a normal USB on the other end it has a special plug for the device.
If I get an USB female-female adapter I could connect my normal Android phone cable USB end to my device USB cable and so basically plug in my special USB cable into the Android phone.
Does anyone have experience doing USB communcation programming on Android - basically copying normal PC USB functionality? All I would have to do is sent and receive text strings over the USB port - just like on a PC.
Is this possible or is the USB port programming on Android limited in any way
and not really identical to USB programming on a PC? eg. power supply through USB or anything else?
ps on the PC I need to have a FTDI driver installed to work with the external device.
Many thanks
UPDATE:
it seems that starting with Android 3.1 it is possible to do this - however, if I understand htis correctly, Android 3.1 runs only on tablet Android devices - I might be wrong with this - compared to Apple this all this pretty confusing (however, with Apple iPhone it will never work! ;)
Yes, Android supports USB host on 3.1 and newer, so you can connect USB devices directly to an Android device using a converter cable. Android 4.0 brings this feature to handset devices.
Is it possible to access the USB port on Android phones? (Droid X for example)
Here is my usage case:
Have a USB device attached to the Android phone. The phone listens for data on this USB device. (The USB device is connected to a USB->RS-232 converter that has I/O attached to it)
This would be slick if possible. Does anyone know if this is possible?
Would be slick, yup. Not possible though. There's a feature request for it: http://code.google.com/p/android/issues/detail?id=738
Actually it is possible on a lot of the phones if you are able to install a new kernel with a USB host driver and rig up a custom cabling scheme to provide usb bus power to the device as the phone won't. A few phones even shipped with this capability already live.
I don't know if the Droid X specifically ships with this already, can have it added (if you are able to flash kernels), could have it added but no one has written the host driver yet, or is missing the hardware capability.
You also would need to enable the appropriate usb serial converter device driver (identified by experimenting with the device on a desktop linux box), but that's probably already in the kernel sources and just needs to be selected in the config. You may also need to create a device file for the /dev/ttyUSB0 or whatever and give it permissions appropriate to the application that wants to access it. (This requires root, but if you can reflash the kernel, you can get root)
If you want to pursue this, search the android kernel google group for posts about USB host mode.
One serious downside to putting the USB into host mode is that you loose the adb interface into the phone, which makes working on your projects hard. You'll probably need to either build an adapter for the low voltage debug serial port if there is one (as on G1, mytouch, etc) so you can get a console shell (or just use that instead of USB to talk to your peripheral) or at a minimum set up an ssh and sftp server on the wifi.
Since you want serial anyway, another option people have used is to get a bluetooth-to-serial module from an outfit such as sparkfun.
A bluetooth to serial adapter might solv your problems.
You can find one at https://www.sparkfun.com/products/582. Boards from other companies are also available for example on ebay.
I would like to use Android phones as a way to do some processing and visualization of a sensor that would be attached to the USB port on the phone. The sensor would plug into the micro/mini USB, and then I would need to read the incoming data from the USB serial port.
Is this possible? I have heard of people using Android to steer robots and other applications, but I have never seen Android being used as a host for a USB sensor. I can't seem to find any official documentation on the subject either, but it seems like it would be a very useful tool. Any thoughts, links, or information on this matter? Thanks.
What you're looking for is USB Host support.
There's an open issue in Android's issue tracker here for it:
http://code.google.com/p/android/issues/detail?id=738&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
and it's actually ranked 7th, in terms of "stars" (think votes, by the people), at 1110 stars. You can log in and star it yourself, both to vote for it, and to receive email updates.
There was also work on a patch back in February, 2010:
http://groups.google.com/group/android-kernel/browse_thread/thread/c8471573d7553331
and there's info on using a USB keyboard here:
http://www.tombom.co.uk/blog/?p=124
Perhaps you can find something for your sensor there?
This is cool =):
http://www.technologyreview.com/biomedicine/25286/?a=fb
Cheers,
Victor
should be possible, look up android.hardware.usb.UsbDevice # http://developer.android.com/reference/android/hardware/usb/UsbDevice.html
This support has been added since Android 3.1.
Look at http://developer.android.com/guide/topics/connectivity/usb/index.html
This guy has modded his Nexus One to work as a USB host and has done several cool things.
He uses a USB keyboard and runs a movie from his USB stick. Then he runs a webcam through the phone and displays it on the computer and even runs an entire desktop-based Linux distro from his phone onto his computer monitor.
Pretty amazing stuff.
http://sven.killig.de/android/N1/2.2/usb_host/
The USB defines two type of equipment 1 usb host 2usb device .A device can only be attached to a host,no host to host or device to device connection.,in the beginning usb hosts were computers to which a usb device is attached.but with increase in popularity of usb interface a number of equipments come as usb host ie you can attach your pendrive and other usb device to it.In the starting mobile phones were manufactured as usb device ie you can attach your phone to usb host only typically a computer.but there also revolution come in now we have phone which can act as host and device when it is working as host we can attatch printer to it and when it work as device it can be attatched to a computer.only high end phone has this support.low end phones are still usb devices.
so we have two options
phone in usb host mode and your senser as usb device(you will need microcontroller that can act as usb device for this purpose-eg pic 18f2550 microcontroller);
your phone as device and your senser circuit as usb host here you will need high end microcontrollers that can act as usb host
in both cases there involves coding at both phone and senser circuit microcontroller
i dont know anything about phone side coding but i think this helps you to get a direction to what to do.
Have a look at You Are Here GPS.
https://play.google.com/store/apps/details?id=com.agbooth.usbgps