Working Android with Arduino [closed] - android

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Has anyone tried to make Android and Arduino communicate with each other?
I found a couple of projects online:
Amarino
Android-Arduino
What do you guys suggest is the best way to make those two communicate?

Either build a serial cable for your Android phone, like this one for the G1,
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/.
Or add a Bluetooth module to your Arduino,
or use an Ethernet-shield for your Arduino and connect via TCP/IP.
Which one to use depends on your project and your budget. I don't know if the serial cable option exists for phones other than the G1. The Bluetooth module has the advantage of beeing wireless for both, the Arduino and the phone, and using the Ethernet-shield you could make the Arduino worldwide accessible by using port-forwarding on your firewall.

I've been working with Amarino since they started and I haven't had a problem since. However I have no experience with other projects since I have only worked with one.
These are my two favorite opensource devices though. Way to go with not joining the iPhone band wagon. It really pleases me when there is someone who takes the initiative to go far and beyond, because it shows that your thinking about the long run. Most people don't.

A solution to this is to make the Arduino act as USB host and have it talk the Android Debug Bridge (ADB) protocol. This works with any stock, unrooted Android device. More information here:
code.google.com/p/microbridge

Your options seem to boil down to connecting the two using a serial interface, or via Bluetooth (I'm guessing you'll either need a Bluetooth shield or something similar). There are many resources on the Internet dealing with setting up Arduinos with both of these.
You may also be able to set up some sort of basic server on the Arduino and be able to interface the phone to it via a console, or through a specially defined interface on the phone, or even a web based interface. There seem to be a fair few robot designs being controlled by Android/Arduino maybe have a look at these.
Without some more ideas about what you intend to do once they're linked it's difficult to be more specific, although if you root your Android phone you will be able to install a cut down version of Debian on it, and then you will be able to apt-get install various packages. With this in mind, there becomes little difference between connecting your Arduino to a computer and connecting it to your Android phone.
[EDIT]: If nothing else you could make an Arduino based one of these: Android Controlled Statue.

I heard someone talking about this before and they were trying to do it via USB but they stated the problem with it was Android does not fully support USB Host. If that is the only issue it seems like it should be easy enough to port over the USB host drivers?!?! Maybe I am simplifying it to much.

I liked Nikolaus answer.
I think the best way to connect is writing a TCP/IP server in the Arduino (Example can be found easily on the internet), and using or the Ethernet Shield (~10U$S) or the Wifi Shield(~10U$S). The TCP/IP server for both solutions uses the same code, the only difference is the INIT.
Mobility: If you need you Arduino to be on the move, buy the Wifi shield.
Static: IF you are static, and only want to control from the Android phone, use the ETH shield (Lower cost).
Adrian

Related

Can you manipulate Raspberry Pi sensor data on an Android smartphone?

I am new to using the RPi and just got the A+ model which I have been using to generate different types of data from external sensors. I was wondering if it is possible to send this data it is gathering to an android device in real-time, and if so the best method? I want to be able to notify the user (through a an app made with the Ionic framework) when the data enters a particular range etc.
And also is it possible to do this whilst the user is walking around with both the devices in hand?
The short answer to the question is: Yes, you can ;-)
The longer answer is much longer, since there are many ways to do this.
The one I personally would choose as the simplest is classic Bluetooth (not LE) using the SPP profile, which basically makes the BT link a serial connection between the RPi and the phone.
On this serial link you invent you own streaming protocol suitable for the data you want to transfer.
On the RPi side you install a module such as this: https://www.sparkfun.com/products/12577
(There are many alternatives, but the RN42 module is very foolproof...)
Don't know the level of your hardware skills, you might need something more plug and play if you feel uncomfortable hooking up the 4 wires needed for 3.3V power and serial communications between the Pi and the BT Module...
On the phone side you install https://github.com/don/BluetoothSerial, which gives you an API reachable from Ionic where you can receive the BT data stream.
With that and a bit of coding on both sides you are good to go.
I've used a Raspberry Pi in combination with an Android smartphone & Lego NXT.
Communication was achieved using Bluetooth on Raspbian. I used a cheap $1 USB Bluetooth dongle. The Bluetooth stack had to be compiled for Raspi, which may not be necessary anymore. Steps can be found here: Bluetooth error: Native Library bluecove_arm not available
Bluetooth seems most logical to me.
I'm at work at the moment, hence the lightweight answer, if you'd like to discuss this further then please leave a comment and I'll be happy to provide more verbose response.
You can upload the data to any cloud services. You can use Xively/Box. Xively is specially made for real time data collection.
To connect RPi to Xively, refer this: https://xively.com/dev/tutorials/pi/
For Box, refer this: http://www.sbprojects.com/projects/raspberrypi/webdav.php
You can then use Xively API in your android app. You can see GitHub for this
Google app store already has some apps for you, if you want to use
It might look a little complex. But its really simple once you follow the above methods.

