开发者

How to make Android and Arduino communicate without a wireless module

I have developed an Arduino application in which I can control LED 13 via a serial monitor.

That is,

  • if I type 0 in 开发者_如何转开发a serial monitor LED at pin 13 lights up and
  • if I type 1 in a serial monitor the LED lights off.

Now I want to do all this with my Android phone. The issues I have are:

  • How to, first of all, create a PHP server for getting all this worked out
  • How to open up the localhost on my Android device so that it acts like a local server
  • How to make the server interact with the serial port

I am not asking for all the code and project but just show me the way, and I will be all right.


Most Android and Arduino devices cannot talk to each other when straight "out of the box" - add on hardware and/or system software modifications are required.

You have a variety of choices

0) Bluetooth is fairly clean and now in the $20 range, so it's both one of the most cost effective choices and one of the least likely to risk damaging the phone hardware - but you said you don't want that.

1) Some phones such as the G1 have low-voltage serial ports which can be enabled by [rooting and] installing a customized kernel. You will need level translation circuitry as the output voltage of the arduino while low is still too high for the phone to handle. You will also need to source a special HTCUSB connector, either by modifying the full headset adapter or getting it from someplace like sparkfun.

2) Some phones can function as usb hosts by [rooting and] installing a customized kernel. They do not supply usb bus power, but with an arduino you have everything out in the open so cabling up a separate supply should be fairly simple. A few recent tablets have usb host mode out of the box. Edit: with later Android versions, a non-root USB host API and USB bus power may be available, but this varies by model and has been inconsistent.

3) You can use a USB host shield on the arduino, and if the device runs Android 2.3.4 or later use Gooogle's official ADK protocol to talk to software on the android device; if the android version is earlier, there are unofficial projects which talk the ADB protocol and should work with most devices (perhaps with small modifications). Both are designed to remain within unprivileged userspace on the android device - no rooting, no kernel modifications.

4) You could build a low-baud-rate modem and talk to the android device through its headset jack, using a software modem on the android side.

5) You could put a wireless ethernet shield on the arduino


I have no experience with Arduino personally. But the guys over at Cellbots have many projects that use Android phones as the brain for small robots and they use Arduino in most of them. Everything is open sourced, and you might be able to find examples that will help you out there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