Go Down

Topic: Arduino to android (Read 708 times) previous topic - next topic

jjmuteteke

hello can anyone help im trying to connect my arduino Duemilanove to an android device i need help with this project.

THank you for your help

Kcarp

Not with a vague question like that.

johnA

An Arduino can be connected to Android. One major question you face is which communication medium to use?

RS-232/Serial output from the Arduino is easy. The difficulty is on Android. Android is Linux and that of course has UARTs for serial communication. There may be difficulty in getting linux permissions to the /dev/ttyXXX devices unless you have root access. There may not be a USB-to-Serial conversion installed on the device and so that might be a big problem. Generally linux distributions like Android have that built-in so it's likely ok.

Also Java does not have built-in Serial support. You can use the RXTX library but it may be very difficult to get it installed on the Android device unless you have either root access or you are building Android from source. You can use other languages like C++ on Android and so get to the serial ports that way.

In all cases you will have to choose a serial port that isn't already in use by Linux, i.e. the serial console.

An alternative is to use an Ethernet shield on the Arduino. The difficulty there will be the TCPIP configuration of the Arduino and Android devices. Not terribly difficult but not easy either. I haven't used an Ethernet shield on the Arduino, so other folks can help you with that.

On the Android side, the problem will be that it will most likely use DHCP to get an IP address, so it may change from time to time. If it does the Arduino will have to be reconfigured to use the new address. Most routers do have a mechanism that allocates the same IP address to the same device (if the address available). So chances are this won't be a problem very often. But when it does happen, you won't easily know it. If the Android device is dedicated, you might be able to configure it to use a static IP address (depends on the device). In this case, the IP address doesn't change and so this problem won't show up.

Once ethernet is configured, you will have to decide if the Android side is going to be the listener/server or the Arduino side is going to be the listener/server. Again I have not used the ethernet shield and so I don't know if that capability is present. On the Android side, you may have firewall issues to get incoming connections to occur on your chosen port. And again it depends on the device itself.

If the Android device is using Wi-fi, then the Android software will have to be written to work when the ethernet connection drops out. I believe that you can configure Android to use TCPIP over USB but I've never done it so there may be problems around trying that.

In any case, good luck.
JohnA


Go Up