I have plans to integrate an arduino board (not broght) with a Android 4.0 based PC (1GB RAM, 1,5Ghz Proc, HDMI, wi-fi). Is possible to use this android pc to control the arduino board and act as controller? So i can use the power of android to automate my home.
Here is the android that i have: AK802 Mini Android 4.0 Network Media Player w/ Wi-Fi / HDMI / TF / USB - Black (4GB / 1GB DDR III)
Yes, it is possible. You can use ADK with Android devices that can act as an USB host, starting from Android 2.3.4
For more information you can check the official guide.
There are two ways to talk beetwen Arduino and Android: Android Debug Bridge (ADB) MicroBridge mode and Android Open Accessory Protocol (only for devices with Android version > 2.3.4).
For MicroBridge mode see this work example: USB data transfer between Android and Arduino
The AK802/MK802 Android 4.0 media players have USB host, so there shouldn't be a need for ADK/Microbridge/IOIO. Try plugging it in and checking for /dev/ttyACM0 or /dev/ttyUSB0. You'll still need a way to read/write to this device from your Android app for which you will probably need some native code.
Alternatively, if you don't care about the Android UI, you can simply install a generic Linux such as Ubuntu. From there, everything should be pretty much the same as on a normal PC.
Finally, you can think about a wireless link over Bluetooth. Android supports Bluetooth out of the box, and USB dongles are only a few dollars these days, and an Arduino shield should be about $18.
Related
I want to build a device with sensors (either with an Arduino or a homemade circuit with a microcontroller) and I want to send data from it to an Android device via an USB cable. What is the library required to connect devices via USB? Is there any documentation I could read for it? The problem is that whenever I search for this I only get results about the ADK and their board, not for other devices.
Are there things I should know beforehand? I'm not new to either field, but it's my first project with the two connected.
Thank you.
The first thing to check is if your Android device is equipped with USB host interface. In such case you can connect a regular USB device to your Android and use this API to communicate with the device.
However, typical Android device (virtually every mobile phone) is only equipped with USB device interface, for connecting to PC or another USB host. In such case you have to use the Android's USB Accessory support. The most important idea behind Android Open Accessory protocol is that it swaps (logically) USB device and USB host roles. It's the USB host that looks for the device with particular vendor/product ID, selects particular USB protocol interface, and then simply uses the in/out bulk endpoints found to communicate - pretty smart, isn't it?
To build Android Open Accessory compatible device you then need a CPU with USB host interface. If you want to use Arduino, this shield is probably a good starting point, given its firmware implements Android Open Accessory Protocol already. There are some example applications as well.
This works great on my Nexus7 which is connected over the OTG to Arduino Mega.
Android USB host serial driver library for CDC, FTDI, Arduino and other devices.
Hope it helps!
You have two solution
1: Your Arduino board act as a USB host and power the Android device.
With this solution you have to implement and USB Host stack on your Arduino board and must implement Android Open Accessory Protocol. Your Arduino board must power the Android device. Then you app must use the USB Accessory API to communicate with your board.
Avantage:
work with almost all Android Devices (no need for an USB Host port on Android device)
Disavantage:
The device board is more complicated (must provide power for both devices)
Firmware is more complicated (must implement USB Accessory mode)
2. your Arduino board act as a USB device and the Android device powers
you board.
With this solution your do not have to implement a specific USB protocol. Your board will act as a standard USB device. Since you act as a device you can power your board directly from the USB cable (the Android device will power itself and your baord). To communicate with your board you will use the USB host API of Android.
Avantage:
the device board is very simple
the firmware is simple and easier to debug (you can even test it with you PC)
Disavantage:
Works only with Android devices that have an USB Host port
On most device you will need a specific cable or adapter (ex :otg usb host cable)
I have experience with solution 2, and it works pretty well. All source code for the Android source is available from the link below. I have verified that it works with sensor devices from the company where I work on the following Android devices:
Samsung Galaxy S3
Acer Iconia tab a200
Asus Tranformer Pad TF300T
But it should work on most tablets and recent phones you can see this post if you want look at our experience.
I have an android application which depends on Bluetooth. Now I need two devices for using this but I only have one physical android device. Is there any way in which I can use my device and my PC emulator as terminals while the PC emulator uses the PC's bluetooth adapter?
Thanks.
No you cannot. Simple answer, but emulator does not support bluetooth. I develop bluetooth accessories for Android and have been waiting for BT access from the emulator but for now, the simple answer is NO.
I'm a newbie to the Android development world but have some experience with embedded systems.
I'd like to use an Android phone (4.x or higher) to control other devices via its USB port. We want to set the Android device as a USB host, so solutions where other devices play the host role (e.g. Android Open Accessory Development Kit's Arduino) will not meet our goal.
We are currently using Eclipse-SDK for Android development and successfully have compiled/run/debug several apps. However, I have a very naive question. I was wondering if there is a way one could use the USB port of the development host PC as an input to the Android Virtual Device emulator.
I realize that an easier way to debug the USB-host apps we are writing would be by having a real device. However, the price of the new Ice Cream Sandwich devices is somehow far away from our reach and not the ideal way for debugging an application at its early stages.
I appreciate any help you can provide me with.
The Android Open Accessory Dev kit has been backported to 2.3.4 see here http://developer.android.com/guide/topics/usb/adk.html
So install CM7 or earlier (http://www.cyanogenmod.com/) on your HTC desire and you should be good to go!
Look at the example projects for the 2.3 SDK should help get you going in the right direction.
Path to SDK Samples for me was C:\Program Files\Android\android-sdk\samples
If your looking for USB Host Support basically control and talk to another usb device such as mouse, keyboard, usb thumb drive etc the following should help.
Nexus One as USB Host: http://sven.killig.de/android/N1/2.2/usb_host/
USB Host: External USB devices to Android phones?
Official Android SKD UsbDevice Class: http://developer.android.com/reference/android/hardware/usb/UsbDevice.html
You should take a look at this project, its a great reference
https://code.google.com/p/mover-bot/
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.
I am trying to setup a Nexus One phone to communicate with an application running on a Linux tablet.
On the phone side of things, the Nexus One is Android 2.3.4 so it has the USB accessory library on it. And I have created an application Android following the instructions on http://developer.android.com/guide/topics/usb/accessory.html. I have verified that the Android application works by plugging it into the Microchip Accessory Development Starter kit and connecting to it.
On the Linux side of things, I have configured it to register the Nexus device with the usbserial module and create a ttyUSB0 device when the phone is plugged in. I have verified my application reads and writes to ttyUSB0 correctly. I did this by connecting it to a serial port on another computer and watching data come in through minicom.
Unfortunately The Android developer website does not cover any configuration that host devices (in my case, my Linux tablet) need to perform. In other words, what protocol does the Linux heed to follow to communicate with the phone?
This is not possible. After further research it is not possible to communicate with the Android device using serial USB communication. To communicate with Android applications through Linux use the libusb-1.x library.