Arduino Mega ADK connecting to JellyBean Android - android

I have had the most frustrating time trying to connect Arduino Mega ADK board to a JellyBean (Android 4.1.1) tablet. The USB host library from Android ADK does not work for the Arduino Mega ADK board, and the alternative library ArduinoADK-beta-001 from http://labs.arduino.cc/ADK/AccessoryMode does not seem to be available any more (link broken as of November 2013).
I managed to compile some sample sketches on the Arduino Mega ADK using the modified ADK library by circuitsathome.com, which is available from Github at https://github.com/felis/USB_Host_Shield_2.0, but the board then does not communicate with the 4.1.1. Android tablet. Specifically, the tablet recognized that the USB has been connected, but could not communicate with the board. Probable reason being that the JellyBean uses version 2 of the ADK protocol, which is not supported by the USB host library.
I have following questions:
1) has anyone suceeded in connecting the Arduino Mega ADK board with a JellyBean Android device?
2) If yes, which arduino libraries have been used? Where can I currently find the ArduinoADK-beta-001 (or it's successor).
Any feedback is highly appreciated, Ondrej Votava

I know it is too late. But this might help. I had similar issues for the past few weeks connecting and communicating the mega adk and Android. As I got succeeded now, I wrote blog posts which might help you and others with similar issues. I did run the application on Kitkat and Lollipop without any issues, but not sure about Jellybean. Here are few changes that are to be made to make the android application work on most of the devices.
Change import com.android.future.usb.UsbAccessory; to import android.hardware.usb.UsbAccessory;
Change UsbAccessory accessory = UsbManager.getAccessory(intent); to
UsbAccessory accessory = (UsbAccessory) intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
And Here is the link to the blog post http://blog.srichakram.in/2015/09/arduino-mega-adk-and-android.html

Related

Nativescript bluetooth and bluetooth v5.0

I'm currently looking into an issue where my companys app have some trouble establishing searches and connection to a cadence BLE peripheral.
We're developing using nativescript#6.1.2 {N}6 and for the past long while we've used the nativescript-bluetooth#1.3.1 plugin with no issue. It's been used primarily on tablets with bluetooth 4.x.
Problem started when we tried our app on Samsung Galaxy tab A7 with bluetooth v5.0. The app wouldn't start a search or connect with the usual peripheral Wahoo cadence sensor.
What I can do is see the Wahoo sensor in the Android Bluetooth Manager as well as nRF connect and Wahoo's Fitness app. But using the usual plugin doesn't seem to be able to do anything.
I'm still fairly new to the BLE programming game, so if anybody have any advice as to why the Samsung Galaxy tab A7 with bluetooth 5.0 won't connect, I'd be happy to receive some.
So nativescript-bluetooth 1.3.1 is no longer valid in Android versions 10+. I have to migrate my app to nativescript 7 as well. I'm having trouble with migrating, and if you have any suggestions for some of my questions, I would greatly appreciate it!

Android ADK bluetooth device compatibility

I am trying to get started with Android ADK.
My goal is to connect Arduino UNO + blue-tooth and Android devices via blue-tooth.
I discovered that ADK needs Linux kernel 2.6.35+ which is used for Android 2.3.4 to allow communication via USB.
So it's clear that all devices should support this requirement for USB communication.
But what about blue-tooth? Does it mean that the same rules applies to blue-tooth interaction?
Is it possible to establish connection and data exchange with device for instance with Android 2.1 (API level 7).
So, any explanations are warmly appreciated
UPDATE#1
My primary goal is to connect Android 2.1 device with Arduino via blue-tooth.
My first thoughts were that I should use ADK but I discovered that at least for USB it depends on linux kernel version.
But I think it still may be possible to use blue-tooth instead of USB and possibly I may still use ADK, if not how can I connect Arduino with android via blue-tooth without ADK.
Well.. Not sure I understand your problem exactly but I try to give you the best possible answer I can.
There is no relationship between ADK and Bluetooth. You need ADK if you use a USB cable to connect your ADK compatible development board with your Android mobile. The USB compatible board or the ADK shield contains a USB peripheral controller so it can control the USB devices through cable.
In your case you don't need any physical connection between your Arduino and the android device so it is a matter of Bluetooth connectivity. You just have to use a cheap Bluetooth Module with your mobile (Not needs to be an Android anyway).
Now you have to connect the Bluetooth module with your Arduino. Now you have two Bluetooth enabled equipment so you are ready to communicate. I found some good tutorials on web that you can use as a starting point.
How to control Arduino over bluetooth
Arduino Android Bluetooth Communication
Let me know if you need further clarification.
Bluetooth functionality seems to have been a part of the Android APIs since level 5. Thus Android 2.1 should work just fine!

When Arduino meets Android

I read the Android Open Accessory Development Kit and I noticed that:
The Android 3.1 platform (also backported to Android 2.3.4) introduces
Android Open Accessory support, which allows external USB hardware (an
Android USB accessory) to interact with an Android-powered device in a
special "accessory" mode.
So, the Arduino Mega 2560 ADK is supposed to work with android device above 3.1? 'Cause I tried to make it work, but my device is currently 2.2.1, so i guess that's why it wasn't working...
Despite that... Why is the IOIO board working with the 1.5 device? Because the IOIO is also based on the Android Open ADK?
Does anyone have a clue...?
Or is there any way the Mega ADK is able to communicate with android 2.X...?
it depends on what arduino libraries do you use to connect the arduino to android. as far as I know... Arduino Mega 2560 ADK has an USB host interface and can communicate starting with android 2.2.3
you can check Google's ADK documentation

USB communications device class support in Android gingerbread or ice cream sandwich

Starting with Android 3.1, Android devices have limited host support. I have reviewed
android.hardware.usb, and I have found very limited references to USB CDC support. I have a self-powered peripheral USB device, that communicates using USB CDC serial. I would like to connect it to an Android phone operating as a host, and read and write to it.
I would prefer to interface using Gingerbread, but could live with Ice Cream sandwich. I have seen posts that discuss this using custom ROMs, and rooted phones, but that is not an option for me.
Is USB CDC serial supported in Android 3.1 or 4.0? If so, are there any good code examples?
Thanks
I am afraid you are right, Android API does not come with a class driver for CDC.
Have a look at these two libraries:
usb-serial-for-android
physicaloid

Android USB host-to-serial connection?

Apparently with Android 2.3.4 and 3.1 one can now access USB accessories.
I have a Ardupilot Mega (based on Arduino) board with a USB cable connected to my laptop, and I can connect to it using a simple serial communications program over COM7 and 115,200 baud. This allows me into the command-line interface, and I can issue commands and get logs.
Is it possible to write an Android app that will communicate over USB to my Ardupilot Mega board?
I've seen many similar threads, but most of them were pre-USB host.
usb-serial-for-android is my open source library written for exactly this need. It supports FTDI and CDC-ACM usb serial devices using Android's USB host support; no root or ADK necessary. It can talk most Arduinos.
The project is still in its early days, but the basic support has worked well enough for several projects. There is also a discussion list where you can get help.
Unfortunately the library from mik3y's answer (see here: mik3y/usb-serial-for-android) seems to be long dead. It has many problems and waiting pull requests. Also the LGPL licence prevents anybody to fork it and maintain it.
But don't lose your hope, there's a working replacement and it's under the MIT licence. felHR85/UsbSerial.
EDIT: I found a maintained fork of mik3y's library. But the licence or readme is not updated, so I suppose the owner doesn't have a connection to mik3y and simply took it and improved it. I hope he won't get into any trouble because of the licence, because we need this library. See kai-morich/usb-serial-for-android
EDIT2: It seems that all of these libraries are maintained again, mik3y joined forces with kai-morich and they're working together now.
EDIT3: mik3y/usb-serial-for-android is under MIT license now. And still maintained in 2022.
Maybe. Check out the Android Open Accessories announcement on the Android Developers Blog. The Arduino Mega ADK is compatible. Not sure about the Ardupilot Mega.
From their page:
The Android 3.1 platform (also backported to Android 2.3.4) introduces
Android Open Accessory support, which allows external USB hardware (an
Android USB accessory) to interact with an Android-powered device in a
special "accessory" mode. When an Android-powered powered device is in
accessory mode, the connected accessory acts as the USB host (powers
the bus and enumerates devices) and the Android-powered device acts as
the USB device. Android USB accessories are specifically designed to
attach to Android-powered devices and adhere to a simple protocol
(Android accessory protocol) that allows them to detect
Android-powered devices that support accessory mode. Accessories must
also provide 500mA at 5V for charging power. Many previously released
Android-powered devices are only capable of acting as a USB device and
cannot initiate connections with external USB devices. Android Open
Accessory support overcomes this limitation and allows you to build
accessories that can interact with an assortment of Android-powered
devices by allowing the accessory to initiate the connection.
Note: Accessory mode is ultimately dependent on the device's hardware
and not all devices will support accessory mode. Devices that support
accessory mode can be filtered using a "uses-feature" element in your
corresponding application's Android manifest. For more information,
see the USB Accessory Developer Guide.
The following list of distributers are currently producing Android
Open Accessory compatible development boards:
The Arduino Store provides the Arduino Mega ADK (in EU nations or
non-EU nations) that is based on the ATmega2560 and supports the ADK
firmware. DIY Drones provides an Arduino-compatible board geared
towards RC (radio controlled) and UAV (unmanned aerial vehicle)
enthusiasts. Microchip provides a PIC based USB microcontroller board.
Modern Device provides an Arduino-compatible board that supports the
ADK firmware. RT Corp provides an Arduino-compatible board based on
the Android ADK board design. Seeed Studio provides an
Arduino-compatible board that supports the ADK firmware. SparkFun's
IOIO board now has beta support for the ADK firmware.
You can check out the library described in Slick USB 2 Serial Library.
It enables common USB-to-serial adapters to work with Android devices that have USB host mode without needing to root.
http://slickdevlabs.com/
I am currently using the library in my own app, however I think you can get away with just the app that slick has on the market. There are two free apps and one is the "pro" version of one of the free ones; search slick usb in Google Play.
It does use HOST mode and you can change the baud rate to whatever you need.

Categories

Resources