Connecting an Android Phone to an Arduino

Connecting an Android Phone to an Arduino could not be easier. All you need is an OTG cable. I wrote a previous post here about connecting and controlling an Arduino from your Android device. Previously, I had always connected real Arduinos. This time I tried connecting my DIY Arduino.


Connecting an Android Phone to an ArduinoConnecting an Android Phone to an Arduino




Pictured above is my Samsung S5 (G900H) connected to my DIY Arduino via an FTDI converter and a white OTG cable. The FTDI converter would normally be plugged into your Host PC USB port. With the OTG cable, the Android Phone functions as the host. From the screen shot of the phone, you can tell that the Arduino is loaded with the Minipirate sketch. The phone is running the USB Terminal app. Note: some Android phones do not support USB host mode. To check if yours does, I recommend this app.

When I first connected my Arduino to the Phone it did not recognize the connection. I found out that my FTDI chip had an incorrect product id. The product id was all zeros and needed to be 6001. There is a solution to fix this called ft232r_prog. This Linux command line program allows you to reconfigure (i.e. flash) the FTDI chip. It is a few years old and does not compile on my version of Fedora. (At the time of this post, I am using Fedora 24.) It does however compile fine on an Ubuntu distro. I used YUMI to boot into a live Ubuntu image to compile and run it. Here are the commands to install the prerequisites, compile and change the product ID on an Ubuntu system:

sudo apt-get install make gcc libftdi-dev libusb-dev
sudo ./ft232r_prog --old-pid 0x0000 --new-pid 0x6001

After changing the product id,  the USB terminal app connected to the FTDI converter fine.

Connecting an Android Phone to an Arduino allows you portability in the field. You will want a means of re-charging or replacing the phone battery as the Arduino connection does drain the battery faster than normal.

Leave a Reply

Your email address will not be published.