zigbee hardware in mobile phone [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
Is it required for a mobile phone to have a dedicated Zigbee chip in order to be a Zigbee node (coordinator/router/endnode) ?
If yes, then, I guess there should be a driver module for it as well ?
I don't know about the exact HW structure of mobile phones; in laptop we have a wlan card with its own antenna and driver; how about mobile phone ? there are separate wifi, gps and bluetooth chips with separate driver modules for each, and all sharing the same antenna ?
Thanks
Yes, even though several wireless technologies (WIFI, Bluetooth, ZigBee) can work in the same 2,4 GHz frecuency, you still need a transceiver (transmiter and receiver chip) which supports specifically this technology. In the case of ZigBee, you need an IEEE-802.15.4-compliant transceiver chip.
The idea of including a ZigBee module in one phone is quite interesting. However, I am afraid that you will not find many phones like this. May this change in the future? I have no clue.
Could you give us please more information about your Project? On these kind of projects you usually do not need your phone to be part of the ZigBee network. The coordinator could be connected to one normal PC, and you can provide access to the ZigBee network through an web application. From this application you can serve all data gathered in the network, see the status of the nodes and even send commands.
Another possibility, is to create a network bridge between two technologies, so you can plug a ZigBee chip to your phone through USB, WIFI, Bluetooth, Android port, ... But in this case, unless you find a final product, you will have to assemble some chips and write some code.
At this point in time for ZigBee support the hardware will require a separate IEEE 802.15.4 transceiver chip (802.15.4 is the underlying protocol that ZigBee uses). The most common frequency for operating ZigBee is the 2.4GHz band common to WiFi and Bluetooth, so in theory one chip and antenna could provide unified WiFi + Bluetooth + 802.15.4... but to the best of my knowledge there is nothing on the market (yet). There are however unified Bluetooth+Wifi chips (eg RaLink RT3592BC8). GPS always uses a separate antenna/chip because it operates on a different frequency band.
I've answered a similar question here:
https://stackoverflow.com/a/16985211/1752548
It's about using an SDIO Zigbee card in an android device. I haven't managed to make them work yet, but it looks promising.
Hope it helps

Android app for reading data from external USB-Device

OK i know there are much threads about this topic. But most of em are like 2 years old. Because of that and the fact of new developments from googles side like ADK and stuff, im starting this question again.
All i want to know is, whether it is possible to establish a USB connection to an USB-Device now or not. Like to open a stream to receive the data from a sensor. Think about a device which can be the USB-Host and sends data permanently. All i wanna do is to grab that data.
Im using a smartphone with Android 2.3.6.
Are there any APIs now for this version? Or i have to go a way which includes a modification for the linux kernel or the usage of arduino or a similar interface? Because i would like to avoid that.
Most usb stuff starts coming into play with 3.0 > but I believe its back ported to 2.3 (not sure on it) but basically yes it is possible now. If you can get your device to be a usb host device you shouldn't have a problem, I use an acer iconia a500, running ics, I have a picaxe connected to an ftdi chip feeding me sensor data, once you have the basics sorted out its easy, if you go through my questions and find the usb related ones you should get a lot of information, ill link you if you want to the questions?
In short its entirely possible with the newer versions of Android, however back porting that functionality might cost you the same in time as it would in money to buy a new tablet or phone.
Heres everything I've talked about with usb on here... this stuff should save you a few hours I think https://stackoverflow.com/search?q=user:1174869+[usb]

Android + Arduino project: should I have them talk via Bluetooth or USB?

I'm starting a project where I'm going to try to write a program for Android that will control and/or send/receive input to/from an Arduino gadget. Like, make an LED light blink, as the simplest example. I can either get a Bluetooth shield for the Arduino board and go the Bluetooth route, as per the example Androino! Control an Arduino from your Android device using a cheap Bluetooth module.
Or I can buy a USB host shield for the Arduino board and have the phone talk to the Arduino device via a USB connection, as per the example Adventures in Android ADK Development: Hardware.
Which implementation option is easier and more foolproof both from hardware setup (soldering? compatibility issues?) and programming perspectives (additional Python scripting required? 'listening' on Android for a Bluetooth device vs. a USB device and sending data back and forth?) I've been doing Android development for a couple of months, but I have NO experience with Arduino.
I don't mean this to be a lazy question - I'm able to do the research, but I'm inexperienced and am trying to choose my implementation right away so I can order the right hardware stuff in time for a deadline. I have to make sure I choose an implementation I can actually DO.
EDIT: Might it be easier still to use an ethernet shield on the Arduino board and have the Arduino gadget talk to the Android phone via TCP/IP? I don't know why this didn't occur to me from the beginning. But there seems to be far less in term of tutorials on this kind of implementation, for reasons I'm unsure of.
I am currently working on a project that interfaces an Arduino and an Android phone via bluetooth. And from my experience so far all I can say is STAY AWAY!
All the articles online about cheap bluetooth modules working perfectly are highly misleading to say the least. It might be easy and perfect if you buy an $80 shield, but not if you're on a budget. I bought a $30 shield and it only seems to work on one of the seven Android devices I have tried to use. Furthermore, it seems completely unresponsive to the standard bluetooth connection methodology and requires a host of workaround/hackish method calls that are all highly unsafe and unstable.
On the other hand a USB connection is far more reliable, better supported and of course has the inherent advantage of speed and since it is well supported does not suffer from all the pitfalls bluetooth connectivity does. It is just as easy to setup from a hardware perspective (no work required if you get a decent shield), reasonably priced compared to bluetooth shields and in my experience generally easier to code.
If you are on a budget and can do with a hardwired connection I highly recommend USB over bluetooth.
I don't know the details of either. But I would say if the phone is going to stay with the board then use USB. For lower latency and in general, I find a hardwired connection to be better for all applications.
I have no experience in Arduino and some decent experience in Android and I decided to get the usb connection to work from the phone to arduino to light up the led.
I used a Nexus One and an Arduino Mega ADK and I got the usb connection working in around 5 hours of tinkering and I was absolutely excited to get the led to light up when I clicked a button. But then I decided to go to the next level because bluetooth sounded way too cool to pass up.
Anyways around 30 hours later I FINALLY got it working and I can say it was COMPLETELY worth it. There was a TON I needed to learn, but once I got it working I can say it was not all in vain.
I bought the Bluetooth Itead V2.2 shield ($25 for me) then connected it to my arduino and used my Nexus One with Amarino to send a signal to my chip and turn off and on the led.
http://iteadstudio.com/store/index.php?main_page=product_info&products_id=468
From my experience it was definitely difficult, but the learning curve is what makes these projects so fun. So I would say GO FOR IT!
Good luck in your future works!

How to communicate with a USB device from Android tablet?

From a year ago, Is there a way to communicate with USB devices on Android? this didn't look like a common requirement, but tablets have evolved, and hopefully, the OS has, as well.
I need to operate a simple USB relay card from my Curtis LT8025 tablet, currently running 2.1 patched.
I'm also a newcomer to both Android and java, so relatively clueless!
No need for bi-directional communication, just a simple serial command out to the device.
Any suggestions?
Thanks!
Dave
Sadly, there is currently no standard API to achieve wired communication with Android devices. I was facing a similar issue a while back (see Android: Communicating with a USB device which acts as host ).
I was able to successfully implement the solution provided by CommonsWare. Leave a comment if you need more help regarding this and I can provide details.
Edit (more details) -
Basically, I narrowed down to two possible solutions for this problem:
Modify the Android source itself to include custom drivers for whatever purpose you need and install this in your tablet. Since its mostly based on Linux, if you develop the drivers for Linux, the same can be used in Android with a little modification. This solution is simpler to develop, but not practical commercially if you are not providing the tablet/phone yourself.
Make your USB device act as an host and implement the ADB driver/command-set in your device. When connected, you can issue "adb forward" to forward tcp ports so you can interact with your Android apps and have two way communication between the device and the app.
I used the second method and it works flawlessly. But its only practical if you are making USB host devices. for USB slaves, first method is the only way I recon.
If you are using a serial device and have the ability to talk to it over native serial, you might want to consider IOIO (see http://ytai-mer.blogspot.com/2011/04/meet-ioio-io-for-android.html for more details).
I'm building an Android custom system. I did connect several devices on the USB. I looked to connect a device on the OTG port, the one that usually gets out of a tablet on which you use ADB. I gave up. This is a nightmare. I don't think you can use ADB on the OTG USB that is currently a device and expect to be able to use another device like a USB to serial converter. That means that you loose the whole ADB toolchain for debugging when you want to use the port as a host. On top of that, the USB OTG drivers you have for your tablet was probably not very well tested in host mode since it's not really used that way. So lots of headakes.
The simple way that I found was to use the second USB port on the CPU. This one is a plain HOST port (unfortunately limited to 12 Mbit/s). Unfortunately, I don't know if there are any tablet out there with 2 USB port available from outside (One OTG and one host).
If you get a set-up with two USB port (one HOST) then it's possible to compile as a module (drivername.ko), a usb to serial converter. There are several chipset supported in the kernel source tree and I already used a few of them and it works.
hope this bit of info is helpful.

Categories

Resources