Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android: api to external usb devices for robotic applications

Android devices become incredible cheap (especially those with android v1.6). I'm considering to use one as a brain of autonomous robot. Unfortunately I didn't find any info on that.

I would like to connect two external USB-webcams and some DIY-selfmade USB ADC & output-ports converter to steer the wheels and read analog distance sensors. If I choose some cheap netbook than they usually already have 3 usb ports. But if I will be forced to use a tablet, then it requires also an usb hub.

  1. Do android devices support usb-hubs?
  2. Is there any API to grab still frames from external usb webcams (e.g. "vfa://0" & "vfa://1")
  3. Is there any API to read from USB custom device? Let assume that it will simulate serial port for simplicity.
  4. Do I get all of this in android 1.6 or any newer version?

As an update for your information: Based on answers I assume that android device will be too expensive in comparison to effort. I will go for cheap atom netbook with standard linux & arduinio USB device for controls & sensors. At cost of half kg (one pound) heavier device I will save months on learning & development.

like image 875
Rafal Avatar asked Nov 06 '22 06:11

Rafal


1 Answers

You need an android device that either supports usb host mode out of the box (a few of the cheap tablets apparently do) or a phone that can do so with custom usb power wiring and perhaps a new kernel driver (as many phones can).

You will likely need root.

The api would be the normal linux USB stack, including just about any C-coded source-available device driver available for a desktop linux (excepting those that use bits of x86 binary windows drivers run in a compatibility wrapper).

You could interact with that either from the ndk using normal methods (device files, read/write/ioctl) or with careful driver design so things really look like files you can probably get at some of it from java or at the very least java with some thin ndk wrappers around device file operations.

Essentially, this isn't an "android" question, it's a question about the capabilities of a particular android device's hardware, how to get root on that device, and then it becomes a standard embedded linux question.

like image 145
Chris Stratton Avatar answered Nov 11 '22 10:11

Chris Stratton